Software Engineering: Pair Programming 1

Source: Internet
Author: User

Pair programmers:

Xu Xiaohong student no. 12061193

Li Ruiqi student ID 12061187

 

I. Advantages and Disadvantages of Pair Programming

Advantages:

(1) At the development level, paired programming can provide better design quality and code quality, and the cooperation between the two parties can provide better problem-solving capabilities.

(2) For developers themselves, pairing work can bring more confidence, and high-quality output can bring higher satisfaction.

(3) At the enterprise management level, pairing can communicate more effectively, learn from each other and pass on experience, and better handle the flow of personnel. Because one person's knowledge has been shared by others.

(4) The process of pairing programming is also a process of mutual supervision. Everyone's every action is within the sight of others, and all ideas should be evaluated by the other party. Due to this pressure of supervision, programmers work more seriously. Pair Programming forces programmers to communicate frequently and improve their technical capabilities to avoid being underestimated by others.

(5) Pair programming keeps the code written by two people in the review process. Review is a process of continuous review to improve the design and coding quality, so that problems can be found and solved in a timely manner, so as to avoid dragging the problem to the next stage.

(6) the interchange between drivers and pilots in Pair Programming allows programmers to take turns to work, so as to avoid excessive thinking and resulting in decreased observation and judgment.

Disadvantages:

(1) Pair programming is a gradual process of mutual learning and interaction. Developers need time to adapt to this new development model. The first pair programming is likely to be more efficient than independent development.

(2) If the team members need to work in multiple projects and do not fully guarantee sufficient Pair programming time, the Members will always be in the waiting status, which affects the efficiency.

(3) When the technical level or experience of two people is not balanced, a weak or inexperienced party will often become a bystander, or the other party must give a certain explanation, this undoubtedly delays the programming progress.

(4) when one of them wants to think about it for a while, it may be considered as a non-cooperative performance.

 

Ii. Advantages and Disadvantages of pair members

Name

Advantages

Disadvantages

Xu luhong

Rich experience in coding and debugging

Logic and hierarchical Programming

Strong and can be encoded continuously for a long time

It will be annoying when encountering unconventional bugs.

Li Ruiqi

Strong acceptance ability, able to quickly learn unfamiliar syntax content through searching the Internet

Good English reading level, able to fully understand homework requirements

Be good at learning and constantly reflect on progress

The perfectionist tends to easily bring mathematical thinking into engineering practice, leading to the failure of many ideas.

 

Iii. design methods such as Information Hiding, interface design, and loose coupling

Information Hiding is an isolation principle in the program design process, which can prevent users from accessing certain parts of a class. A program module can hide its information and display only one interface externally. When the specific implementation of this module changes, as long as its interface is not changed, the program can still be correctly executed even if other code outside the module is not modified. This interface ensures the stability of the entire project.

Therefore, when hiding information, you must carefully study the interface design of each module. The more appropriate the design is, the easier it is to modify the implementation of the module. The interface design mainly considers how two modules connect and send signals.

Loose coupling is a principle that must be met in the interface design ). When a class contains a pointer to it to make some changes to another class, the two classes are strongly coupled. In this case, when the latter changes, it is difficult for the former to remain unchanged. If a class contains a pointer pointing to not a class but an interface, when the specific implementation of the class implementing this interface changes, because the interface has not changed, the program can still run correctly without modifying the class of the referenced interface. The loosely coupled interface design greatly enhances the scalability of the program design. By implementing an interface, the newly designed class can easily replace the current class without modifying the class that calls these interfaces.

 

Iv. Advantages and Disadvantages of design by contract and code contract

Design by contract is a software design method that specifies that software designers should define standardized, clear, and achievable interface specifications for each component of the software, the definition of these specifications extends the general form of abstract data types regarding the prerequisite, post condition, and non-variant. The meaning of a specification is the same as that of a commercial contract in the general sense. Its essence is a contract.

The advantage of contractual programming is that we can quickly understand the function and interface form of this module by observing the module interface specifications. On the other hand, if the contract is violated (intentionally or unintentionally), there will be bugs in the program.

