Class Diagram

What is a class diagram

  • Static diagram
  • Shows what classes of objects are required (NO interaction, NO implementation)
  • Document 2 types of data
    1. Processing requirement -- how we process things
    2. Data storage requirement -- what data are we going to store
  • Objects must be identifiable -- Object reference: one unique attribute for each object (e.g. SSN)

Class Symbol

Relationship

  • Association: same as the Things association.

        

  • Generalization/specialization: "is-a" relationship
    • Enables inheritance of attributes and methods
  • Aggregation: "has-a" relationship

Association Class

A class attached to an association

Data belongs to the association (but not to either of the classes involved)

Represented by a dotted line

Generalization/Specialization (Inheritance)  

  • GeneralizationGroups similar types of classes that share characteristics such as attributes, associations, or methods
    • Superclass​ can act as abstract class -- does not have any corresponding objects
    • Concrete class inherit superclass characteristics --  can have real objects. ​​​​​​
  • Generalization encourages reuse
  • Specialization: subclass existing classes, inherit parent characteristics

  1. Savings Account has 4 attributes and 3 methods (including those from the super class)
  2. Checking Account has 5 attributes and 2 methods (including those from the super class)

Multiple Inheritance

A class that inherit from more than 1 superclass

Total attribute comes from both superclasses.

Aggregation (Whole/part)

  • Represented by a diamond symbol
  • Definition: whole-part relationship between the aggregate (whole) and its components (parts), where the parts can exist separately

** processor, monitors, etc. are all parts of a computer

*** NOTE: all computer parts can exist without being a part of a computer

Composition

  • Represented by a solid diamond symbol
  • Definition: aggregation relationship but the parts CANNOT exist separately

** Here BoatHull is part of a BoatAssembly but it cannot exist on its own. 

Methods

  • Standard methods: 
    • Create (a new object of this class)
    • Delete (a existing object of this class)
    • Get (attributes of the object)
    • Set (attributes of the object)
  • Custom methods:
    • e.g. students -- pay tuition

Question

  1. Practice Exam Q46 -- What is the term that describes the number of times that an object can participate in a relationship? -- ______
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值