Pair project elevator

Source: Internet
Author: User

Pair Programming-elevator Scheduling

12061181 Gao mengye

12061182 Hao Qian

1. Advantages and Disadvantages of Pair programming:

Advantage: You can give full play to the advantages of two people. Each person is good at different places, and the efficiency of cooperation between two people will be higher.

Disadvantage: if two people have a big difference in strength or have incorrect attitudes and cannot communicate well, the task will fail.

2. Advantages and Disadvantages:

Gao mengye: he can come up with various algorithms. Relatively weak hands-on capabilities.

Hao Qian: strong sense of time; weak code ability. It is not very meticulous to do things.

3. Photos of cooperative programming

4. Design by contract, code contract

Assertion is the core of contractual design ). The so-called "assertion" refers to a Boolean statement that is always true. If it is not true, the program will inevitably have errors. It uses three types of assertions: Post-conditions, pre-conditions, and invariants ).

Due to the Information Hiding principle, we do not know the details of an interface's internal implementation when calling it. In order to use the interface smoothly, the prerequisites must be met first. This prerequisite refers to the desired environment before the operation is executed. After the prerequisite interface is successfully used, a subsequent condition is obtained, that is, after the operation is completed. Constants are class assertions that must be met whether or not certain operations can be called on the object.

5. algorithm ideas:

When the elevator stops: if there is a person in the elevator, the passengers on the floor will leave the elevator and dispatch the Request closest to the current floor. If no one is in the elevator, select the request to wait for the queue to be closest to the current floor. If the waiting queue is empty, the elevator will stop.

When the elevator is in motion: Determine whether there are external requests and internal requests for this layer on each layer, and whether the time is within this period. If the above conditions are met, pick up the people, otherwise, it is executed sequentially.

6. unittest

 

 

Pair project elevator

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.