UML essence-A Concise tutorial on Standard Object Modeling Language

Source: Internet
Author: User

Today I borrowed a concise tutorial on the Standard Object Modeling Language (UML Distilled: a brief guide to the standard Object Modeling Language ). Translated by Mr. Xu Jiafu. In general, I feel that a good book is ruined. Those in the beginning of this article are not in the same order. For example, "If someone accidentally falls into my trap and the Controller object ends, I need to shut the rabbit in the cage, wipe the floor, and restart the system ." (I checked the original article, if someone shocould be so careless as to fall for my trap, the Controller object terminates, So I wowould need to put the rabbit in its cage, mop the floor, and reboot the system .), it makes the funny metaphor in the original work difficult and tasteless. "It is legal to enable the limitation of mandatory attributes or show examples of abstract classes. (It's legal to leave mandatory attributes empty or to show instance specifications of abstract classes.) "I have to check the original document to understand.
Even so, the book (I mean the original ). There are still a lot of good content. So I did some chapter-seeking work. The original English document is attached. I am not familiar with the keyboard, so I have to handle the mistake. Thank you!
Generalization ):
A typical example of generalization is the personal and corporate customers involved in the business. Individual customers and Company customers have both different and many similarities. You can put the similarities into a general customer class (super type), which uses the Personal Customer class and its corporate customer class as its subtypes. For software, the obvious explanation is "inheritance": The company customer class is a subclass of the customer class.
Aggregation and composition ):
Aggregation is an integral-partial link. Just as, a car uses an engine and a wheel as its two parts. It sounds good, but the difficulty is what is the difference between aggregation and association. UML includes aggregation, but has almost no semantics. (Aggregation is the part-of relationship. it's like saying that a car has an engine and wheels as its parts. this sounds good, but the difficult thing is considering what the difference is between aggregation and association. the UML converged ded aggregation but with hardly any semantics .)

In addition to aggregation, UML has another defined combination feature. An instance of a vertex can be either a polygon or a circle center, but not both. In general, although a class can be composed of multiple other classes, any instance must be composed of only one owner. A class diagram shows multiple classes that may have owners. However, each instance can have only one object as its owner. (As well as aggregation, the UML has the more defined proerty of composition. an instance of point may be part of a polygon or may be the center of a circle, but it cannot be both. the class dimo-may show multiple classes of potential owners, but any instance has only a single object as its owner .)
Combination is a good way to show the characteristics of values, the characteristics of value objects, or other characteristics that are strong for other specific components and slightly arrange their possession. Aggregation is meaningless. (Composition is a good way of showing properties that own by value, properties to value objects, or properties that have a strong and somewhat exclusive ownership of particle object other components. Aggregation is strictly meaningless .)
Classification and Generalization)
I often hear people refer to subtypes as "is a" relationship. I urge you to watch out for this way of thinking. The problem is that the phrase "yes" has different meanings.
Evaluate the knowledge of the following phrases:
1. Shep is a sheepdog.
2. The sheepdog is a dog.
3. Dogs are an animal.
4. The sheepdog is a breed )..
5. Dogs are species ).
Now I try to combine these phrases. For example, if you combine phrases 1 and 2, you have to "Shep is a dog"; if you combine them with 2, 3, you have to "the sheepdog is an animal "; "Shep is an animal" in combination of 1, 2, and 3 ". So far, they are all good. Now try 1 and 4, and "Shep is a genus ". The combination of 2 and 5 gets "the sheepdog is a kind", which is not very good. (Now try combining the phrases. if I combine phrases 1 and 2, I get "Shep is a dog"; 2 and 3 taken together yield "Border collies are animals. "And 1 plus 2 plus 3 gives me" Shep is an animal. "So far, so good. now try 1 and 4: "Shep is a breed. "The combination of 2 and 5 is" a border collie is a species. "These are not so good .)
Why can I combine some phrases instead of other phrases? The reason is that some areCategory(Classification) (the object Shep is an instance of the sheepdog type), some areGeneralization(Generalization) (the dog type is a child type of the dog type ). Generalization is passed, but classification is not. I can combine the generalized categories, but not vice versa. (Why can I combine some of these phrases and not others? The reason is that some are classification-the object Shep is an instance of the type Border Collie-and some are generalization-the type border collie is a subtype of the type dog. generalization is transitive; classification is not. I can combine a classification followed by a generalization but not vice versa .)
I propose that you be cautious with "is. Improper use of subcategories and confusion of duties. In this case, a better test of the Child type is the following phrase: "dogs are animal species" and "each instance of the sheepdog is an instance of a dog ". (I make this point to get you to be wary of is. using it can lead to inappropriate use of subclassing and confused responsibilities. better tests for subtyping in this case wocould be the phrases "dogs are kinds of animals" and "every instance of a border collie is an instance of a dog. ")
Attachment: the original English version can be downloaded from fixdown. Http://fixdown.com/soft/14631.asp

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.