"Design Pattern" Summary Series 01: Class Diagram

Source: Internet
Author: User

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

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.