Pair project--blog record

Source: Internet
Author: User

Knot pair Project Content: http://www.cnblogs.com/jiel/p/4830912.html

Pair member: Kang Jiahua, Horse prance (Http://www.cnblogs.com/summerMTY)

About pairing programming

"In pair programming mode, a pair of programmers work side-by-shoulder, equally, and complementary. Two programmers sit in front of a computer, facing the same monitor, using the same keyboard and working with the same mouse. They analyze together, design together, write test cases together, encode together, unit tests together, integrate tests together, write documents together, and more. "-The Law of construction"

By reading textbooks and references on the web, I summarize the advantages and disadvantages of the following pair programming.

Advantages of Pair Programming

    1. At the development level, pair programming provides better design quality and code quality, and two people are more able to work together to solve problems.
    2. For developers themselves, knot-to-work can bring more confidence, and high-quality output can lead to higher satisfaction.
    3. At the level of enterprise management, pairs can communicate more effectively, learn from each other and transfer experience, share knowledge, and better respond to people's mobility. In short, if used properly, pair programming can achieve a higher output ratio (Return of investment).

Disadvantages of pairing programming

    1. For programmers who have different habits, they can get into trouble, even contradictions, in their work.
    2. Sometimes, programmers have a problem with each other (code style may be the place to trigger a technician mouth water fights), bickering, instead of a major internal friction.
    3. Two people working together can be a situation where work energy cannot be concentrated. Programmers may talk about things unrelated to their work, instead distracting them, resulting in less efficiency than a single person.
    4. Pairing programming may allow programmers to learn from each other faster. In some cases, learning the other person's length may be as fast as the handlers are breeding a bad atmosphere. For example, a partnership to deal with work, perfunctory projects.
    5. Experienced veteran may feel very irritable in the face of novice. Inappropriate communication leads to disharmony in the team.
    6. Novice in the face of experienced veteran will appear very tense and uneasy, and even the fear of anxiety in the state of mind, so always a low-level error, and the veteran standing behind them constantly accused them of causing more tension, a vicious circle. This ultimately leads to inefficient project progress and team dubious.
    7. Experienced people prefer individual combat, to find someone to stand behind him and watch him may make him feel very uncomfortable, and eventually lead to the emotional impact of programming, but there is a reaction.

My pairing partner.

I was fortunate to be able to form a pair with my classmates, so that the "embryonic stage" and "running-in" of the two partners could be omitted.

I first read my partner--horse prancing code, my heart is gratified, because our two people on the personal project design ideas are almost consistent, personal programming habits and style is very similar, this means that we are in the pairing programming can quickly be agreed on the coding specifications. At the same time, the design of personal work is similar for us in the next pair of projects may have a better understanding.

The task began to now, she has been very active, we assigned the task she will be on time, quality and quantity to complete, and her cooperation really do not have to worry about the task before deadline. Her code structure is very clear, and there are a lot of comments, which are invaluable in pairing programming and team programming, because it's clear that the code that makes it easy for people to understand can save a lot of unnecessary time for the team. And she is very modest, she is not like those who have some experience in programming, to others, Judge "veteran". Whatever you say is right or wrong, she listens patiently and then publishes her own opinions and opinions. Programming with her makes people feel relaxed, so the classmates and her group must make her glow in the team!

Of course no one is perfect, if you want to find some shortcomings in her, then I may have to look in the programming. Although her code is clear and easy to understand, there is a lack of effort to optimize the code. Like the data structure, it is best to use a simple structure to complete the storage of the database, and in some library functions it is more convenient to use more functions than to write one more function, simplifying the code and so on. But this is not a big problem, and so much experience, naturally will develop these habits.

Some design principles and methods

Information hiding (information hiding) principles

Information hiding is the foundation of structured design and object-oriented design. In the structure of the concept of function and object-oriented packaging ideas are derived from information hiding. David Parnas The idea of a hidden message in the early 1972. In his paper, he points out that code modules should be encapsulated with well-defined interfaces that are internal to the programmer's private property and are not visible externally. The information hiding principle can be applied to the application: The layer is added to the layer between layers in the multilayer design, and all classes are accessed through the interface class, all the data members of the class are private, all accesses are implemented through the access function, which ensures the security of the data. (after reference books and data collation)

Interface Design (Interface designs)

After querying the data, I found the following interface design principles:

    1. Clarity is Job #1
    2. Interfaces exist to enable interaction
    3. Conserve attention at all costs
    4. Keep Users in Control
    5. Direct manipulation is the best
    6. One primary action per screen
    7. Keep Secondary Actions Secondary
    8. Provide a natural next step
    9. Appearance follows behavior
    10. Consistency matters
    11. Strong visual hierarchies work best
    12. Smart organization reduces cognitive load
    13. Highlight, don ' t determine, with color
    14. Progressive Disclosure
    15. Help people inline
    16. A Crucial moment:the Zero state
    17. Great design is invisible
    18. Build on other design disciplines
    19. Interfaces exist to be used

(source:http://bokardo.com/principles-of-user-interface-design/)

For my personal understanding, if you want to achieve the interface design, first of all, to pay attention to the first feeling, also means that we design the interface to the user at the first glance to know its function and use, second, the realization of human-computer interaction, interface design requirements are required, do not allow the incomplete and more do not allow redundancy, Do not let users feel confused when using, and then, the planning interface, including layout, background, fonts and so on, to the user's preferences to move closer, and finally, check the integrity, no design flaws.

Loose coupling (Loose coupling)

A software is made up of multiple subroutines, and a program is composed of multiple modules (methods). Cohesion refers to the relationship between the various modules within the program, the coupling is the degree of the relationship between the external degree (subroutine) close. Coupling is a measure of condensation, perception, and dependence between an element and other elements, which can be either a function, an object (class), or a system, subsystem, or module. It depends on the complexity of the interface between each module, how the module is called-that is, what information is passed through the interface.

In particular, the coupling is: element b is an attribute of element a, or element a refers to an instance of element B (which includes a method called by element A, whose parameters contain element B), element a invokes the method of element B, and element a directly or indirectly becomes a subclass of element B, and element A is an implementation of interface B.

How to reduce coupling:

    1. "Low coupling" through application design patterns
    2. Reasonable division of Duties
    3. Using interfaces rather than inheritance

(source:http://jiadongkai-sina-com.iteye.com/blog/749439)

Design by contract

Design by contract the relationship between a class and its client program as a formal agreement describing the rights and obligations of both parties. Bertrand Meyer called it the core of building an object-oriented software system approach.

The proposed contract design is mainly based on the software reliability considerations. Reliability includes correctness and robustness, and correctness refers to the ability of the software to execute according to requirements specifications, and robustness refers to the ability of the software to handle undeclared conditions in the requirements specification. Robustness is mainly related to the mechanism of exception handling. Correctness includes the correctness of the internal operation of the object element, and another important aspect is the correctness of interacting with other object elements.

Some other benefits of contractual design:

    • Document. The document contains not only the description of the signature, but also the contract description, and if it can be further presented as VisualStudio Smart hints, it can reduce the number of errors in the coding process.
    • Testing, commissioning, quality assurance. NUnit is a well-developed assertion testing framework, and if the language itself provides contractual design support, we can make the assertion coverage in unit tests more extensive (consider the fact that developers do their own unit tests) to help uncover more hidden flaws, and assert that the test code is written more succinctly.

This reminds me of the specifications in the object-oriented course of school, including "Required", "Modified", "Effect", a contractual design that is identical to the specifications in Java, are designed to ensure reliability in the object-oriented process.

So how to use the implementation of contractual design? Implement run-time validation with . NET Code Contracts . . NET's contract class library is part of declarative programming practice and can bring many benefits to everyday programming:

    • To improve the readability of the code, the user sees require and ensure knows what input the method accepts and what output it produces.
    • Reduce duplicate validation code
    • With third-party tools, you can easily generate API documentation for static code analysis and unit testing, which can be found in the Code contract home page

The contract class itself has been integrated into the System.Diagnostics.Contracts namespace after. NET 4.0, but if you want to implement runtime validation using the contract method, you will also need to install a VS plug-in separately (http:// msdn.microsoft.com/en-us/devlabs/dd491992.aspx). The specific use method can refer to http://www.cnblogs.com/polymorphism/p/Using_Runtime_Contract_Checking_In_DotNet_Project.html

(reference:http://www.cnblogs.com/riccc/archive/2007/11/28/design-by-contract-dbc.html)

Design ideas

From the construction data structure to the beginning of the expression, we can recursively store the expression, for example (((-5) + (-49) ÷ (-15)) ÷10 This expression, if the expression is considered a parent expression, then he has ((-5) + (-49)) ÷ (-15) and 10 of these two sub-expressions, then continue, ((-5) + (-49)) ÷ (-15) There are (-5) + (-49) and (-15) These two sub-expressions ... Thus, a tree-like structure is formed, which facilitates the storage. So we designed a class of expression to store expressions.

There are many forms in the expression, including integers, fractions, with fractions, and negative numbers, so how do you store these numbers? What we find in common with these numbers is that they all can be fractions, so we've designed a number class that is dedicated to storing arrays, which have three properties: A, B, C (representing integers, denominators, and molecules, respectively), which makes it much easier.

In accordance with the requirements of the pair operation, we have designed three functions:

    1. Calculator: Input valid expression, calculate get answer;
    2. Topic Generation: According to the set parameters, the generation of non-repetitive problems according to the requirements;
    3. Answer detection: Given a document with questions and answers, the answers are judged by right and wrong.

We encapsulated the core functionality into the core class, and we designed four interfaces:

    1. Calculate (), enter the expression string and whether the answer appears as a decimal bool, and return the corresponding answer
    2. Produce (), before using this interface, you need to run the setting () function to set the corresponding parameters
    3. Judge (), enter the path and detection accuracy (0/0.1/0.001/0.0001/0.00001) of the title file and answer file, and return the information of the judgment string
    4. Setting (), used before produce () to set various parameters of the produce

Calculate (), the input expression string is formatted, and the error throws an exception. Generate expression, and then invoke expression's calculate function calculation.

Produce (), use setting () to set the parameters, and then build

Judge (), using produce () to generate the file format of the file for the answer detection, the input precision X, allows the answer to be tested and the standard answer has [0, X] error.

Setting (), the parameter setting for produce () throws an exception if there is an error in the parameter.

In general, I think we have more features in data storage and computing. In the work of the check-up we put the expression in accordance with the rules of the string, and then compared with other expressions, if the same then skip, so this Part I think it is worth mentioning.

Use the VS unit Test

Testing the interface of the core using unit test

Coverage is as follows, because the about, helper, and mainframe are Windows Forms classes that were not called at the time of the test, so they are not overwritten. The test class is the main class that is used to start the program, and it is not overwritten.

Core is the kernel, its coverage is 98.74%, Expression class and number class coverage also reached 99.70% and 98.09%, It can be seen that our testing program covers almost the entire core code area.

UML diagram

Because there is no way to find the UML class diagram generated by the code in VS, a UML diagram is generated by using the method of displaying the class diagram in VS, and a new UML diagram is used to create a relational connection to the class.

Pair programming in progress

Pair project--blog record

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.