Full Software Modeling 3

Source: Internet
Author: User

3Design Model

3.1Ing analysis class to design class

A design class refers to a design class. The process of ing an analysis class to a design class is actually to refine the attributes and methods of the analysis class so that the class can implement object-oriented programming. The attributes and responsibilities of the analysis class can be expressed at will without emphasizing specifications. In the design class, you must followUML. The ing process from the analysis class to the design class does not necessarily mean that an attribute of the analysis class corresponds to an attribute of the design class, and a responsibility of the analysis class corresponds to a method of the design class.Class attributes and methods should followUML.

Class property format:

[Visibility] attribute name [: type] ['['Multiple [order]'] [= initial value] [{feature }〕

Class operation format:

[Visibility] operation name [(parameter list)] [: return type] [{feature }〕

Figure9Is an analysis classProjectThe ing design class.


Figure9DesignProject

3.2Organize Design

In the final class diagram, not all classes are mapped by the analysis class, and most of the classes in the system are mapped by the analysis class. After the ing is completed, you also need to optimize the existing classes according to the design principles. The main object-oriented design principles are: openness-Closed principle (OCP),LiskovReplacement principle (LSP), Dependency inversion principle (Dip), Interface separation principle (ISP.

1.Open-Closed principle (OCP)

Open-The closure principle is described as "open for expansion and closed for changes ". The extension is open, which means that the behavior of the module can be expanded. When the application needs to change, the module can be expanded to meet the new changes. That is to say, we can change the function of the module. "Change is closed" does not need to be changed when the module behavior is extended.Source codeOr binaryCode.

2. liskovReplacement principle (LSP)

For each typeSObjectO1, All have a typeTObjectO2So that allTCompiledProgramPMedium, useO1ReplaceO2After, the programPIf the behavior function remains unchangedSYesTChild type.

3.Dependency inversion principle (Dip)

High-level modules should not depend on low-level modules. Both of them should depend on abstraction. Abstraction should not depend on details. Details should depend on abstraction.

4.Interface isolation principle (ISP)

Do not force customers to rely on methods they do not need.

Following the above principles can make our software more flexible and robust. But flexibility requires a price. The performance loss caused by polymorphism is the most obvious problem. Therefore, we need to make a balance between flexibility and performance.

According to some object-oriented design principles, sorting out the current classes is the most basic form. Some technologies that have followed the object-oriented design principles are often used in the design, such as the design pattern. The design model is a clever, excellent, and general object-oriented system solution that has been well proved. When we apply design patterns in design, we will introduce new classes to our design for design considerations.

Using design patterns has the following benefits: first, using design patterns can more accurately describe the problems and their solutions; second, using design patterns can be consistent, that is, if we have a standard solution for some known problems, we can adopt consistent methods when encountering the same problem, which makes the code easier to understand. Again, when a problem occurs, you do not need to start from the underlying layer every time. Instead, you can start with a standard solution and adapt it to the needs of special problems. This saves time and improves the quality and efficiency of development.

We organized the design classes according to the system architecture. In the presentation layer, the main types are form classes. Their basic classes areTform, There are too many form classes, so they are not listed one by one. They only list the base classes of several custom presentation layers,10.


Figure10Classes in the presentation layer



Figure11Entity classes in the business logic layer

 

Figure12Border class diagram in the business logic layer

 

3.3Update case implementation

After completing the class design, you need to update the use case implementation in the analysis phase according to the class design. The main task is to update the interaction diagram and use the class method to update the content in the interaction diagram. Figure13 ~Figure15The sequence diagram in case implementation of "select construction project" is updated after the class design is complete.


Figure13"Select Construction Project"Sequence diagram of basic streams

 

Figure14"Select Construction Project"Optional streams1Sequence Diagram

 

Figure15"Select Construction Project"Optional streams2Sequence Diagram

3.4Class details design

In the above steps of class design, the attributes and methods of the class are designed. In some cases, you can design at this level. Developers design the implementation of methods in the class during programming. My personal opinion is that if conditions permit the design of important methods of the class as much as possible during the design phase.The following describes the detailed design in the class diagram with a specific class. In this software, there is a class calledTevaluateIts Class Diagram16As shown in


Figure16 TevaluateClass Diagram

The detailed design can guide developers in development. In addition, if the outline design and detailed design are completed in one go, there will be fewer problems in the design. Detailed design can be implemented using natural languages, flowcharts, pseudocode, and other methods.17Use pseudo-code pairsTevaluateOfMethodPartevaluateDetailed design.


Figure17 Detailed Design of Classes


Figure 18 partevaluateActivity diagram

You can use the activity diagram to describe the implementation of some complex classes in the class diagram.18As shown in, it describes the classTevaluateMethod inPartevaluateAccording to the detailed design of the class and the activity diagram, it is easy to understand the intent of the designer, and developers will soon be able to implement it.

To be continued ......

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.