My Opera is closing 3rd of March

Hoang Ha's Blog

Hoang Ha lives in HCMC, Viet Nam

UML: Class diagrams

Một sơ đồ Lớp(Class diagram) mang tới một cái nhìn tổng quan về một hệ thống bằng cách biểu diễn các lớp và những mối quan hệ giữa chúng trong hệ thống đó. Sơ đồ lớp được mô tả ở dạng tĩnh -- chúng hiển thị sự tương tác giữa các lớp trong hệ thống, nhưng không hiển thị sự việc xảy ra trong hệ thống khi chúng tương tác với nhau.


Sơ đồ lớp(Class diagram) bên dưới xây dựng mô hình một khách hàng đặt hàng từ một danh mục hàng bán lẻ(retail catalog). Lớp trung tâm là Order. Được liên kết với nó là Customer cho việc mua sắm và thanh toán. Một sự thanh toán thuộc một trong 3 loại: Tiền mặt, Thẻ tín dụng hay Sec. Đặt hàng có chứa OrderDetails, mỗi item trong Order liên kết tới một OrderDetails.



Ký hiệu lớp trong UML là một hình chữ nhật được chia thành 3 phần: class name, attributes, và operations. Tên của các lớp trừu tượng, như Payment, được in nghiêng. Những mối quan hệ giữa các lớp là những liên kết kết nối.

Các Lớp trong hệ thống có 3 kiểu quan hệ:

  • Liên kết(association) -- a relationship between instances of the two classes. There is an association between two classes if an instance of one class must know about the other in order to perform its work. In a diagram, an association is a link connecting two classes.
  • Tập hợp(aggregation) -- an association in which one class belongs to a collection. An aggregation has a diamond end pointing to the part containing the whole. In our diagram, Order has a collection of OrderDetails.
  • Khái quát(generalization) -- an inheritance link indicating one class is a superclass of the other. A generalization has a triangle pointing to the superclass. Payment is a superclass of Cash, Check, and Credit.


An association has two ends. An end may have a role name to clarify the nature of the association. For example, an OrderDetail is a line item of each Order.

A navigability arrow on an association shows which direction the association can be traversed or queried. An OrderDetail can be queried about its Item, but not the other way around. The arrow also lets you know who "owns" the association's implementation; in this case, OrderDetail has an Item. Associations with no navigability arrows are bi-directional.

The multiplicity of an association end is the number of possible instances of the class associated with a single instance of the other end. Multiplicities are single numbers or ranges of numbers. In our example, there can be only one Customer for each Order, but a Customer can have any number of Orders.
This table gives the most common multiplicities.
      Multiplicities 	       Meaning
      0..1 	               zero or one instance. The notation n . . m indicates n to m instances.
      0..*  or  * 	       no limit on the number of instances (including none).
      1 	               exactly one instance
      1..* 	               at least one instance


Site Taking Too Long To Respond - Message from FirefoxMicrosoft Ra Mắt Phiên Bản ASP.NET 3.5 Extensions CTP Preview

Comments

Unregistered user Saturday, August 15, 2009 2:49:49 PM

khắc triều writes: mình đang cần hiểu thêm về mô hình này và activity diagram, bạn có tài liệu về hai cái này thì có thể mail qua cho mình được không? email : khactrieu_a3@yahoo.com dđ : 0949159590 thanks bạn nhiều nha!!!!!!!

Unregistered user Saturday, August 15, 2009 2:53:31 PM

khactrieu writes: mình đăng tìm hiểu về mô hình này và cái activity diagram, nếu bạn có tài liệu vè hai cái này thì cho mình xin nha!!! nếu có bạn gửi mail cho mình nha, cảm ơn bạn nhiểu email : khactrieu_a3@yahoo.com đt : 0949159590

Unregistered user Friday, April 2, 2010 11:58:29 AM

Fri3ng3R writes: Bài viết hay. Cần cho người dang hoc và tim hiểu UML. Cảm ơn.

Unregistered user Monday, July 19, 2010 11:32:16 AM

Anonymous writes: thank you ver much , it is useful

Write a comment

New comments have been disabled for this post.

February 2014
M T W T F S S
January 2014March 2014
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28