UML Basic Architecture Modeling-general class modeling technology (2)

Source: Internet
Author: User
Zookeeper

Modeling the distribution of responsibilities in a system

Model System Responsibility Assignment

 

Once you start modeling more than just a handful of classes, you will want to be sure that your actions provide a balanced set of responsibilities. what this means is that you don't want any one class to be too big or too small. each class shoshould do one thing well. if you abstract classes that are too big, you'll find that your models are hard to change and are not very reusable. if you abstract classes that are too small, you'll end up with more privileges actions than you can reasonably manage or understand. you can use the UML to help you visualize and specify this balance of responsibilities.

Once modeling starts, you should not only consider those classes, but also ensure that your abstract things provide a balance of responsibility set. this means that you do not want any class to be too large or too small. each class should do one thing well. if your abstract class is too large, you will find that your model is difficult to change and cannot be reused. if your abstract class is too small, you will have more abstract things, which will make it difficult for you to reasonably manage or understand. you can use UML to help you visualize and describe the balance between these responsibilities.

 

To model the distribution of responsibilities in a system,

Modeling responsibility allocation in the system,

 

1. Identify a set of classes that work together closely to carry out some behavior

Identifies a group of closely-Cooperating classes for executing certain behaviors

2. identify a set of responsibilities for each of these classes.

Identifies a group of responsibilities for each of these classes

3. look at this set of classes as a whole, split classes that have too has responsibilities into smaller has actions, collapse tiny classes that have trivial responsibilities into larger ones, and reallocate responsibilities so that each has action reasonably stands on its own.

Divide classes with too many responsibilities into smaller abstract things, reduce tiny classes, add less important responsibilities to larger classes, and reassign responsibilities, so that each abstract has clear independence.

4. Consider the ways in which those classes collaborate with one another and redistribute their responsibilities accordingly so that no class within a collaboration does too much or too little.

Consider how to allow those classes to interact with other classes and re-assign their responsibilities so that there are not too many or too few classes in collaboration.

 

For example, figure 4-10 shows a set of classes drawn from smalltalk, showing the distribution of responsibilities among model, view, and controller classes. notice how all these classes work together such that no one class does too much or too little.

For example, a group of classes from Smalltalk are displayed on the 4-10 page. Responsibilities are allocated between the model, view, and controller classes. note how all these classes work together. None of these classes have too many or too few responsibilities.

 

UML Basic Architecture Modeling-general class modeling technology (2)

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.