Class diagram provides an overview of the target system by describing objects and the classes in side system and the relationships among them. It provides the variety of usages and the detailed design of the target system. Following aspect should consider when drawing a class diagram.
- Every class should have a meaningful name.
- Each elements and its attributes should be identified.
- For each class a minimum number of properties should be identified otherwise the the diagram would be a mess.
- Notes can be used when needed.
- Responsibility of each class should be clear.
- The relationship among each class should be identified clearly.
Now let's look at a simple payment scenario to design the class diagram.
Generally customer makes an order and then pay it.
2. Identify the relationship among each class.
Customer and Order
Generally customer makes an order and then pay it.
- Now you can identify what are the different classes here. They are
- Customer (Super class)
- Order (Super class/ Sub class)
- Payment (Sub class)
2. Identify the relationship among each class.
Customer and Order
- 1 Customer place many orders (One to many relationship).
- Many customers can't place 1 order
Customer and payment
- 1 Customer pay many payments (One to many).
- Many customers can't pay 1 payment.
No comments:
Post a Comment