Professional Documents
Culture Documents
Compiled By :Umm-e-Laila
Lecture 5
Course Instructors
Umm-e-Laila ulaila2002@gmail.com
Assistant Professor, CED
Room Number: BS-04
Tel: 111-994-994, Ext. 536
http://sites.google.com/site/ulaila206
3
Class Diagrams
Person
- firstName : String
- lastName :String
- address : String
- tel : int
+ setPerson(String, String, String, int)
+ setName(String, String)
+ setAddress(String)
+ setTel(long)
+ getFirstName( ) : String
+ getLastName( ) : String
+ getAddress( ) : String
+ getTel( ) : int
+ toString( ) : String
Responsibilities
• A responsibility is a contract or an obligation of a class. When you create a class, you are
making a statement that all objects of that class have the same kind of state and the same kind
of behavior. At a more abstract level, these corresponding attributes and operations are just the
features by which the class's responsibilities are carried out.
The Class Icon (2)
Class Name
attribute : type
• Implementor Operations
implements some business functionality. They
can be found by examining Interaction diagram.
• Manager Operations
manage the creation and destruction of objects.
• Access Operations
set and get operation in a class to access
private attributes.
• Helper Operations
help other operation of the class, but cant be
access directly. Private operation of a class.
• Setting Operation Visibility
Public, Private, Protected, Package or Friendly
+ , - , # , no sign for package
<<interface>>
Interface Name
method( param1, param2, …, paramn) : type
Example:
<<interface>>
ActionListener
+ actionPerformed( ActionEvent) : void
The Interface Icon (2)
Entity Classes
These classes saves the information in persistent storage.
You can create tables in your database for each entity class.
Control Classes
• Persistent
The information in objects of the class will be saved to
a database or some other form of persistent storage.
• Transient
The information in objects will not be saved to
persistent storage
• Multiplicity
is an indication of how many objects may participate in
a given relationship.
Class Relationships
Vehicle
public class Car
extends Vehicle {
… }
public class Truck Car Truck Bike
extends Vehicle {
… }
public class Bike
extends Vehicle {
… }
Inheritance Diagrams (2)
• Parts may be created after the whole, but once created they live
and die with the whole.
Whole Window
1 It is represented by a
Filled diamond.
*
Frame Part
Composition Diagrams (1)
Whole Company
1
*
Department Part
Aggregation Diagrams (1)
15
myClass Button
myButtons
Aggregation Diagrams (2)
• Name
An association can have a name. That describe the nature
of the relationship.
•Role
A role is just the face the class at the near end of the
association present to the class at the other end of the association.
•Multiplicity
It represent that how many objects of one class may
connect to the objects of another class.
• Navigation
It represent the direction of association from one object to
another object. Unless specified the navigation is
bi-directional. You can limit the navigation to just one direction.
Works for
Person Company
Name
Role name
employee *
Person Company
1..* employer
Person Parent
2
Child *
Association Diagrams Stereotypes
Window
Event
class Company
1 aggregation
attributes
* 1..* multiplicity 1..*
Department Office
Location address
name
0..1 * * phone
role generalization
member
1..* 1 manager Headquarters
ContractInformation
Person
address
name
employeeID
title
PersonnelRecord
getName
getID operations taxID
getContractInformation emplomentHistory
getPersonnelRecords salary
dependency
role:chairperson
School Department
0..1
-name -name
-address
-phone
Has +addIntructor()
+addStudent() 1..* +removeInstructor()
1 1..*
+removeStudent() +getInstructor()
+getStudent() +getAllInstructor()
+getAllStudent()
+addDepartment()
+getDepartment() AssignedTo
+getAllDepartment()
1..* 0..1
1..*
1..*
Course Instructor
Member
name name
* Teaches
courseID
* 1..*
Student Attends *
*
name
studentID