You are on page 1of 52

Object Oriented Modelling and

Design

(IENG2306/SIE 277)

Module 1: Introduction to OO and UML


Course Description
• This course introduces students to modeling
and design of complex systems using all views
of the Unified Modeling Language (UML).
Most effort will be in the problem domain
(defining the problem). Some effort will be in
the solution domain.
Course Objectives
• Students will understand how to develop models
of systems, which may contain software and non-
software components, and how to represent
these models using the Unified Modeling
Language (UML).
• Students will be able to design systems (software)
starting from the business and requirements
model (via use cases), to the analysis model, to
the design model, to the implementation model
and finally to the operational model.
Learning Outcomes
By the end of this course, students should be able
to do the following:
• Develop models of systems, which may contain
software and non-software components
• Represent these models using the Unified
Modeling Language (UML)
• Design systems (software) starting from the
business and requirements model (via use cases),
to the analysis model, to the design model, to the
implementation model and finally to the
operational model.
CHAPTER –I Topics
• Definitions and basic concepts
(system/software, system thinking..)
• Structured Vs OO approaches
• Basic object orientation concepts
• Process models (waterfall, Prototyping,
Iterative)
• Work flows (Phases)- in object orientation
System Concepts - Review
 What is a system?
 A set of interrelated components that work in collaboration to achieve
common objectives
 System characteristics
 Purpose, Components, input, output, interfaces, boundary, environment,
constraints
 Type of System
 Living Vs Non-living
 Open vs Closed
 What is systems thinking?
 Why we need system thinking?
 What is an Information system?
 A system that generates useful and meaningful information to end users
 There are different types of IS

6
Software development
• It is initiated
• by end users
– real problems on the day to day task
• By mangers
– Looking for effectiveness and efficiency
• By technical personnel
– Sensing new opportunities and technologies
What is system/software?
• Computer programs and associated documentation
such as requirements, design models and user
manuals.
• Software products may be developed for a particular
customer or may be developed for a general market.
• System products may be
– Generic - developed to be sold to a range of different
customers e.g. PC software such as Excel or Word.
– Bespoke (custom) - developed for a single customer
according to their specification.

8
What are the attributes of good
system/software?
• The software should deliver the required functionality and
performance to the user and should be maintainable,
dependable and acceptable.
– Maintainability
• Software must evolve to meet changing needs;
– Dependability
• Software must be trustworthy;
– Efficiency
• Software should not make wasteful use of system resources;
– Acceptability (meet users requirement)
• Software must accepted by the users for which it was designed. This means it
must be understandable, usable and compatible with other systems.

9
Software Quality...
• Usability
– Users can learn it and fast and get their job done easily
• Efficiency
– It doesn’t waste resources such as CPU time and memory
• Reliability
– It does what it is required to do without failing
• Maintainability
– It can be easily changed
• Reusability
– Its parts can be used in other projects, so reprogramming
is not needed

10
Perspectives of System/Software Quality

Customer: User:
solves problems at easy to learn;
an acceptable cost in efficient to use;
terms of money paid and helps get work done
resources used

QUALITY
SOFTWARE

Developer: Development manager:


easy to design; sells more and
easy to maintain; pleases customers
easy to reuse its parts while costing less
to develop and maintain

11
Types of system/Software...
• Based on application nature
– Custom
• For a specific customer
– Generic
• Sold on open market
• Often called
– COTS (Commercial Off The Shelf)
– Shrink-wrapped
– Embedded
• Built into hardware
• Hard to change

12
Software Development Life Cycle
• SDLC has several clearly defined phases
• Requirements gathering What does the user want?
• Systems analysis Understanding/documenting requirements
• Design Planning a possible solution
• Implementation Building a solution
• Testing the implementation Ensuring it meets requirements
• Requirements gathering and systems analysis are performed
iteratively.
• Design/Implementation/Testing are done sequentially.

13
Challenges of System Development
• How well are systems built?
– Total Failure 15%
– “Challenged” 51%
– Successful 34%
• In 1994 Successful System was only 17%!
• Challenged means…
– Delayed, budget, or lacking critical
features/requirements

