oo summary of the second stage

1st,  5th, 6th, and 7th assignment design strategy changes

These three assignments are to identify the characteristics of the objects in the problem domain, find out who is the thread, which data is shared data, and whether security processing is required.

When doing homework 5 , the referenced class diagram and program frame diagram clearly explain that each elevator is an independent thread, and the request simulator to simulate user requests should also be an independent thread, and the scheduling system is also an independent thread. The request queue and elevator status are shared data, and access control is required when accessing.

In job 6 , it generates an independent monitoring thread for each legally input and non-repetitive command, and all monitored objects generate a common snapshot (cache), which is shared data, and the design is relatively simple.

In assignment 7 , each taxi is designed as a thread, and the state data of taxis is a kind of shared data. The call center that simulates the generation of users is designed as an independent thread (this thread is similar to the producer thread), the call processing scheduler is also designed as an independent thread (similar to the consumer thread), and the call queue is shared data.

Second,  their own program structure analysis

1.  Class diagram

 

 

                                                                            

 

 

    

  

Figure 1   Class diagram of the fifth assignment

                                                                             

 

 

Figure 2   Class diagram of the sixth homework

                                                                       

 

 

 

Figure 3   Class diagram of the seventh homework

 

2. UML collaboration diagram

                                                                                   

 

              

   

Figure 4   The fifth job collaboration diagram

                                                                                           

 

Figure 5   Collaboration diagram of the sixth operation

                                                                                         

 

Figure 6   The seventh operation collaboration diagram

3. Class Analysis

 

 

3.  Strategies for discovering bugs in yourself and others

In these several operations, the main inspection point is the security part of multi-threading. The test of card input and card boundary has been much less. In the elevator and monitoring, the goal of establishing multi-threading is clear. Each elevator is a thread, and each request is a thread. In the next few times, there may be several issues that need to be considered in multi-threading. For example, in the problem of taxis, whether taxis, passengers and requests need to establish separate threads, and under which class the behavior of grabbing orders is placed. is a situation that needs to be considered. The test in the second half of the course is slightly different from the first half. Except for the method of directly looking at the code, it has become more troublesome to test through the input-output situation, such as the test in the seventh homework. In addition to looking at the operation of a passenger or a taxi after the input, the practice of inputting multiple commands at a time can only be used as a stress test. Because unless a crash occurs, an error in a certain step of multiple instructions cannot be used to obtain the expected output by means of simulation.

Therefore, the test of the other party's program is mainly to go through your own test samples, because you have a certain understanding of the inspection points and expected output of these samples. Otherwise, it will be difficult for a car to run on a certain road without reading the code. Discover.

Fourth,  experience

  1 The teacher estimated the time to think about the guide book separately for each assignment in class, but after the homework became more and more complicated, I really felt that the guide book needed to be taken out separately before starting to think. For example, I didn’t find the credit of taxis useful at first, I thought it was used to count the actions of taxis, so I didn’t add credit at all in order grabbing. Later, I discovered this when I discussed it with my classmates. Go back and make no small changes.

2 In the process of chasing others, it is better to take a step than to stay still. Gaps remain, but moving forward is always better than doing nothing. It is more important to be able to respond to a request that existed from the beginning than to think that there is a new request suddenly in 2.9s . I didn't think about how to test it at first, so I just used a randomly generated request. Although I can't find subtle mistakes, I can see that the program is running. I think it is the first thing to figure out where each inspection point is and have a certain understanding.  

3 s how me your code is the most important way to learn. On the one hand, this course is to establish the thinking of object-oriented programming, and on the other hand, it is also to improve the coding ability. Every assignment is both a test and a pressure to make progress. Really typing down every line of code makes people benefit a lot.

4 At the same time, io.file , a dynamic lock based on hash value, we are constantly seeing and learning from the data, and communication and communication are also one of the indispensable abilities

 

Guess you like

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