Object-oriented programs overall summary

The fourth unit operations summary

Object-oriented architecture of the unit operations summary

The fourth major operation launched around UML diagrams, UML (Unified Modeling Language, the Unified Modeling Language) is a modeling and reduction of language that can help us interact between class diagrams and class of object-oriented programming and classes the state change modeling. The main content of this work is the analytical tool uses UML group courses offered, some queries to complete work on the UML diagram.

The first architecture job

The first job is to complete the main content of the query to the relevant content UML class diagram, complete query capabilities are:

How many Class 1. Class diagram in a total of

2. a class in how many operations

3. The class attribute of how many

4. How many classes associated

5. The end of the associated class which is a class of

6. visibility operation class

7. visibility attribute class

8. The top parent class

9. The class implements all the interfaces

10. The class is contrary to the principle of information hiding

For the relationship to be considered a parent class.

By understanding the demand, we can see that, for the first time access to process operations involved are:

1. Class -> class attributes

Class 2 -> operation of the class

3. Operation -> operation parameters

4. The class interface, -> class association, the peer interface

Class 5 -> parent class

9 kinds of queries of this work is the order of these different kinds of access integrated process. For example, for the query association can first find the class and the class of the parent class, constitute the set A, and then the association class A set of queries in the end. Based on this understanding, I will visit abstracted into a class Mapper process, and then instantiate the five objects, you can query the working process of this visit we were then in charge of a class to complete all work on the basis Mapper query on top.

The second architecture jobs

The second work required to complete several tasks on the basis of the first on the job:

1. Complete class inheritance relationships and attributes named in FIG inspection (UML002, UML008, UML009)

2. you can query sequence diagram

3. Complete the inquiry on the state map.

 The more difficult part of the algorithm is to check for inheritance, requiring classes, interfaces and inheritance can not appear cycle repeated inheritance. Check the algorithm is: starting from the class S of each occurrence in the hierarchy, the use of BFS on the entire inheritance graph traversal, while preserving the preamble in the traversal process, if we find S encountered during traversal, then in this occurred during the traversal ring. For repeated inheritance is the same, only to discover in the course of BFS traversal through a class twice it means there has been repeated inheritance.

For architectural design, checking on class diagrams, using inheritance last job Mapper, in which the increase inspection of inheritance relationships. For checks the status map and sequence diagrams, if in the same class have become too cumbersome. Therefore, the query into a query class diagrams, state diagrams query, the query sequence diagram complete three classes, a class to complete the entire query with the call to these three classes of objects.

OO curriculum for the evolution of object-oriented thinking

The object-oriented curriculum, the impact of an object-oriented thinking of my biggest job is the first time on complex polynomial seeking to achieve lead to problems, and a second to realize about multithreading elevator.

Before learning courses for who studied C ++, object-oriented so the term is not new, but did not practice related to the object-oriented thinking in practical applications. For object-oriented understanding just stay in form, it does not demand the functional division of object-oriented point of view in the process of writing code, but thinking about the completion of this requirement, need to complete several stages, and these stages Object oriented forms of encapsulation.

  第一单元的作业完成让我对面向对象的思维有了更加深刻的理解。主要原因是因为在这个单元中,三次作业我重构了三次,随着这三次重构,我对面向对象的思想的理解演进了很多。第一次作业是一个完全的面向过程的程序。第二次作业徒有面向对象包装的面向过程程序,而第三次作业则是完全根据面向对象的思想进行面向对象设计的一次代码实现。面向对象的思维是将程序看成是几个部分的协作过程,每个部分是独立的,即一个类,其内部变量要设置成private实质上的目的是为了让类的功能更加的内聚减少外部耦合。同时在这个基础之上,类和类之间存在逻辑的相似性,如果是子集关系,可以采用继承的方式实现,如果是并集关系,可以采用多个类实现某个接口的方式来组合类和类之间的关系。尤其是对于最后一次作业的实现,让我很深刻理解了架构的重要作用。通过自顶向下的将数据进行分解处理,再利用接口对具有相同操作的类进行整合,使得这个编码问题变得更加有条理,在处理的时候也觉得更加方便。

 

第二次作业是多线程的作业内容,这部分主要的难点在于两个一个是对于多线程之间协作的规则的确定,保证同步性。这次作业的主要的多线程模型是生产者-消费者模型。在这次作业的完成过程中,以及上课的内容我了解到了很多关于面向对象的程序的很多常见的架构, 

第二个部分就是对程序的整体结构的设计。这里让我觉得比较关键的几点是:

1.要在开始编写代码的时候规定好方法的输入输出接口,保证一个方法的输入/输出在边界位置是良好规定的,会为之后的代码处理节省很多时间。

2.一定要在编写代码之前对程序进行比较详细的设计 ,不应该在代码编写的时候一时的方便任意改变最开始的设计,这样会导致在类间协作的过程中在边界值位置出现很多问题。

 

 

Guess you like

Origin www.cnblogs.com/chenjinyu/p/11061261.html