14
System development / Software Engineering Process

• A process used to create a software system


• Consists of:
– Methods (steps)
• A sequence of step-by-step approaches that help
develop the information system
– Techniques
• Processes that the analyst follows to ensure thorough,
complete and comprehensive analysis and design
– Tools
• Computer programs that aid in applying techniques

15
Structured Vs Object Oriented Approaches
• Structured paradigm
– Modes processes and data separately
– Suitable for small sized software
• Object oriented paradigm
– Integrates process and data together
– Objects are identified as having data and function

16
Object-oriented development
• Object-oriented analysis, design and programming
are related but distinct.
• OOA is concerned with developing an object model
of the application domain.
• OOD is concerned with developing an object-
oriented system model to implement requirements.
• OOP is concerned with realising an OOD using an OO
programming language such as Java or C++.
Characteristics of OOD
• Objects are abstractions of real-world or system entities and
manage themselves.
• Objects are independent and encapsulate state and
representation information.
• System functionality is expressed in terms of object services.
• Shared data areas are eliminated. Objects
communicate by message passing.
• Objects may be distributed and may execute
sequentially or in parallel.
Interacting objects
Basic Principles of Object Orientation

Object Orientation

Encapsulation
Abstraction

Modularity

Hierarchy
What is Abstraction?

Salesperson
Not saying
Which
salesperson –
just a
salesperson
in general!!!
Product
Customer

Manages Complexity
What is Encapsulation?
• Hide implementation from clients
– Clients depend on interface

How does an object encapsulate?


What does it encapsulate?

Improves Resiliency
What is Modularity?
• The breaking up of something complex into
manageable pieces Order
Entry

Order Processing
System Order
Fulfillment

Billing

Manages Complexity
What is Hierarchy?
Asset
• Levels of abstraction
Increasing
abstraction
BankAccount Security RealEstate

Savings Checking Stock Bond

Elements at the same level of the hierarchy


Decreasing should be at the same level of abstraction
abstraction
Advantages of OOD
• Easier maintenance. Objects may be
understood as stand-alone entities.
• Objects are potentially reusable components.
• For some systems, there may be an obvious
mapping from real world entities to system
objects.
Basic Concepts of Object Orientation
• Object
• Class
• Attribute
• Operation
• Interface (Polymorphism)
• Component
• Package
• Subsystem
• Relationships
What is an Object?
• Informally, an object represents an entity, either
physical, conceptual, or software

– Physical entity
Truck

– Conceptual entity
Chemical Process

– Software entity Linked list


Linked List
A More Formal Definition
• An object is a concept, abstraction, or thing
with sharp boundaries and meaning for an
application
• An object is something that has:
– State
– Behavior
– Identity
Representing Objects
• An object is represented as rectangles with
underlined names
: Professor a + b = 10

ProfessorClark
Class Name Only
Professor Clark

ProfessorClark : Object Name Only


Professor

Class and Object Name


(stay tuned for classes)
A More Formal Definition
• An object is a concept, abstraction, or thing
with sharp boundaries and meaning for an
application
• An object is something that has:
– State
– Behavior
– Identity
Representing Objects
• An object is represented as rectangles with
underlined names
: Professor a + b = 10

ProfessorClark
Class Name Only
Professor Clark
ProfessorClark :
Professor Object Name Only

Class and Object Name


(stay tuned for classes)
What is a Class?
• A class is a description of a group of objects
with common properties (attributes), behavior
(operations), relationships, and semantics
– An object is an instance of a class
• A class is an abstraction in that it:
– Emphasizes relevant characteristics
– Suppresses other characteristics

