Beijing University of Aeronautics and Astronautics in 2019 OO Fourth Course summary

Beijing University of Aeronautics and Astronautics in 2019 OO Fourth Course summary

A, UML operations summary

1.1 Thirteenth jobs

This operation only needs to complete a simple parser UML class diagram, the identified relationship between the respective elements and elements from UmlElement set, then the corresponding query instruction to execute.

The difficulty of this assignment is to correctly understand the meaning of each term represents the UML exported file, including inheritance and implementation representation, parentIdmeaning and so on.

Architecture, similar to the adjacency list structure can easily achieve all kinds of inquiries, the thirteenth operations can be divided into the following three steps:

  • UmlElement appreciated that each subclass and its meaning attributes, each query understanding how the data structure corresponding to
  • Reading incoming parameters, initializing the corresponding map (e.g., to the interface classes, a class to the class associated to the peer, the class properties, etc.)
  • Design and implement algorithms corresponding to each query

The job has a recursive set number obtaining mode, so there are many job recursive functions.

1.2 Fourteenth jobs

The work adds to check and two plans for the new map is relatively simple, and basically the same as before. In order to avoid focus function Interaction, consider FIG isolation for respective different classes, only main class instance of these classes and calls the function to which the corresponding.

Validity check is more complex, for the three checks were designed as follows:

  • For named repeated: this is simple, a class for which a same name for the next detection domain of all classes and attributes of the end of the class name, as I understand this two associated class name of the class is typically terminated member variable corresponding to the class name in another class, and the other members can not be the same name attribute.
  • For circulation can not inherit: first to define the subjects - a directed graph, nodes are interfaces and classes, inheritance edge is (no interface relationship), research problem is detected in FIG ring (including self-loop), where I use an ordinary spire algorithm (Tarjan algorithm) to detect the ring. Because for directed graphs, one group of strongly connected components is a circular inheritance objects. Also note that the algorithm can not detect loopback Tarjan, to extra determination.
  • For inheritance can not be duplicated: The study is a directed graph, nodes are interfaces and classes, and inheritance is implemented side relationship, the problem is studied for any two nodes in the graph, there are two different paths is not connected , if such a node, the node should output source. May be used herein reversed, by turning turn to a rear view of the root node (node 0-degree) to do the search, if the search process has been accessed the neighboring points when traversing a point adjacent vertex, then the there are two paths up collar points, points and all its descendant nodes to be output. This will repeat a search to find all of the legacy node, without searching through all points sequentially entire map.

Two, four cell architecture and method for understanding the evolution of OO

The first expression unit derivation 2.1

This unit is the first official to write object-oriented programming, the first time I had the various entities in the program abstract idea. I began to be able to design and carry out the procedure described in natural language common relationship. E.g. derivation, calculation, and so complex. I ended up with grammatical relationship-based, we designed a complete derivation procedure, and as far as possible to make room for more design (final my program still can easily support more than the guide book).

In addition to learning object-oriented knowledge, I have a better understanding of some of the Java libraries and mechanisms, such as BigIntergerclasses and regular expression classes, etc., in the course of the use of these packages also can learn OO design knowledge and these developers ideas - for example, how to design a support an infinite number crunching class that should be what methods, properties, how to design it is easy to use and so on. In fact, we do a polynomial derivation system, and these libraries is much like the idea.

All in all, the first official job as I opened the door to an object-oriented, I can not begin to procedural thinking design program, and also access to the factory mode, and so more systematic design approach, made me realize that design importance.

Elevator Design 2.2 second unit multithreading

This unit is the first time writing multithreaded programs. I start from this unit will focus on scalability and can consider continuation of modeling in the design. In the first job I will consider the need for follow-up that may arise. Although the group is often required courses beyond imagination, cause I can not fully use a consistent set of code to accommodate growing demand, but at least the starting point of this idea is good. My code now seems to have as much as possible in line with the principle of opening and closing.

Why writing multithreaded programs, in my opinion, for several reasons:

  • Improve resource utilization: This is no doubt, change the order of operations can reduce idle CPU time, avoid meaningless waiting
  • Simplify programming: will have different responsibilities and timing requirements for the work of abstract threads can greatly simplify the procedure of difficulty, easy to implement program
  • Improve the speed of response procedures: Avoid a program has been open to handle other messages without listening, the server processes such as faster response

At the same time, this work also made me understand some of the basic design, SOLID refers to the SRP (single responsibility principle), OCP (open closed principle), LSP (Richter substitution principle), ISP (Interface Segregation principle) and DIP (dependent inversion principle). The third lift my job scheduler to perform too many responsibilities, from incidentally to transfer, and then select the elevator and down, all work is completed in a class, not in line with the principle of SRP - should break down scheduler class or let the elevator to assume more responsibility. At the same time I dependencies between modules is very serious, top and bottom modules depend on each module code changes lead to high risk, very consistent with the principles of DIP.

2.3 Modeling Language JML third unit

The third unit Let's first exposure to the concept of the program specifications. This is of great benefit to the module and normative understanding program. Overall three jobs is a view of the structure slowly evolving process, including the evolution of the properties and query pattern of FIG.

The job I think most "OO" The place is an abstraction of the map. Whether it is the object of a different large metro system in each small Path, requirements or queries need, they are essentially just a no size, structure, topology and specific meaning to chart the difference. The FIG abstract class and implement a specific query and includes various modules to accelerate a practice is a very good inside. The work I deeply understand the abstraction and reuse.

