You are on page 1of 13

Class diagram inSoftware

Engineering
Group Members
Waleed Nasir
Waleed Asif Harry
Hasham Saleem
What is classDiagram
1. Describes a set of objects having similar:
-Attributes (status)
-Operations (behavior)
-Relationships with other classes

2. In Object oriented development approach we make classes


and those classes have link with each other they collectively
made a complete system.

3. Graphical representation of the classes and their association


between them is knows asclass diagram.
Some things to knowabout…
1. First of all we should know thatfrom where we get a class?
1. We get the class from the real world objects
2. Objects are anything from the real world which we are going to
map here.

2. We can represent the class diagram at 2 levels.

3. Here we will study about detail level and at the end tell you
about the abstract level.
Some notations andsymbols
1. To represent a class diagram we have some notations and
symbols.

2. We represent class with the box and the box is divided into
three parts.
1. Part 1: represent the name of class
2. Part 2: represent the attributes of the class (data type optional)
3. Part 3: represents the operations of theclass.

3. A link between two classes is known as association. (we


represent the link with line)
Associations
• Associations can be of following types
• One to One1:1
• One to many 1: * (* is readmany)
• Many to One*:1
• Many to Zero or One * : 0..1

• Example: “An Employee works for a Company”


• Lets have some practical look now
This is aclass…
Patient

-P_ID : int
+P_Name : string
+P_diseases : string
+Appointment : date

-RegisterPatient()
-DischargePatient()

Note: The – and + symbol represent the attribute or operation are


private and public.
- = private
+ = public
Association inclasses
Patient Patient Record

-P_ID : int -R_ID : int


+P_Name : string +diseses_Name :
+P_diseases : string 1 1 string
+Appointment : date +Test_Status: string

-Register_Patient() -Update_record()
-DischargePatient() -delete_record()
Associations
Multiplicity
– the number of objects that participate in the association.
– Indicates whether or not an association is mandatory.

Teacher Assignments
Aggregation
• A special form of association that models a
whole-part relationship between an
aggregate (the whole) and its parts.
– Models a “is a part-part of” relationship
Composition
• Composite aggregation is a strong form of aggregation
that requires a part object be included in at most one
composite object at a time. If a composite object is
deleted, all of its part instances that are objects are
deleted with it.
Shared Aggregation
• It implies a relationship where the child can exist
independently of the parent. Example: Class (parent)
and Student (child). Delete the Class and the Students
still exist.

Class Student
Generalization
• Indicates that objects of the specialized
class (subclass) are substitutable for objects
of the generalized class (super-class).
– “is kind of” relationship
• A sub-class inherits from its super-class
– Attributes
– Operations
– Relationships
Thank You

You might also like