Pair programming _1
Chi Qiang (187) Min (168)
First, my view of pairing programming, my views on peers and our work.
Advantages of pairing Programming:
1. Division of labor, each responsible for their own parts, high efficiency.
2. do not want to pit teammates, work will be more serious.
3. Two people write the module will call each other, the development process will continue to review the Code of the companion, improve the correctness and stability of the program operation.
4. reduce development time costs.
Pair programming Disadvantages:
1. The division of labor is prone to imbalance, ANI may become unable to work.
2. Two people with different code styles may not be able to read the code, slowing down the development process.
3. There will always be common code in the program, if there is disagreement, it is more difficult to solve.
4. increase the cost of resource utilization.
The advantages of my companion:
1 . very strong programming ability ...
2. very good personality, easy to communicate.
3. The code style is similar to mine, this is very happy ~
The shortcomings of my companion:
1. The disadvantage is similar to me, 11 went out to play, the last two geniuses come back together to continue to work ...
Working Photo:
Second, Information Hiding , interface design, loose coupling
- Information hiding:
The principle of information hiding is the basis of object-oriented programming. The benefit of information hiding is that you can protect the data from arbitrary changes and only have permission to access and modify the data within the program. This allows the program to perform relatively stably, avoiding program crashes caused by data errors.
The functions that the program needs to provide are modular, each module completes its own function, each module encapsulates its own data, only to be accessed and modified by itself, i.e. all variables are Private type. This ensures that the information is hidden. The interaction between the modules is done through the interface, that is, only by accessing the public method within the module , you can and can only get the function of the module (that is, the return value) without accessing any data within the module.
- Interface design:
Interface design principle, can make object-oriented programming package more streamlined. In a modular program, each module (i.e. each class) accomplishes only one function, but sometimes we need a lot of "small" functions to work together to accomplish a large "function". At this time we need to instantiate all the required modules, and then take the method, successive calls, too jumbled. At this point we define an interface that seals the required methods in, and when we need to do "big", we just call this interface. Of course, should try to reduce the common interface, specific problems specific analysis, more than provide a specific interface to users more humane.
To design a good interface, you can no longer play the code in the process of planning, but to start the operation before you want to anticipate what interface. The design of the interface depends on the number of "large" functions. So we have to analyze the function of the user requirements, which functions can be used as "big" function, and this big function needs what "small" function (i.e. class), so that in the process of playing code, we can logically clear, efficient completion.
- Loose coupling:
loosely coupled high cohesion. That is, the modules are as independent as possible, and the internal data is tightly connected. To do this, the function must be refined (modularized) before starting to write the program, and the functions required by the user can be analyzed clearly, as many " small " functions as possible independently . The modules that can accomplish these " small " functions require as little input as possible to return the output and do not rely on other modules.
Third, Design by contract, Code contract
I think there's 2 of them.
First, after clarifying the user and developer's obligations and rights (that is, the user provides the correct input or input status to obtain the program running results, the developer receives the correct input and is in the right wait for the running state to provide the correct running results), the developer in the development process only need to consider the correct input, All incorrect input (does not meet the preconditions), will be an error. Streamline the program logic and shorten the development cycle.
Second, mixed in the whole program of miscellaneous error code snippet removal, clear program logic Framework to help developers debug, on the one hand shorten the development cycle, more importantly, effectively reduce the program running security risks, because the developer debugging more simple, more clear conditioning.
Disadvantages:
The user requirements are high, although the error module can be provided separately to determine the user input and input status, but the time cost is not necessarily lower than the original.
I feel that actually add the contract thought to this job is still relatively simple, this job only a module of the pre-condition is more stringent, that is, the user in the interface input problem module. The pre-condition of the module is that the calculated formula entered by the user conforms to the format rule. Procedures only need to add a wrong module, the non-compliance with the input of the error can be. Other modules because of the mutual invocation relationship, the output of one module is the output of another module, because the output of each module is given, so the input (precondition) of the other module is satisfied by default.
Four, Unit Test
The form section cannot be tested (FORM1), and the proportion of the code is large, if the form portion is removed, coverage is around 85%~90%.
Five, UML
Six, Algorithm Implementation
The interface form uses three tabs to dock different function modules, and the interface example is as follows:
TabControl as a toggle page
CheckBox as if an option is selected
NumericUpDown as a limitation of domain and other
button as the interface for starting keys and calculators
TextBox as display and input file path for some output parameters
Then, generator is responsible for generating the problem based on the settings. Internal core () design ideas and personal projects similar, but because of the different setting parameters, so in the generation process, I take the same big idea of the premise down to different situations to optimize the design of the scheme.
The core of the two modules of the Judger and calculator is the calculator module, which computes the problem of the input string form. The design idea is separates the Judgment format module and the real Computation unit, first judgment whether is legal, in carries on the analysis computation, realizes the difficulty is not very big.
Knot Pair Project Blog