Advantages and disadvantages of pairing programming
"Just end the pairing programming experience, come and report it, by the way, the chicken leg." 】
The so-called pair programming, in simple terms, is two programs ape sitting in front of a computer, a hand-held keyboard fingers moving quickly, a meditation in the side silently staring at the computer screen occasionally also slightly spit a few sentences. Just like this picture below
So here's the problem. The code word does not want to be not the work of the guidance, spit groove of the other side of the practice, this situation is particularly evident in the early stage. Therefore, the disadvantage of pair programming is very obvious in the prophase, such as:
by Code Specification such small problems have intensified a large contradiction.
There are unexpected communication topics in the coding process, which leads to irrelevant issues.
Both apes want to do their own thinking, resulting in contradictions, cooperation and division, the project can not be completed (, not pay, into a vicious circle).
A keyboard directly results in half the efficiency of the code word, and the development time becomes longer.
An ape can impostors as a pensive ape, and does not perform the work of a pilot ape.
There is a strange biological surveillance behind the coding process, Shen panic. Especially when exotic organisms have a long life experience.
......
These problems can affect the development efficiency more or less. However, when you get used to this type of development and engineering to the later stage, you will find that the advantages of the pair programming band are very large:
The most important point is: The code quality is much higher!!! One-to-one-read mode eliminates many small errors, which are often difficult to find but critical (such as the size of a negative number in fractions). later commissioning time is greatly shortened.
The quality of the horse, all coding norms can be effectively implemented, in particular, firmly eliminate the use of the tab space mixed situation.
Two program apes can play a strong coding ability in their areas of expertise, such as a code algorithm, a code interface.
There are two of brain problems in the face of difficulties, high efficiency.
So after a period of pairing programming, let me review the Slag program Ape (Me) and the Great God Siege Lion (teammate)
Slag residue:
As the name implies, very slag, so exercise out a quiet heart to Code program skills. It can be used for a long time and block external interrupts and system calls.
As the name implies, very slag, so in order to avoid errors but will pay attention to code in the specification, will be strictly adhered to.
As the name implies, very slag, so often learn a variety of things, resulting in a variety of things have heard a little.
As the name implies, very slag, so often make very small mistakes, and not easy to find.
Great God:
As the name implies, very god, various high-end algorithms direct dictation.
As the name implies, very god, quickly find the code in the various bugs.
As the name implies, very god, the ability to read code is very strong, slag residue of all kinds of wonderful code to read it again.
As the name implies, very God, God to do not care about certain details, such as the choice of variable name, code norms of unity.
So the slag was fortunate to have accomplished this task with the help of the great God.
Design method and Practice
Information hiding:
Information hiding, hiding information that callers do not need to know, and denying users access to information that should not be accessed directly.
Implementation method: All class member variables are defined as private, and action class members must be called by the appropriate method. The class is encapsulated with an additional interface layer and can only be called through the interface to the inside of the class. All of the objects in this implementation only provide method calls, do not provide direct access, and all functions are encapsulated under a large interface.
Interface Design:
Interface design should be as simple and clear as possible, the caller can easily understand the corresponding function through the interface.
Implementation method: Select the appropriate name, give the appropriate parameters and parameter names. The naming should be done according to specifications.
Loose coupling:
Loosely coupled, which reduces the interdependence between modules and modules. The other party does not need to change the function as usual when one of the parties changes.
Implementation method: Object-oriented thinking is a reflection of loose coupling. Objects encapsulate their own data and action methods, which are called by external methods without direct data. Once all interfaces have been defined and no longer modified, each code modification cannot be more stringent on the input requirements, but it can be more loose and the output should be the same, with fewer side effects and no more. This program function module and user interface to achieve loose coupling, the core uses interface layer to receive user input parameters, passed to the corresponding module for processing, return processing results. The front end does not need to know how the backend is implemented.
Unit Test
For this program, unit tests are used to verify that each part is correct. As shown in. Each of these tests, for one module in the function, tests the processing of different branch routes.
UML Diagram of core module class relation
The Basicnum class implements advanced arithmetic functions for some basic data types.
The number class is used to record the numbers that appear in a calculation, to create, store, operate, and format output functions in several ways that provide fractions.
The formula class records the polynomial, the number of the internal numbers of the class object, provides the random generation function, you can set the parameters.
The program class is the top-level interface class, encapsulating all functions as a unified interface pattern.
Some small tricks are used in the implementation.
For the storage of numbers, regardless of whether the input is fractions or decimals, the form of false fractions (fractional fractions) is used, so that they can be uniformly processed. Heavy-duty output method to meet the output requirements of various formats.
The calculation procedure for generating an analog suffix expression, in which parentheses are added logically rather than manually.
Randomly generated numbers and formulas are controlled by parameters and exist as methods of their respective classes.
For extreme parameters, such as the maximum value of too small and the number of excessive generation, the program is determined to be: successive generation of 50 failed is the argument is not valid. This threshold can be easily modified according to performance requirements.
Talking about pairing programming