OO course second summary

1. The design strategy of the three operations and its changes

  The fifth job was written directly in the consumer-producer model, which I used between the input processing thread and the scheduler thread and between the scheduler thread and the elevator thread. Because on the ppt, the teacher has already told us the general idea, so my main energy is on the realization of the design. The sixth job was designed to be single-threaded for every legitimate monitoring request, but locking the file became a hassle. In the seventh job, I implemented both taxis and requests with processes, and did not create a request queue to implement the producer-consumer model. In fact, in these few assignments, due to the lack of time, I did not do research on the design strategy of multi-thread collaboration and synchronization control, and only hoped to finish writing before ddl. Therefore, the strategy is basically to think about what to write, what to write about, and there are no rules to follow.

Second, the program structure analysis

  fifth assignment

    1. Metrics analysis results

      

    2. Class Diagram

      

    3. UML Collaboration Diagram

      

    4. Existing problems and deficiencies

      (1) The button can be completely managed by a new class to realize the pressing and popping of the button.

      (2) The constructor has too many parameters.

      (3) The distribution of responsibilities is not balanced enough.

  sixth assignment

    1. Metrics analysis results

      

    2. Class Diagram

      

    3. Problems and deficiencies

      (1) The program is not finished, and there are many bugs.

      (2) Violating the principle of reuse, although I inherited the general monitor class from the four monitor classes, the methods in the four classes are basically the same, but a few parameters are different.

  The seventh homework

    1. Metrics analysis results

      

    2. Class Diagram

      

    3. UML Collaboration Diagram

      

    4. Existing problems and deficiencies

      (1) The coordinates in the program are separated horizontally and vertically, and are used in int type. This can be stored in a coordinate class. It can also reduce the number of parameters passed in the method.

      (2) There are too many parameters in the class constructor.

3. Program bug analysis

  (1) The bug of own program

      1. For the fifth assignment, I used the system time to output the time, so the error is sometimes obvious. When the CPU is busy, it is easy to have an output error of more than 0.5, which is caused by me not simulating the correct output time. Because of this, the other party reported 6 bugs to me in the public beta. Although my program can output correctly when the CPU usage is not much, it cannot be guaranteed that there is absolutely no problem. The mutual test was reported a crash, because the method I set to end the process did not work, and the program could not end normally. I also discovered this problem before, but I didn't have time to fix it, and I thought it was almost an error at the time, so I dealt with it.

      2. I didn't have time to finish the sixth homework because I was going to participate in activities in other places. Finally, I made the other party's report invalid in the readme.

      3. For the seventh operation, I forgot to ignore the passenger request with the same origin and destination, and an error was reported.

  (2) Strategies used to find bugs in other people's programs

      1. The first is to test the program of the other party with the test samples that you have tested. Because these examples contain pits I saw or stepped on during design.

      2. Carry out a certain amount of stress test. In the seventh homework mutual test, I entered multiple instructions at one time, but his program ended automatically after outputting ""The map is not connected, the program ends". I have also encountered this problem, because the gui There is a bug in the part of .java that checks whether the map is connected. I commented this part and solved it.

      3. Look at the code directly. The design framework of these assignments is not very complicated, so it is feasible to look at the code. Look for design defects while watching, and verify the construction samples if found.

Fourth, experience

    1. Leave enough time to think and design, because without a good design, it is difficult to avoid rewriting or making thousands of patches in the middle.

    2. Have enough patience. I used to get irritated every time I encountered a new problem, so I picked up my phone and started swiping various messages. The result is that writing code is inefficient, wastes a lot of time, stops progress, and is physically and mentally exhausted. So I'm constantly trying to find a motivation from the inside out, so that I can be happy to overcome all kinds of problems without getting bored of them.

    3. The current knowledge is too limited, and it is difficult to solve various problems in the process of writing code. Therefore, it is necessary to consult a variety of relevant materials and learn excellent programming skills.

Guess you like

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