Must know something of everything and everything of something!

Class Diagrams

上一篇 / 下一篇  2007-03-30 15:25:19 / 个人分类:Testing

Class Diagrams51Testing软件测试网)Fyr?rs/Hz

2oZ6f+FM}0Class diagrams are widely used to describe the types of objects in a system and their relationships.  Class diagrams model class structure and contents using design elements such as classes, packages and objects.2 Class diagrams describe three different perspectives when designing a system, conceptual, specification, and implementation.1   These perspectives become evident as the diagram is created and help solidify the design.  This example is only meant as an introduction to the UML and class diagrams.  If you would like to learn more see theResourcespage for more detailed resources on UML.51Testing软件测试网a!r)C9yl*k

51Testing软件测试网(`z f0abM

Classes are composed of three things: a name, attributes, and operations.  Below is an example of a class.

Q&PA T)AJ*ir)ZZqF#_0

n9F.S||IW%l qva0

0o+RB,G:s;C-['fw051Testing软件测试网_)y)D,l Yf

Class diagrams also display relationships such as containment, inheritance, associations and others.2 Below is an example of an associative relationship:

drQA {yf&L0

?^+~'g,\W[ dd?&r0 

F c/j:i9L!M j!Q e9]Nu7N051Testing软件测试网4G^&^sI

The association relationship is the most common relationship in a class diagram.  The association shows the relationship between instances of classes.  For example, the class Order is associated with the class Customer.  The multiplicity of the association denotes the number of objects that can participate in then relationship.1For example, an Order object can be associated to only one customer, but a customer can be associated to many orders. 51Testing软件测试网:Y Q'p G^n@nu7t

wFn'[#m*ncy*j(a0Another common relationship in class diagrams is a generalization.  A generalization is used when two classes are similar, but have some differences.  Look at the generalization below:51Testing软件测试网F5I-Z4x-p@wy{V8P

51Testing软件测试网]0Z_"vCQn

*A1}J:j Kr9ba6s0
51Testing软件测试网R~ F/y4W*@

In this example the classes Corporate Customer and Personal Customer have some similarities such as name and address, but each class has some of its own attributes and operations.  The class Customer is a general form of both the Corporate Customer and Personal Customer classes.1  This allows the designers to just use the Customer class for modules and do not require in-depth representation of each type of customer. 51Testing软件测试网h#Tv'aT

When to Use: Class Diagrams

51Testing软件测试网q{*U'Y|W K+h+]A

Class diagrams are used in nearly all Object Oriented software designs. Use them to describe the Classes of the system and their relationships to each other.

PX k bUt"h \0

How to Draw: Class Diagrams

51Testing软件测试网6J&^E6B[!f E J!L

Class diagrams are some of the most difficult UML diagrams to draw.  To draw detailed and useful diagrams a person would have to study UML and Object Oriented principles for a long time.  Therefore, this page will give a very high level overview of the process.  To find list of where to find more information see theResourcespage. 51Testing软件测试网'^ q1d q e/\:[

8f\-S&uJH0Before drawing a class diagram consider the three different perspectives of the system the diagram will present; conceptual, specification, and implementation.  Try not to focus on one perspective and try see how they all work together. 51Testing软件测试网Ac4Z kf@

,A9Efe Ro g0O5Z0When designing classes consider what attributes and operations it will have.  Then try to determine how instances of the classes will interact with each other. These are the very first steps of many in developing a class diagram.  However, using just these basic techniques one can develop a complete view of the software system.51Testing软件测试网4u mi)NQ"T*d!R

51Testing软件测试网 a5`,U pC p&|![e

a gx"C;JMuzY0

%o$j qQ%w?RU0This example is only meant as an introduction to the UML and use cases.  If you would like to learn more see theResourcespage for more detailed resources on UML.51Testing软件测试网#t6JYhB(i)gZ


相关阅读:

TAG: UML

 

评分:0

我来说两句

日历

« 2024-04-15  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 76717
  • 日志数: 93
  • 建立时间: 2007-03-22
  • 更新时间: 2007-12-31

RSS订阅

Open Toolbar