Soft-working trooped

Source: Internet
Author: User
Tags greatest common divisor variable scope

Pair: Yangmei

One, pair programming 1. Advantages and disadvantages of pairing programming

~ Advantages of Pairing Programming:

1. One responsible for writing code when programming one is responsible for review at any time, can effectively improve the initial design and the quality of the code.

2. Two people rotate the role of the driver and pilot, can work rest two, the program quality is not easily affected by a person's fatigue, can work more effectively for a longer period of time.

3. Two people work together to solve a difficult problem, so that two people are more confident, but also not easy to wander.

4. Pair programming at the same time, two people also effective exchange of knowledge and skills, double benefit.

2. Advantages and disadvantages of pairing members

Yangmei: Good study attitude, very serious communication

Second, information hiding

information hiding  refers to the practice of hiding a specific implementation method of the underlying program so that the customer does not know how to implement it, which usually gives the customer interfaceloose coupling

In this program, I design a core interface to hide the specific implementation details of the core, to achieve the information hiding. At the same time, my generate, grade, calc, setting and other methods are less dependent on each other and are basically independent functions, which satisfies the loose Coupling 's design philosophy.

Third, Design by contractPros and cons

~ Advantages:

1. Specify the environment and variable scope of each function before running, so that other functions do not have to be laborious to test every possible error.

2. The precondition of the prescribed method , postcondition and invariant can assist the programmer in writing the program when the self-internal detection, there are some errors can be found in time, Instead of waiting for the final test phase to be centrally resolved.

3. There are tools to help generate documents that make the entire program structure and functionality clearer.

~ Disadvantages:

1. If the external program does not encapsulate the internal functionality, it is vulnerable to exploitation by malicious programs.

2. If a function of the program changes, then corresponding to this function to provide precondition function, rely on the function of the postcondition function and rely on the overall invariant function, are subject to change, which makes updating and maintaining software more cumbersome.

Three, Unit test

Code test coverage is 50% in the code test when you encounter some problems I first test the Core of each method implementation. The main methods of calculator and generator are then tested in detail.

Four Uml

Implementation 1, interface and function display

Calculator: Used for calculations. In the box behind the Math Question, you can calculate it by writing a formula.

Grader: Click Browse to select the file path. Click Grade to finish the selection . After the evaluation results, the current folder will be output in a Grade.txt file.

Generator: Can choose to have no score, there is no multiplication method, there is no negative, number range, the number of problems, the number of operators. Click Generate questions!

If the input does not conform to the specification, an error dialog box will pop up.

2. Main ideas

First set up the Calculator,generator,grader, the three classes respectively as the calculation, generation, evaluation of the task. The functions of these classes are then integrated into the core class.

1. Avoid generating repetitive formulas

I generate a calculation based on the order in which a tree is generated. Each generation of a calculation, we go to the previous generation of the calculation tree, the isomorphic comparison.

2, the unification of numbers

First, I built a Num class. Based on the Num class, the fractional Decimalnum class and integer integers are established to better manage fractions and integers.

3. Calculating infix expressions

Build two stacks, one is a digital stack, and the other is a symbol stack. Follow the flowchart below.

4. Minimal score

Using the greatest common divisor method, calculate the numerator denominator by dividing the numerator by the number at the end of each score.

Soft-working trooped

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.