Pair Programmer:
12061167 Lin Xupeng
12061174 Li Jing
TFS on Pairproject11
Advantages of pairing Programming:
(1) Pair programming is relatively efficient, some basic functions can be separated to write unit in the integration, the core algorithm can be discussed, choose a better efficiency of which algorithm.
(2) Two people are programmed at the same time, not easily distracted, the concentration of a person is higher than one, the two sides can also monitor each other. And if one person real-time to another person's code real-time monitoring, you can avoid the hand slip out of the small problem, these small problems in debugging is difficult to find out, can save debugging time. And debug, you can also let the mind more sober person.
(3) We can familiarize ourselves with the team work in advance.
Disadvantages:
(1) When two people write a program, you may sometimes need to tell each other about the specifics of the implementation of your program that he doesn't understand, which is unnecessary when a person writes a program.
I (Lin Xupeng) Advantages: Previously did Win8app development, familiar with the use of VS, familiar with C #, code is strong.
Disadvantage: Playing code is very easy to make some hand slip wrong small mistakes, debug often from the idea of cutting into, often engaged in a long time finally found to be a clerical error caused by the bug
Li Jing Advantages: The code style is more delicate.
Cons: Not very familiar with the C # language.
(three points from the network)
Information hiding: First, in a class, defined variables and methods can be preceded by an underscore "_" to identify, which is a good naming convention, you can avoid inadvertently assigned to private members. When exchanging information between classes and classes, it is necessary to use a pre-designed method to access the private variables, so that if we invoke the private variables of another class within other classes, then we must define a method to get the private variables of that class, and to change the variables in another class within the other class We also define a way to change the private variables of that class. In C #, it is particularly handy to have set and get, and we can easily define a way to access a class-private variable.
Interface design: A good interface can be provided to the back of the design of a good framework, in this elevator scheduling project, interface Ielevator, Ipassenger, IScheduler, Irequest, we through the interface can quickly know the elevator , the passengers, the scheduling scheme, the properties of the request, which methods to implement, rather than the specifics of the implementation, so that our software testing becomes simpler.
Loose coupling: In our code design, don't worry about breaking code elsewhere. This low-dependency design method between classes and classes makes one class as if it were separated from another class, and they are only connected by messages, so when designing a class, you don't have to worry about destroying the other. When the code changes, you can not change our code on a large scale, we only use the location of a problem module, and then change it is good, and can do without changing the service of other modules.
Information hiding, interface design, loose coupling are the important methods of object-oriented design, are to make the program design more close to the daily understanding, in the relationship between large modules do not worry about the details, just in the module designed to work hard.
Contract Programming:
It gives the programmer very clear requirements, and very clearly proposes the function that the contractor wants to implement.
A precondition (precondiction): In order to invoke a function, the condition must be true, and in the case of its violation, the function is never called, and the passing of good data is the responsibility of the caller. Two-post conditions (postcondiction): The function guarantees the things that can be done, the state at the completion of the function, the fact that the function has that it will end, not the endless loop of three types of invariant items (class invariant): From the caller's point of view, the condition is always true, During the internal processing of a function, the invariant item can be changed, but the invariant must be true when the control returns to the caller after the function has ended. In our code and unit tests, we guarantee the equality of the two sides, and the interaction between the different modules uses the idea of the contract to ensure that the incoming parameters are correct. The validation and inference of the method is also carried out during unit testing.
Test unit and code coverage:
UML diagram:
Algorithm key:
The scheduling algorithm is based on the "history dirction" variable of the elevator, and the information such as passenger or not.
The elevator's initial history dirction default to up.
Each tick:
If the elevator at the bottom, so that its history dirction to up, if the top layer, then set to down;
No person in the elevator:
First check whether there is a consistent direction and current history dirction direction can reach the floor request, if there is, reqstopat recent;
If the current history dirction direction, there is no consistent direction of the floor request, then check there is no direction inconsistent and the current history dirction direction can reach the floor request, if there is, reqstopat furthest, and make the elevator revs variable is true , (the Revs variable is true when the passenger class will enter an elevator with inconsistent direction, this variable is false after receiving the farthest passenger)
If the current history dirction direction, there is no floor request, the elevator direction, the next tick to judge.
When someone is in the elevator:
Traverse all of the elevator internal requests, as well as the current history dirction direction up to, and the direction of the floor request, reqstopat the most recent of these requests.
The uniqueness of the algorithm:
This algorithm ensures that each trip to the elevator will be considered at least once all the requests in the current direction have been completed before considering the problem of steering.
As the topic provides a situation, when a layer and 0 layers have a large number of requests, elevators can only take a part of the stairs each time, the best elevator should be sent to the perfect after a man immediately down and then manned up, at the same time in response to the request. And we started to think of the scheduling algorithm, it is possible that the elevator in the upstairs to respond to high-level requests, and ignore the farther layer 0 and a layer of the request, so because the 0 and 1 levels of waiting for too many, will make the average scheduling time greatly increased.
Using the new algorithm ensures that the elevators will not ignore these farther requests.
Pair project: Implementation and testing of elevator scheduling algorithm