Pair project -- elevator Scheduler

Source: Internet
Author: User

 

Describes the advantages and disadvantages of Pair programming.

Advantages of Pair programming:

I used to program on my own, and I have never been involved in pair or team programming. When writing code, you may inevitably encounter small errors, sometimes typing errors, and sometimes the algorithms are not fully presented with the code, the Pair Programming just implements this "two programmers sit side by side in front of a computer, face the same monitor, use the same keyboard, and work with the same mouse. They analyze, design, write test cases, code, unit test, integration test, and document writing together. "The environment keeps our code under review, if a person who writes code thinks and writes some bugs, another person with a pair can remind him at any time, which avoids the hassle of searching for bugs in the future. In addition, two people can exchange their own ideas to improve the Engineering Algorithm and implement it in a better and simpler way. At the same time, the two people can learn during the communication and discover the bright spots in their thinking, it can better promote its own progress.

Disadvantages of Pair programming:

Different understandings of the Code may lead to a reduction in the review effect, and the communication between two people does not always exist during programming. Sometimes the two are not in the same room, as a result, one party does not know the progress of the other party, but takes the time to get familiar with it.

 

Where are the advantages and disadvantages of each person in the pair (at least three advantages and one disadvantage should be listed ).

Advantages of Liu Liping: conscientious and responsible, unique thinking, and bug checking

Disadvantage: Not very easy to write code

Advantages of Feng Piao: ability to write code,

Disadvantage: impatient, not fond of bug checking

 

Read the chapters on Information Hiding, interface design, and loose coupling in textbooks and other materials to explain how to use these good design methods.

Information Hiding: classes and classes must use private variables to call the defined methods to obtain private variables, such as get and set, to easily access variables. For example, in this elevator scheduling, the Class and Class are connected with each other using interfaces, and many information can only be accessed through the interface class.

Interface Design: the interface design is a function encapsulation. before writing a program, you need to think about all the functions that the interface implements. If the user needs to change later, you can directly change the class that implements the interface.

Loose coupling: loose coupling prevents the interaction between two classes from being too strong. Modifying one class also changes the other and connecting the two classes using interfaces, when changing the code of a class, you don't have to worry about affecting the other class.

 

Describes the advantages and disadvantages of design by contract and code contract, and describes how you integrate them into your job.

The contract Contract describes the behavior of an object. That is to say, what is the appropriate behavior of an object? Contract is a major design method.

DBC is divided into three types:
1. Post-conditions post-condition postcondition indicates the result that a method is always called. Assertion is similar to assertion. If the language does not support assertions, we must write them ourselves, that is, test-driven.

2. pre-conditions: precondition, which guarantees that the post conditions must meet the pre-conditions. Pre-conditions must be met, and post-conditions must be implemented. Through the combination of pre-conditions and post-conditions of the contract, there will be no obligations with hidden functions. In this way, things are clearly displayed, this design can be implemented as code.

 

3. Class invariant indicates the object state assertions. After performing any operation, the class invariant should be satisfied. The invariant is still strictly defined for the integrity of the aggregates.

 

Reference from: http://www.jdon.com/36303

It is a bit of a clear function, fully ensuring the correctness of the function implementation, but also ensuring the correctness and quality of the Code.

The disadvantage is that there are certain requirements for programming languages. Contractual programming requires a mechanism to verify whether a contract is established. Assertions are obviously the best choice, but not all programming languages have assertions. Therefore, forced language imitation will inevitably lead to code redundancy and readability improvement. For example, before net4.0, there was no assert concept. After net4.0, the concept of contractual programming was fully introduced, greatly improving the availability of contractual programming. In addition, contractual programming is not standardized, so the definitions and modifications between projects are different, causing great confusion to the Code. This is precisely why contractual programming applications are rarely seen in reality.

When writing code, define the functions of the function to ensure that the parameters it passes in meet the conditions and the conditions to be met after the function is executed, the non-variant formula is how to ensure that all operations should be satisfied after execution. During the last semester's object-oriented study, Mr. Wu asked us to learn and practice this content.

Screenshots show how you use unit test of Vs to ensure the quality of the classes you write. Show unit test's coverage for your written class

 

 

Draw a UML diagram to show the relationships between entities (just draw a diagram)

Describes the key of your algorithm (without listing the source code) and its uniqueness.

Actually, there is nothing in the algorithm ...... And have no unique features. Because I was preparing to write a kind of intelligent elevator at the beginning, it was easy to write the code. After I stayed up late and called it for a few days, I couldn't run all the examples. Finally, there was no way, the next day is deadline. I think this kind of intelligence is not something we can control. Then we adopted the most common method: Just judge on the basis of the bus whether there is anyone on each layer to enter or exit the elevator and then decide whether to open the door, A signal is sent to the elevator to determine whether to switch the door. The elevator runs back and forth between the highest and lowest floors, which saves the time for opening the door compared to bus. However, during peak hours, this will not have much impact, however, the results were a lot faster, which surprised me and my friends ......

 

  Bus

Our algorithms

Passenger1.xml 217.05 137.55
Passenger2.xml 949.133 447.023
Passenger3.xml 1426.373 642.043

Pair project -- elevator Scheduler

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.