In the process of completing the job, we read in detail the program interface and the class that implements the relevant interface, and analyzed and extracted the specification from the interface and class content, when modifying these classes, we rely on these specifications to implement code, that is, to guide the re-design of the process through specifications.

 

V. UML diagram

 

Vi. Algorithm Description

In fact, the whole person is not good enough to get the whole program. Reading and understanding of nearly 1000 lines of code, and coding in a very unfamiliar environment (C #), the start time is very hard. However, it makes sense to look at this process.

The following describes how to implement the Code.

When reading the code, we know that the whole elevator is divided into several parts: passengers, elevator operation and elevator scheduling. The passenger and elevator operations have been fully implemented and basically need not be changed. What we need to do is to call the reqstopat () method of the elevator class in the Schedule scheduling algorithm, place the elevator in the place where it is to be stopped to schedule the elevator. In the schedule class that has been written, there is a queue of the irequest class, which is the instruction sent before the current time point. I did not use the simple scheduling algorithm provided by the instructor, but I have successfully added commands to the queue. So I decided to use this request queue to control the entire scheduling algorithm.

First, the elevator does not know the target floor and weight of the person outside the elevator, which is in line with reality.

When designing an algorithm, consider the code details first (for example, it takes five seconds for an elevator to rise to the next layer, as a 5-second step ). The algorithm we designed is:

Issue floor N for command x outside the elevator

① If elevator I arrived at floor N at this time and had to stop, the time for opening the door would have been wasted. Therefore, the instruction X is assigned to the elevator I.

② If there is no ① case, but there is a elevator J passing through floor N, and the elevator direction is the same as the request direction, then stop and take the instruction x away

③ If there are no first two cases, the command is standby

Instructions for elevator:

Now that a passenger is on the elevator, he must deliver the passenger to the target. In addition, in the design algorithm, we set that the priority of the elevator commands is greater than that of the elevator commands (although this condition will make the code fail to reach the optimal average time, it is relatively realistic. And, generation! Code! Good! Write !). In this way, the elevator will complete the target command during the same operation in the same direction.

In the design process, because the elevator can take multiple instructions at a time, and there will also be instructions in the elevator, so IA boolean array is designed in the elevator to record the target floorUsed to record the floors on which the elevator needs to be stopped. In this way, in the previous algorithm, you only need to mark the Boolean variable corresponding to the number of the floor to be stopped by the elevator as true (originally false ), when the entire command cycle ends, you can determine the nearest target floor of the elevator.

In addition, there are completed and incomplete commands in the instruction set, so we needAdd a flag to the command to indicate whether the command has been completed.. Originally, I wanted to design the positions 0, 1, and 2, indicating that they were not completed. They could be completed either now or immediately (for example, the elevator has been moved up on the eighth floor, the 9-layer command is completed immediately and can be completed quickly (for optimization, for example, the 9-layer upward command can select the 8-layer or 7-layer upward elevator, but the 7-layer command is not immediately completed, so set it to 2 ). However, since the optimized code is difficult to process and time-consuming, I set the command to 2 in the program, but the same effect on 0.

In my opinion, it is very good to switch an idle elevator. Because the rotated elevator is likely to be able to quickly carry passengers in a relatively average distribution. So,When an elevator is idle, I will let the elevator go to the first floor without instructions. As for whether other passengers will be equipped in the middle, the sky will be doomed.

Another key point is the condition judgment for passengers going to the elevator. The original program has judgment in two places (the enterelevator () method and the elevatorstopped () method of the passenger class ). However, if a command is rejected in the elevatorstopped () method, this command will not return to the scheduler's command library in my program design. Multiple bugs are generated here, and many errors are generated here, which is a waste of time. So, IInElevatorstopped ()The method only determines whether the parking floor of the elevator is a request from a passenger to send the floor and the is_inside of the passenger.And is_arrivedAnd send all other judgments to enterelevator ()Method for unified processing.

Software Engineering: Pair Programming 1

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.