Object-Oriented programming rookie on the road (2)

===Job Analysis ===

1. Multi-thread elevator

  1. Structural Analysis

  

 

  For the first picture, the problem of cyclomatic complexity may be due to the lack of clear conditional judgment logic for elevator running status and piggybacking. In addition, some methods still result in a relatively large amount of code due to too many branches. In many cases it is still difficult to avoid such problems. I also tried to do some planning at the beginning, but due to the limited level, I couldn't make a good design. The actual method design or branch design is still changing the design while writing the code, which will inevitably happen. , but from the current analysis, the situation is not serious, and I believe that it can be improved through future practice.

  Above is the class diagram for this assignment. I feel that the design of this class is relatively good due to the foreshadowing of the previous two elevator operations. The design of the request simulator, scheduler, and elevator is basically similar to the previous two jobs, except that the thread mechanism is added. The printer is a class for unified management of file output, and ElevatorQueue is an encapsulation of ArrayList designed for thread safety reasons (because only ArrayList is known and nothing else is known).

  The thread cooperation diagram is relatively simple and clear. First the main thread Main starts another thread. The function of the request simulator ReqSimulator is to read the request and put it into the ReqQueue; the scheduler Scheduler takes the request from the ReqQueue to satisfy the producer-consumer model. The Scheduler assigns the read requests to the corresponding elevators.

  2. Testing and bug analysis

  This assignment is the most carefully written of the three assignments. But in the end, something went wrong. Due to some omissions submitted, there was a problem with the compilation of the originally perfect program, and the assignment was so ineffective. It's white writing...

Second, IFTTT

  1. Structural Analysis

 

3. Taxi

  1. Structural Analysis

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325192720&siteId=291194637