"SE" WEEK3: arithmetic-generation scoring tool Extension&release Version (pair project)

Source: Internet
Author: User

    • Foreword

  The knot to the project finally came to an end, in addition to the overall process of software development has a deeper understanding, more profound understanding should be a pair of programming to the process of promoting the role.

In this want to form but really wordy a few words, very grateful to the students can take the trouble to accept every time I modify the software proposal, and in the code implementation process for the team to contribute a lot of personalized tips;

In addition, he actively studious mentality also very let me admire. From the initial into object-oriented, the use of data structures, the actual project development, he quickly mastered the skills;

And in the process not too hard to stay up with me, in a short 48h of efficient use of time, the development of this a lot of features of the software. Thanks! =)

Finally, the user needs see: http://www.cnblogs.com/jiel/p/4830912.html

    • Brief View

  This section provides a brief introduction to the software features:

"Basic Requirements"

1) The software is written in C # and passed the requirements test under the Msunit framework.

2) The software functions are divided into three parts: the arithmetic expression generator, the four expression evaluator, the four expression calculator, all have reached the user requirements.

3) The use of XML files in the front and back of the module to pass parameters, improve scalability.

"Outreach section"

1) UI interface development, the use of multi-threaded front-end tasks at the same time, increase the progress bar, and support the menu bar for files, settings, help three aspects of navigation.

2) Generator: 1. Supports customizing whether there are decimals in the expression, and the precision of generating decimals.

2. Support two modes, normal/batch mode: Generate a single file in normal mode, the number of generated files can be customized in batch mode.

3. Support memory last set, prevent each open program to repeat adjustment parameters (through XML).

4. The Stop button is supported to prevent the user from being too demanding and unable to generate the appropriate number of formulas, at which time the user can abort manually without losing the generated content.

5. Support to select whether to open the file/directory immediately after the build.

Rating: 1. The scoring method with decimals is supported, and the correct accuracy (eg) can be customized. When the accuracy is 0.01, the correct result is 0.33333 .... The answer given is 0.33 is considered correct)

2. Support two modes, normal/batch processing mode: a single file is scored in normal mode; In batch mode the user can enter a regular expression to filter the file, and the program will batch-score multiple files that match the Ha Zheng expression.

3. Support memory last set, prevent each open program to repeat adjustment parameters (through XML).

4. Support Stop button, function as above.

5. Support software to run the log content output, when the scoring system encountered an illegal expression or any abnormal situation, will be in the Log window output to remind.

6. Support Level scoring system, the user can open the level score in setting, and set the range of each level, the program will be ranked by the range of each result.

7. Support to select whether to open the file/directory immediately after the build.

Calculator: 1. High redundancy, all error conditions will give the corresponding prompt.

2. Support memory of the previous step calculation results, and can enter the result with one click.

3. Enable/disable keyboard input.

4. Support fractional fractional blending operations.

3) Setting: Enables users to set up multiple functions through a unified set-up interface.

"Interface"
1) generator (normal mode)

    

2) Generator (batch mode)

    

3) scoring device (normal mode)

4) the indexer (batch mode)

5) Calculator

    

6) Setting the interface

    

7) Run-time interface

    

    • Blog Assignment
      • Pair programming

      The pattern of pair programming is not the first experience, but every experience will be fruitful, can not help but sigh:

"Ah, it turns out that the way people think about things is so different. " His idea of this is very good and worthy of reference." " I was in ...." There is a comparative advantage in this respect. " ... .

       Each pair of pairs of programming will learn from the other side of a lot of places to learn from, but also a deeper understanding of their own step.

As in this pair programming task, when I write interface code in the end of the audit, he in I repeatedly tangled in the code cleanliness and waste time, put forward the comments, timely restore a lot of time;

I am in the process of writing a fastidious attention to the use of Code, Code encapsulation, style of cleanliness, resulting in a lot of the initial development should not become the focus of the issue has been too much attention, to a certain extent, reduce the development efficiency.

And the can end in every time I "sick" to remind, so I can quickly complete the development of early code, and the encapsulation, streamlining, and so on once left to the post-operation.

In this little thing, pairing programming reflects the differences in our respective minds, and it also gives me a wake-up call to clearly divide the tasks of each stage.

In addition to recognizing this deficiency, I also have a further understanding of OO ideas after exchanging roles. In the process of writing the review code, I found that he was not very sure about the design of the class, the interaction between classes, and the role of the class, so I have designed some exercises to help him master this idea in addition to the review process of correcting his oo thinking. Through such communication, on the one hand can end in OO programming has greatly improved, I also have a more systematic understanding of OO.