OO Principle: Abstraction
Sample Class
Class
Course
Properties Behavior
Name Add a student
Location Delete a student
a + b = 10
Days offered Get course roster
Credit hours Determine if it is full
Start time
End time
Class Compartments
• A class is comprised of three sections
– The first section contains the class name
– The second section shows the structure
(attributes)
– The third section shows the behavior (operations)
Class Name Professor
name
Attributes empID
Operations create( )
save( )
delete( )
change( )
The Relationship Between Classes and
Objects
• A class is an abstract definition of an object
– It defines the structure and behavior of each
object in the class
– It serves as a template for creating objects
Class
• Objects are grouped into classes
Professor
Objects

Professor Smith Professor Mellon

Professor Jones
What is an Attribute?
Object
Class

Attribute Attribute Value


:person
name = Kebede
age = 26
Person Sex = male
name
age
sex :person
name = Martha
age = 20
Sex = Female

Attribute describes a class. It is equivalent to adjective


What is an Attribute?
Object
Class

Attribute Attribute Value


:CourseOffering
number = 101
startTime = 900
CourseOffering endTime = 1100
number
startTime
endTime :CourseOffering
number = 104
startTime = 1300
endTime = 1500
What is an Operation?

CourseOffering
Class
addStudent
deleteStudent
getStartTime
Operation getEndTime

An executable procedure that is encapsulated in a


class and is designed to operate on one or more data
attributes that are defined as part of the class.
A method is invoked via message passing.
Messages

39
What is Polymorphism?
• The ability to hide many different
implementations behind a single interface

Manufacturer B Manufacturer C
Manufacturer A

OO Principle:
Encapsulation
What is an Interface?
• Interfaces formalize polymorphism
• Interfaces support “plug-and-play”
architectures Circle
<<interface>>
Shape
Pyramid
Draw
Move
Scale
Rotate Cube

Realization relationship (stay tuned for realization relationships)


What is a Component?
• A non-trivial, nearly independent, and
replaceable part of a system that fulfills a clear
function in the context of a well-defined
architecture OO Principle:
• A component may be Encapsulation
– A source code component
– A run time components or
– An executable component
<<EXE>> <<DLL>>
Source File Executable Component
Name Name Component Name
Interface
What is a Package?
• A package is a general purpose mechanism for
organizing elements into groups
• A model element which can contain other
model elements OO Principle:
Package Name Modularity
What is a Subsystem?
• A combination of a package (can contain other
model elements) and a class (has behavior)
• Realizes one or more interfaces which define
its behavior
Realization
Subsystem
<<subsystem>>
Interface Subsystem Name
Interface

OO Principles: Encapsulation and Modularity


(stay tuned for realization relationship)
Subsystems and Components
• Components are the physical realization of an
abstraction in the design
• Subsystems can be used to represent the
DesigninModel
component the design Implementation Model

<<subsystem>> Component
Component Name Name
Component Component
Interface Interface

OO Principles: Encapsulation and Modularity


Relationships
• Association
– Aggregation
– Composition
• Dependency
• Generalization
• Realization
Relationships: Association
• Models a semantic connection among classes
Association Name

Professor Works for University

Association
Role Names

Class University
Professor
Employee Employer
Relationships: Aggregation
• A special form of association that models a
whole-part relationship between an aggregate
(the whole) and its parts
Whole Part

Student Schedule

Aggregation
Relationships: Composition
• A form of aggregation with strong ownership
and coincident lifetimes
– The parts cannot survive the whole/aggregate
Whole Part

Person bodyOrgans

Aggregation
Example: Multiplicity and Navigation

Multiplicity

Student 1 0..* Schedule

Navigation
Review: Introduction to Object
Orientation
• What are the four basic principles of object
orientation? Provide a brief description of each.
• What is an Object and what is a Class? What is
the difference between them?
• What is an Attribute?
• What is an Operation?
• What is an Interface? What is Polymorphism?
• What is a Component?
(continued)
Review: Introduction to Object
Orientation (cont.)
• What is a Package?
• What is Subsystem? How does it relate to a
Component? How does it relate to a package? How
does it relate to a class?
• Name the 4 basic UML relationships and describe each.
• Describe the strengths of object orientation.
• Name and describe some general UML mechanisms.
• What are stereotypes? Name some common uses of
stereotypes.

You might also like