You are on page 1of 5

Agenda

Recap:


Phases of software design and Unified Process


UML and Classes, Objects and 

Object Oriented Design and Techniques


UML Notations for Modeling Classes
Relationships [ 1]
Class Relationships and UML Notations
Defining Domain Models Using 

Association
Class Diagrams 

Generalization


Realization


Dependency

1 2

Software Development Process and


Object Oriented Design (OOD)
Unified Modeling Language (UML)


A software development process is a set of phases that are 

OOD is the technique used to architect software with


followed to bring a product or a system from conception to groups of classes that interact with one another to
delivery.
solve a problem.


In the Unified Process, there are four of these phases:




Inception ( Analysis phase)




To qualify as an OOD, a few requirements need to be




identify the system we are going to develop, including what it contains and met.
its business case.


UML: use-case diagrams




The three fundamental principles are essential for an




Elaboration ( Design phase): OOD to exist:




perform detailed design and identify the foundation of system from “use


Classes (abstraction and encapsulation)


case diagram”, which eventually lead to classes. 

Inheritance


UML: classes, objects, class diagrams, sequence diagram, collaboration


diagrams etc.


Polymorphism


Construction ( Implementation phase): write software using Java/ C+ + 

+ OO notions: packages, exceptions, streams, threads,




the actual building of the product from the design of the system. components and events (asynchronous notifications),


Transition ( Rolling out phase): Deliver the system/ product to the and communicators (sockets).
users. Includes maintenance, upgrades, and so on until phasing out.

3 4

Modeling a class in UML Classes (with no members)

When modeling a class in UML, we have a lot of


flexibility.
The same class can be modeled in four ClassName
different ways:


With no attributes or operations shown




With only the attributes shown




With only the operations shown




With both the attributes and operations shown


The name of the class is always the first
component of the class box; in fact, it is the Circle
only required component, as we have seen in
our earlier discussion (OOP in Java).
5 6
Classes (with attributes and
Notes
operations)
ClassName


Class - The rectangle is the icon for the class. The ClassName
attr1:type1
name of the class is, by convention, a word with an attr1:type1 attr2:type2= “def ”
initial uppercase letter. It appears near the top of the attr2:type2= “def ”
rectangle. If your class name has more than one word operation1()
name, then join the words together and capitalize the operation2(args)
first letter of the every word. operation3() : ret type

Circle
Circle centreX:Int
centreX:Int centreY:Int= 0
centreY:Int= 0 draw()
move(Int X, Int Y)
7 8

Notes Class Visibility




Attribute - An attribute is a property of a class. It describes a


range of values that the property may hold in objects of the class.


public level +
A class may have zero or more attributes. A one-word attribute
name is written in lowercase letter. If the name consists of more
than one word, the words are joined and each word other than the


protected level #
first word begins with an uppercase letter. The list of attribute
names begins below a line separating them from the class name.


private level -
Circle


Operations : An operation is something that a class can do, or


that you (or another class) can do to a class. Like an attribute - centreX:Int
name, an operation’s name is written in lowercase letter. I f the - centreY:Int= 0
name consists of more than one word, the words are joined and
each word except the first word begins with an uppercase letter. + draw()
The list of operations begins below a line separating operations
from the attributes. # move(Int X, Int Y)

9 10

Notes Class Multiplicity




Visibility - Visibility applies to attributes or operations, A multiplicity in a class specifies the number of
and specifies the extent to which other classes can use instances (objects) of that class that can exist
a given class’s attributes or operations. Three levels of simultaneously.
visibility are possible (last symbols are used in UML
classes to indicate different levels of visibility): 1


public level - usability extends to other classes + Library




protected level - usability is open only to classes that


inherit from original class # Only one Library object is allowed in the system


private level - only the original class can use the (referred to as a singleton object).
attribute or operation - Default multiplicity is 0 or more (if not
specified)

11 12
Class - Implementation Objects: Instances of Classes

public class Circle {


d1: Department : Department
private int centreX, centreY; // centre of the circle
(a) (b)
//Methods to return circumference and area
protected double move() {
// Implementation here d1: Department : Department
}
public double draw() { name = “Sales” name = “Sales”
// Implementation here deptNo = 1 deptNo = 1
}
} (c) (d)
13 14

Notes Classes, Objects, and Packages




Figures (a)-(d) show four possible




Packages are a way of grouping classes into common


categories.
representations of objects. 

Classes and Objects are modeled when showing the


Top – package they belong to. Classes and objects will


interact with classes and objects of different


objectName:ClassName – underlined or packages—this is how packages are tied together to




:ClassName – underlined create a system.


Bottom –


A package is expressed by appending the name of


package and a double colon before the class name in


Attribute names and values. either a class or an object.


PackageName::ClassName

ObjectName:Packagename::ClassName
15 16

Class Relationships Association




Classes can related to each other through 

Association describes a link, a link being


different relationships: a connection among objects between

Association (delegation) classes.


Generalization (inheritance)

Realization (interfaces) 

Association is shown by a solid line


Dependency between classes.

17 18
Association - Example Association - Properties

Name


A Person works for a Company.

Name of the association


Role

The specific role of the association


Role
Multiplicity

Indicates the number of objects that are connected


employee employer
Person Company Type

Plain association, aggregation, composition


works for
Direction
Association Name

Direction can also be shown for a association

19 20

Notes Association - Multiplicity

Name : “works for” Is the name of the relationship. Multiplicity on association specify properties of
the number of links that can exist between
Role : Person plays the role employee and the Company instances (objects) of the associated classes.
plays the role employer.

That is, it indicates how many objects of one class


relate to one object of another class. It is indicated
by a single number or a range of numbers.
Multiplicity : Many employees to one company.
We can add multiplicity on either end of class
relationship by simply indicating it next to the
Type : This shows a plain association (normally referred class where the relationship enters.
to as association)
Association name
Class1 Class2
multiplicity multiplicity
21 22

Association - Multiplicity Association


Association-–Multiplicity
Multiplicity


A Student can take up to five Courses. 

A teacher teaches 1 to 3 courses (subjects)




Student has to be enrolled in at least one course. 

Each course is taught by only one teacher.




Up to 300 students can enroll in a course. 

A student can take between 1 to 5 courses.




A class should have at least 10 students. 

A course can have 10 to 300 students.

1 teaches 1..3
Teacher Course
Student Course
10..300 takes 1..5 1..5

takes
Students
10..300

23 24
Association
Association--Multiplicity
Multiplicity Association
Association--Multiplicity
Implementation
class Company{
Vector employee;


Company can have many employees. An employee can public Company(){


only work for one company. employee = new Vector();
}
employee employer
Person Company public static void addEmployee(Employee emp){
* works for 1 employee.addElement(emp);
}
public static void removeEmployee(Employee emp){
John: Person Microsoft: Company empoyee.removeElement(emp);
}
}
class Employee{
………
}
James: Person
25 26

Summary

Recap:

Phases of software design and Unified Process


Object Oriented Design and Techniques


UML Notations for Modeling Classes
Class Relationships and UML Notations

Association

Generalization

Realization

Dependency

27

You might also like