In addition, to modify the function of the calculator, the rush to complete the function and careless I forgot to consider a variety of situations at the same time, such as the "=" button on the interface to modify the Click event needs to be assigned to the KeyPress event "=/enter" event changes.

This problem if I am programmed to leave a hidden bug, but fortunately the end of time to point out my negligence.

In conjunction with my experience in pairing programming, I made the following three-point definition for reviewer's work (see Color section):

The so-called "lookers, Onlooker sees most", pair programming coder will be more focused on local code writing, thinking of code logic and code style, but difficult to see the whole world, instead, reviewer in pair programming does not need to consider how the next code to write, but to stand in the global perspective , synthesize coder Current progress to analyze (critical thinking), Forecast (active prevision) and Remediation (resonable revision): Analyze whether existing code conflicts with previous modules, and whether the logic is perfect; predict the logic that coder might use next; combined with their own predictions and coder the actual work done to correct, the amendment here includes two aspects, if the expected and actual match, there is no need to amend, or to consider whether it is their own prediction error or coder negligence, Such predictions can not only improve the logic level of reviewer itself, but also allow each other to learn from each other and eliminate more potential bugs.

In terms of efficiency, I think the effect of pairing on programming is really huge!

Given the fact that I don't know each other before, and the professional background is different, it's a waste of time to start pairing programming immediately. Therefore, we have wisely chosen to put more time in the pre-running phase, rather than software development .

So before we start software development, we meet and understand each other's levels. Given the ability to end up with a little bit of code capability, a quick-run-and-improve approach allows him to refer to the code I wrote earlier, drawing on the object-oriented thinking and code style.

We have decided a unified style and way of thinking, can end with two or three days to carry out a simple "student educational management system" development, has reached the ability to pair programming requirements.

After that, the efficiency of pairing programming is immediately evident! We quickly analyze the user requirements, design the code structure, and analyze the parts of the WEEK1 engineering code that need to be modified.

because there are two people, many of the easily overlooked details can be taken into account in the prior period , such as whether the parameter should be passed with XML or function, the front and back end should be two threads or a single, and so on.

The module thinking that is designed by using the XML and the function parameter is different. The backend with XML design has greater independence, more extensibility, and more modification and redundancy testing at the back end, while the use of the function is simple but difficult to expand, the front and back end independence is lower.

The pros and cons of the two of us, and the difficulty of implementation, unanimously decided to adopt XML. If you do not notice this before the beginning of the development of the backend, and so on when the real attention to change will change a lot of code structure, greatly reduce efficiency.

The details are too much to mention here. because there are two of brains to analyze together, so that the finer things are difficult to escape the capture of thought.

In addition to allowing us to consider more thoughtful, pairing programming also "forces" us to "work-out" to put into the task. A very obvious feeling is that in the past, I used to write a little bit in the programming of the microblog, stroll down Bilibili, check QQ, lack of independent supervision of the ability.

And in pair programming, the two sides are the best supervision of each other, which requires me to concentrate 100% . Thanks to this, we will be able to complete development in a short period of time.

Finally, pair programming also let me know the first foreign student friend, thanks =)

Finally, the pros and cons of routine:

The advantage of the energy is not to pay much attention to detail, the phased goal is clear;

Subtle into, can pinpoint hidden small problems;

Learning ability is strong, and is subjective learning rather than passive acceptance, so in the process of discussion his subjective thinking is very important.

The disadvantage of the energy side should be that the previous code has less experience, and I often need to remind you when writing code.

My advantage lies in having better Oo thought;

The overall architecture and interface of the software are well designed;

Previous code is more experienced and more efficient in writing.

My weakness is that sometimes I pay too much attention to detail, and sometimes I get careless (--| | | Am I a chimera? So contradictory. )

      • Information hiding, interface design, loose coupling

the content is covered in the Code Complete book.

1) Information hiding:

The text of section 5.3 in the book is excerpted here:

"Information hiding is part of the foundation of both structured design and object-oriented design.

In structured design, the notion of ' black boxes ' comes from information hiding.

In object-oriented design, it gives rise to the concepts of encapsulation and modularity,

And it is associated with the concept of abstraction. "

According to the above information hiding is the basis of structured programming and object-oriented thinking. It produces the idea of black-box testing in structured programming, promotes the concept of encapsulation and modularity in object-oriented processes, and is related to abstract programming thinking.

In order to demonstrate this, the author uses the "Iceberg theory" as a description. Our code is consistent with the iceberg, and we need to hide most of what we don't care about, leaving the visible part to the people who really need it.

There are two factors to be aware of when adhering to this principle:

