1. Preface
A lot of knowledge about UML, the deep grasp of some software modeling ideas, need a certain accumulation of practice.
before summing up the study of the design pattern , it is necessary to understand the design of the class diagram so that it is easy to understand the static structure diagram of the design pattern.
2. Class Diagram overview
What is a class diagram?
It describes a diagram that shows a set of classes, interfaces, collaborations, and relationships between them.
What are the relationships between modeling elements?
They (such as classes and classes) are divided into four relationships: dependencies, associations with special aggregations and compounds (also called combinations), generalization (also called inheritance), implementation.
3. Dependency relationship
A dependency is a semantic relationship between two elements, and a change to an element (provider) can affect or provide a message to other elements (customers). That is, the customer relies on the provider in some way.
Dependency emphasizes that class changes cause other classes to change accordingly, not only because of the association between classes, but also because of the class's parameter changes (which are also classes) and the message passing mechanism between classes. As long as the class has changed to cause another class to change, it can be said that there is dependency.
such as the television class and the Channel Class code:
// TV class Public class Television { // Change Channel method Public void Chnagechannel (Channel c) {} }
// Channel class Public class Channel {}
two element dependencies, how is the class diagram designed?
4. Related relationships
"Design Pattern" Summary Series 01: Class Diagram