Of course, the main job, JML modeling language also opened my eyes. This is a team for the future development of useful - if between people through simple, unified description of communication system, a lot of work can improve efficiency, eliminate unnecessary to read the code, and so ambiguous interpretation process. (If people in real life, like JML so straightforward enough)

Fourth cell UML 2.4

The fourth unit to help in the OO level I think that the program is not going to write itself. The assignments in order to understand more like UML and design - in fact code and there is no difficulty with depth, as long as the correct understanding of UML is very good implementation. Between use UML to describe the complexity of the code and the code, logic and timing relationships within the code that I think is the most exciting. In fact, UML is a guide design ideas, designed to help understand the connotation of a very important tool: it summarizes and refined classes, inheritance, implementation, elements of object-oriented programming in the association and so on, and express their relationship with the three figures clearly.

Three or four unit tests to understand the evolution and practice

3.1 The first round of job

In order to reduce the current round of job BUG, improve accuracy, I debug from manual and automatic two angles. The main part of the manual for the simple classification and boundary testing. Classification tests need to design the input of the classification tree , the tree includes a diverging point of the presence or absence of each item, in the form of input, etc. is omitted. The main test for the boundary conditions and extreme difficult circumstances conceivable, for example, empty input, \ v symbols, the zero-order items, and so on.

The main use of automatic test automation python regular expression builder, The subprocess and scientific instruction function calculation package, so that the depth and length can be made strength test, automatic test points can be customized. Although the quality of randomly generated test points may not be high, but the number is large enough to also improve the reliability of the program.

This is my job in accordance with their own ideas simple design of the test mode, the system is also the first test for his program.

3.2 The second round jobs

Multi-threaded test more complex and difficult than the ordinary procedure, BUG found and ruled out as well. The job I just use a large number of test points and a large number of repeat test to find BUG. The job I had the pleasure (not) found a thread BUG, through tough instrumentation analysis I found that BUG: the elevator is running (for example, 1-2 floor), the elevator has not updated their floor where (as 1 also F), then if a thread switch occurs, the scheduler 1-2 building instructions in instruction sequences misjudged add missing so that, after executing the elevator in a building after 1-2 performs a resulting ARRIVE-2output twice.

I deeply felt the importance of multi-threading is not easy and the design principles of programming. Between threads should never be made in accordance with stale data possible action, if I earnestly fulfill various programming template, it will not appear similar problems. Multi-thread synchronization issues extremely difficult to detect, is also extremely difficult to resolve, in the programming process must not go back to the old program DEBUG (Not after the first pollution control), A program designed from the beginning, we must seriously and in accordance with the principles of happens-before check-then-act, read-modify-write and other templates, sort out the implementation of a clear relationship between threads, design a good reliable source architecture less error-prone.

3.3 The third round of job

I started in a "see speak compliance compliance namely the United States," the idea, based on a simple JML achieve the most simple logic (algorithms alone), the error of underestimating the courses required group. When measuring a lot of strong points emerged TLE issues, now reflect the following main reasons:

  • Not fully aware of the reality of background topics: reality, most queries are multi-check system less change of structure, every query recalculate beneath a computer science student quality (especially the concepts already learned a cache, etc.)
  • No serious content combined with data structures: data structure is a very important programming content dependent algorithm, blindly use brute array beginners do things, the program not only to complete the task, but also to accomplish the task

If required to conduct stress tests based on the subject, I will find the problem, which left me with a profound lesson.

3.4 The fourth round of job

UML's main problem lies in the understanding of the requirements of the subject and consider the special circumstances. Since this operation All elements are unified as a parent UmlElement, this is actually designed so that there are many hidden dangers null pointer - a map is not likely to be an element in the keyset access. The risk appears to be very simple but actually very subtle, and I have appeared at the students around me in. This wake-up call I never should feel free to use the content may appear null pointer, as map.get()so on.

Bai Xinyu people here would like to thank the students of the metronome, which provides a lot of convenience to the test.

Fourth, the curriculum harvest

  • Design level: I am no longer a racking our brains began to write code, but should be thinking seriously about how to design a reliable and efficient code architecture. First used to pave the way for further progress for developers is very important. I also learned what is abstract, abstract what is good, what kind of abstract more scalable and more.
  • Algorithmic level: This course seriously to achieve a lot before I only know that pseudo-code algorithms, in fact, aware of the implementation level and ideological level, there are many differences. OO undoubtedly improved my ability.
  • Code level: I know the problems and the solutions should be encountered when collaborating team. I do not know the code was written for his own look - style code, the code specifications, the code in Figure communicate at all levels of the team is very important. Since then, both the details of the code, design methods and tools I have a modular design and communicate well with others.
  • Application level: A good code should be robust without error. I recognize the importance of testing, but also by students around the course and learned a lot of testing methods and points.

Five suggestions for improvement

  • School of Computer Science of the other classic series O (CO, OS) has a feature - step by step, scaled new heights. The difficulty and depth weekly jobs should be much higher than the previous week. As the same classic courses O OO, difficult to get enough lift somewhat abrupt end, whether the contents of some of the latter may be more difficult
  • The class test whether a more complete and systematic. Too open questions students answer mode sometimes make the wrong direction, there is no answer and feedback also allows students to not timely corrected thought.
  • Every job possible future expansion mode can remind students. Although generally a lot of students the ability to write scalable code is important, but a problem can be divergent directions. Do not tell students the next direction of the work may lead students to make a lot of follow-compatible design, but the direction of the course requirements but did not consider before, so although the students intend to write less code refactoring but instead over and over again rewriting.

Guess you like

Origin www.cnblogs.com/parachutes/p/11072306.html