Lecture 5 OOAD
Lecture 5 OOAD
Lecture 5 OOAD
Five
OOA and
OOD
Object oriented analysis(OOA)
Identifying objects.
The common models used in OOA are use cases and object
models.
Object oriented design(OOD)
OOD: involves implementation of conceptual model produced
during object oriented analysis(OOA).
Is a method of design encompassing the process of object oriented
decomposition and a notation for depicting both logical and
physical as well as static and dynamic models of the system under
design.
The implementation generally include:-
Restructuring the class data.
Implementations of methods i.e. internal data structures and
algorithms.
Implementation of control.
Implementation of associations.
Object oriented
programming
OOP: is a programming paradigm based upon objects(having both
Class defines all the attributes, which an object can have and
methods, which defines the functionality of the object.
Encapsulation
Class defines all the attributes, which an object can have and
methods, which defines the functionality of the object.
For example, the class diagram (one type of structure diagram) shows
relationships among the classes that wil represent objects in the system
.
Types of Struc ture
ClassDiagrams
Diagram:-Describes the classes that make up the system, their
properties and methods, and their relationships.
Object Diagram:-Focuses on a particular set of objects and their
relationships at a specific time.
Component Diagram:-Shows how components are combined to form
larger parts of the system.
Composite Structure Diagram:-Shows a class’s internal structure and
the collaborations that the class allows.
Package Diagram:-Describes relationships among the packages that make up a system.
Deployment Diagram:-Describes the deployment of artifacts (files, scripts ,executable, and
the like) on nodes (hardware devices or execution environments that can execute
Cont’d
Behavioral Diagrams. UML defines three kinds of basic behavior diagrams: activity
diagrams, use case diagrams, and state machine diagrams.
Activity Diagrams. An activity diagram represents work flows for activities. They
include several kinds of symbols connected with arrows to show the direction of
the work flow.
Cont’d
Activity Diagram for Baking
Example Cookies
Cont’d
Use Case Diagram. A use case diagram represents a user’s interaction
with the system. Use case diagrams show stick figures representing actors
(someone or something that performs a task) connected to tasks
represented by elipses.
To provide more detail, you can use arrows to join subtasks to tasks. Use
the annotation <<include>> to mean the task includes the subtask. (It
can’t take place without the subtask.)
If a subtask might occur only under some circumstances, connect it to
the main task and add the annotation <<extend>>.
If you like, you can add a note indicating when the extension occurs.
(Usualy both <<include>> and <<extend>> arrows are dashed.)
Cont’d
A use case diagram shows actors and the tasks they perform
(possibly with subtasks and extensions).
Sequence Diagram. Is a type of interaction diagram in UML that
illustrate the flow of messages and interactions between objects or
components in a specific scenario.
System Boundary: a system boundary, which is a box that encloses the use cases.
Finding an actor?
Ask the following questions:
Who are the system’s primary users?
Who requires system support for daily tasks?
Who are the system’s secondary users?
What hardware does the system handle?
Which other(if any)systems interact with the system in question?
Do any entities interacting with the system perform multiple roles
as actors?
Which other entities(human or otherwise) might have an interest in
the system's output?
Finding an
actor?
External objects that produce/consume data:
Must serve as sources and destinations for data
Must be external to the system
Example Use-Case Diagram
Linking Use Cases
Association relationships
Generalization relationships
One element (child) "is based on" another element (parent)
Include relationships
One usecase(base) includes the functionality of another(inclusion
case)
Supports re-use of functionality
Extend relationships
One use case (extension) extends the behavior of another (base).
1.
Generalization
The child use case inherits the behavior and meaning of the
parent use case.
students.
When the registration iscompleted,the system sends information
Attributes
represent the state of an object of the class.
are descriptions of the structural or static features of a class.
Operations
define the way in which objects may interact.
are descriptions of behavioral or dynamic features of a class.
public class Employee {
public string name;
private string address;
public int employeeNumber;
private int socialSecurityNumber;
public string department;
private int salary;
private string taxCode;
public string status;
public void join() {}
public void leave() {}
public void retire() {}
public void changeInformation() {}
Derived
Attributes
Visibility
public(+)visibility means that the feature is
available to any class associated with the class that owns the
class.
the class∼)that
package( owns means
visibility that feature andfeature
that the any subtype of that
is available class.
only to
other classes in the same package as the declaring class (and the
declaring class itself).
private (-) visibility means that the feature is available only within
the class that owns that feature.
Multiplicit
y
Multiplicity specifies how many instances of the attributes type are
referenced by this attribute.
[n..m] – n to minstances
0..1 – zero or one instance
Interactions Diagrams
Sequence diagrams
Interaction overview diagrams
Timing diagrams
Communication diagrams
Sequence Diagrams Dimensions
Time. The vertical axis represents time proceedings (or progressing) down the page.
Note that Time in a sequence diagram is all a about ordering, not duration. The
vertical space in an interaction diagram is not relevant for the duration of the
interaction.
Objects. The horizontal axis shows the elements that are involved in the interaction.
Conventionally, the objects involved in the operation are listed from left to right
according to when they take part in the message sequence. However, the elements
operation)
Model messages(call and return messages)
Model Timingconstraints
Books from General Section are issued to all but Book bank books are issued only
for their respective courses.
A limitation is imposed on the number of books a student can issue.
A maximum of 4 books from Book bank and 3 books from General section is issued for
15 days only.
The software takes the current system date as the date of issue and calculates date of
return.
A bar code detector is used to save the student as well as book information.
The due date for return of the book is stamped on the book.
Return of Books
Any person can return the issued books.
The system displays the student details on whose name the books
were issued as well as the date of issue and return of the book.
The system operator verifies the duration for the issue.
The information is saved and the corresponding updating take place in the
database.
Query Processing