1. Hidden complexity: The complexity of the function needs to be hidden in a separate package, on the one hand to prevent the use of repeated writing, on the one hand to prevent external calls to increase program uncertainty.

2. Hide the source of change: Some of the global changes in the program often occur in the source needs to be hidden, such as counters, can be used in function encapsulation to accumulate, avoid directly to the count value operation. This can enhance code security and extensibility.

Used in this pair programming, for the sub-process in the calculation, a logical more complex string analysis function, we have to encapsulate it separately, and only in the higher-level public methods called, so that the calculation of the complex process of hiding.

In addition, for the expression generation, we need to set some basic parameters, we use the method of these changes in a separate package, external and internal only through this method to change parameters, enhance the robustness of the program.

2) Interface Design:

According to the definition of Good class interface in section 6.2 of this book, a good interface design should be satisfied: good abstraction and good encapsulation.

On the one hand, the class responsibility, the role of high abstraction, the class itself, the class and the interaction between the class, behavior, functions are made an abstraction, and ensure that the dependencies between these abstractions are minimal.

When these abstractions are completed, the interface is then designed according to the details to encapsulate the method.

One of the best examples of this pair programming is the design of fractional classes. First, starting with the concept of fractions, consider the following questions:

What are the constituent elements of it itself? What method do you need to use? How can it interact with other fractional instances, even instances of different classes?

It is clear from this consideration that the fractional core is the numerator denominator, within which there can be a simplification of the operation, which can be arithmetic and so on.

Therefore, the interface design of the fractional class is very clear, the operator is overloaded to support a variety of class operations, the internal implementation of a numerator function for simplification.

3) Loose Coupling:

According to the definition of Section 5.2 in the book, coupling can be divided into the following types: simple data coupling, Simple object coupling, object parameter coupling and semantic coupling.

The coupling is more tightly coupled, and the final coupling is often dangerous.

In the early phase of the pair programming project, the front and back end of our program did encounter the problem of semantic coupling. such as the end of the Stop command to abort the back end of the running program,

At this point, we started by passing the identity bit, through the front-end to inform the backend stop information.

But this way in the multi-threaded design is immediately rejected, instead, we let the backend program actively polling the state of the front-end, to avoid the transfer of parameters.

On the other hand, in order to prevent the passing of too many parameters, we take the XML file, let the front and back end through the read and write XML file parameters, so that the actual passed parameters only one XML file path.

        

      • Design by contract, Code contract

      Speaking of this topic, the first reaction in the head is the nightmare of the two O'Clock OO course. W (? Д?) W

(Pure handwritten data abstraction, pre-and post-conditions and invariant!!!) A test voluminous wrote my half pen!! Anger! (╯‵-′) ╯︵┻━┻)

Based on the wiki's interpretation, it adds a pre-condition (precondition), a post-condition (postconditions), and a invariant (invariants) to the normal data abstraction extension.

According to the content of Wu Teng teacher ppt, his understanding of the contract (contract) is as follows:

"The goal of the data abstraction specification is to provide a contract for the user to provide a specification for the person who implements it;"

Users don't have to worry about what data a class holds, just what the class can do;

The implementation is concerned about what data a class should hold and needs to be implemented to determine the type and storage structure (i.e., data structure) of the corresponding data

----> To achieve the promised contract efficiently, efficiently and robustly! ”

Thus, the Design by contract approach is an important bridge between the user and the person who implements it. The lack of a contract may cause the method to be called unsafe, and the implementation of the function does not meet the expected results.

Therefore, in the early stage of the design needs to the various classes of data abstraction and contract settings, but in the early stage of the development of the project we did not make a contract, but through the later reflection, you can find a good contract to avoid a lot of bugs.

For example, expression classes in the design (data structures that are stored in a calculated form in the Order of operations) are recorded as follows when generating the expressions:

(1 + 2) * (3-1)------> Exp[3] = {{1, 2, ' + '}, {3, 1, '-'}, {①,②, *}};

Where there is a strong demand for ①, ② where the presence of these markers, for example, in Exp[i] can not appear >=i identifier;

And at the last step, all the tokens should appear, otherwise the previously generated formulas will not be exploited.

Since there is no appropriate data abstraction at the beginning, invariant and so on, resulting in later debugging difficult to locate the location of the bug, greatly wasted time.

If you write an invariant to the expression class, it forces us to think about what conditions the class needs to meet. And in each method to meet these conditions, even if not satisfied, the cause of the error can be based on the invariant error in the place to quickly locate.

In general, Oo's suffering is a lost.

"SE" WEEK3: arithmetic-generation scoring tool Extension&release Version (pair project)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.