Professional Documents
Culture Documents
Prof. A. Acharya
Design
SA/SD OOAD
SA SD
Structured Design
⚫ The aim of structured design
⚫ Transform the results of structured analysis (i.e., a DFD
representation) into a structure chart.
⚫ A structure chart represents the software architecture:
⚫ Various modules making up the system,
⚫ Module dependency (i.e. which module calls which other
modules),
⚫ Parameters passed among different modules.
Structure Chart
⚫ Structure chart representation
⚫ Easily implementable using programming
languages.
⚫ Main focus of a structure chart:
⚫ Define the module structure of a software,
⚫ Interaction among different modules,
⚫ Procedural aspects (e.g, how a particular
functionality is achieved) are not represented.
Basic Building Blocks of
Structure Chart
⚫ Rectangular box:
⚫ A rectangular box represents a module.
⚫ Annotated with the name of the module it
represents.
Process-order
Arrows
⚫ An arrow between two modules implies:
⚫ During execution control is passed from one module to the
other in the direction of the arrow.
root
order
Process-order
Library Modules
⚫ Library modules represent frequently called
modules:
⚫ A rectangle with double side edges.
⚫ Simplifies drawing when a module is called by
several modules.
Quick-sort
Selection
⚫ The diamond symbol represents:
⚫ One module of several modules connected to the diamond symbol
is invoked depending on some condition.
root
root
Validate-data
Get-data
Bad Design
Shortcomings of Structure Chart
⚫ By looking at a structure chart:
⚫ we can not say whether a module calls another
module just once or many times.
⚫ Also, by looking at a structure chart:
⚫ we can not tell the order in which the different
modules are invoked.
Flow Chart (Aside)
⚫ We are all familiar with the flow chart representations:
⚫ Flow chart is a convenient technique to represent the flow of
control in a system.
⚫ A=B A=B
⚫ if(c == 100)
yes no
⚫ P=20
⚫ else p= 80
P=20 P=80
⚫ while(p>20)
⚫ print(student mark) dummy
yes no
Print
Flow Chart versus Structure
Chart
⚫ A structure chart differs from a flow chart in
three principal ways:
⚫ It is difficult to identify modules of a software from
its flow chart representation.
⚫ Data interchange among the modules is not
represented in a flow chart.
⚫ Sequential ordering of tasks inherent in a flow chart
is suppressed in a structure chart.
An Example …
Example 1: RMS Calculating
Software
Data-ite
ms Compute-
RMS
0
User result
Context Diagram
Example 1: RMS Calculating
Software
Compute-
Display rms
0.4 0.3
result RMS
Example 1: RMS Calculating
Software
⚫ By observing the level 1 DFD:
⚫ Identify read-number and
validate-number bubbles as the
afferent branch
⚫ Display as the efferent branch.
Example 1: RMS Calculating
Software
root
rms
Valid-numbers rms
Valid-numbers
Validate-da
Get-data ta
OOAD
Object-Oriention Concepts
⚫ Object-oriented (OO) design techniques are
extremely popular:
⚫ Inception in early 1980’s and nearing maturity.
⚫ Widespread acceptance in industry and
academics.
⚫ Unified Modelling Language (UML) already an
ISO standard (ISO/IEC 19501).
Objects
● A system is designed as a set of interacting objects:
− Often, real-world entities:
● Examples: an employee, a book etc.
− Can be conceptual objects also:
● Controller, manager, etc.
● Consists of data (attributes) and functions (methods)
that operate on data.
− Hides organization of internal information (Data
abstraction).
Model of an Object
m8 m7
mi are methods
of the object
m1 m6
Data
m2 m5
Object
m3 m4
Class
● Instances are objects
● Template for object creation
● Considered as abstract data type (ADT)
● Examples: Employees, Books, etc.
● Sometimes not intended to produce instances:
− Abstract classes
Example Class Diagram
Derived
Faculty Students Staff
Classes
issuable reference
Issuable Reference
Issuable Reference
Single Volume Single Volume
BookSet BookSet
Book Book
Representation of the
inheritance relationship
Multiple Inheritance
cont…
Base Base
LibraryMember LibraryMember
Class Class
Derive
d
Faculty Students Staff Faculty Students Staff
Classes Multipl
e
Inherit
ance
UnderGra UnderGra
PostGrad Research PostGrad Research
d d
Association Relationship
⚫ Enables objects to communicate with each
other:
⚫ Thus one object must “know” the address of
the corresponding object in the association.
⚫ Usually binary:
⚫ But in general can be n-ary.
Association Relationship
⚫ A class can be associated with itself
(recursive association).
⚫ Give an example?
⚫ An arrowhead used along with name,
indicates direction of association.
⚫ Multiplicity indicates # of instances taking
part in the association.
Association Relationship
1 borrowed by *
Library Member Book
3-ary Association
* *
Person Skill
Competency
level
Association and Link
⚫ A link:
⚫ An instance of an association
⚫ Exists between two or more objects
⚫ Dynamically created and destroyed as the run of
a system proceeds
⚫ For example:
⚫ An employee joins an organization,
⚫ Leaves that organization and joins a new
organization etc.
Aggregation Relationship
⚫ Represents whole-part relationship
⚫ Represented by a diamond symbol at the
composite end
⚫ Cannot be reflexive(i.e. recursive)
⚫ Not symmetric
⚫ It can be transitive
Aggregation Relationship
1
Document * Paragraph
1
* Line
Composition Relationship
⚫ Life of item is same as the order
1 *
Order Item
Aggregation
cont…
1
* Item
Aggregation
Order
Class Dependency
● Advantages of abstraction:
m4
m3
m5
m2 Data
m6
m1
Methods
Concept of encapsulation
Object Modelling Using UML
Object Modelling Using UML
● UML is a modelling language
− Not a system design or development
methodology
● Used to document object-oriented
analysis and design results.
● Independent of any specific design
methodology.
UML Origin
● OOD in late 1980s and early 1990s:
− Different software development houses were
using different notations.
− Methodologies were tied to notations.
● UML developed in early 1990s to:
− Standardize the large number of
object-oriented modelling notations
UML Lineology
● Based Principally on:
− OMT [Rumbaugh 1991]
− Booch’s methodology[Booch 1991]
− OOSE [Jacobson 1992]
− Odell’s methodology[Odell 1992]
− Shlaer and Mellor [Shlaer 1992]
Different Object Modeling
Techniques in UML
OMT
UML
Booch’s
OOSE Methodology
UML as A Standard
● Adopted by Object Management Group
(OMG) in 1997
● OMG is an association of industries
● Promotes consensus notations and
techniques
● Used outside software development
− Example car manufacturing
Developments to UML
UML 1.0
⚫ UML
continues to
develop:
⚫ Refinements UML 1.X
⚫ Making it
applicable to
new contexts Application to
UML 2.0 embedded
systems
Why are UML Models Required?
● A model is an abstraction mechanism:
− Capture only important aspects and ignores the rest.
− Different models result when different aspects are
ignored.
− An effective mechanism to handle complexity.
● UML is a graphical modelling tool
● Easy to understand and construct
Modeling a House
UML Diagrams
● Nine diagrams are used to capture
different views of a system.
● Views:
− Provide different perspectives of a
software system.
● Diagrams can be refined to get the
actual implementation of a system.
UML Model Views
● Views of a system:
− User’s view
− Structural view
− Behavioral view
− Implementation view
− Environmental view
UML Diagrams
Behavioural View
Structural - Sequence Diagram
View - Collaboration Diagram
- Class Diagram - State-chart Diagram
- Object Diagram - Activity
User’s View
Diagram
-Use Case
Diagram
Play Move
Tic-tac-toe game
Player
<<include>>
<<include>>
<<include>> <<include>>
Common
Base <<extends>>
use
use case
case
Hierarchical Organization of Use
Cases
use case 1 use case 3
External users
use case 2
Print
Query balance
Balance sheet
Receive Make
grant payments
Class Diagram
⚫ Describes static structure of a system
⚫ Main constituents are classes and their
relationships:
⚫ Generalization
⚫ Aggregation
⚫ Association
⚫ Various kinds of dependencies
Class Diagram
⚫ Entities with common features, i.e. attributes and
operations
⚫ Classes are represented as solid outline rectangle with
compartments
⚫ Compartments for name, attributes, and operations.
⚫ Attribute and operation compartments are optional
depending on the purpose of a diagram.
Object Diagram
LibraryMember LibraryMember LibraryMember
Mritunjay Mritunjay
B10028 B10028
C-108, Laksmikant Hall C-108, Laksmikant Hall
1119 1119
Mrituj@cse Mrituj@cse
25-02-04 25-02-04
25-03-06 25-03-06
NIL NIL
IssueBook( );
findPendingBooks( );
findOverdueBooks( );
returnBook( );
findMembershipDetails( );
object
control lifetime
message
Example
Cont…
Sequence of message
sending
An Example of
A Sequence Diagram
:Library
:Library
:Library Book :Library
Book :Book
Boundary Renewal Member
Register
Controller
confirm
confirm
updateMemberBorrowing
4: selectBooks
2: findMemberBorrowing
12: confirm
:Library
Member
updateMemberBorrowing
check
student
records
receive
fees
allot create
hostel hospital
record
register
receive
in
fees
course
conduct
medical
allot examinatio
room n
issue
identity
card
Activity diagram for student admission procedure at IIT
Activity Diagram: Example 2
Finance Order Stock
Receive Processing Manager
Order Receive
Supply
*[for each line
item on order] Choose
Check Outstanding
Authorize [failed] Line Item Order Items
Payment
* [for each chosen
Cancel [in stock] order item]
Order
Assign to Assign
[succeeded] Order Goods to
Order
[need to reorder]
Reorder
Item
[all outstanding
[stock assigned to all
order items filled]
line items and payment Dispatch
authorized] Order
State Chart Diagram
⚫ Based on the work of David Harel
[1990]
⚫ Model how the state of an object changes in
its lifetime
⚫ Based on finite state machine (FSM)
formalism
State Chart Diagram
Cont…
Rejected Accepted
Order Order
[some items available]
[some items not processed / deliver
available] processed
[all items
Pending available] Fulfilled
Order newsupply Order
dependency
Components:
• Executables
• Library
• Table
• File
• Document
Component Diagram
⚫ Captures the physical structure of the
implementation
⚫ Built as part of architectural specification
⚫ Purpose
⚫ Organize source code
⚫ Construct an executable release
⚫ Specify a physical database
A piece of
hardware
Unified Development Process
Cont…
OOA OOD
User
interface
Use case Interaction
Issues or
GUI diagram diagram
prototype
Start
Glossary
Example 1: Use Case Model
Play
Move
Board
displayBoardPositions getBoardPositions
Board PlayMoveBoundary
int position[9]
Controller
announceInvalidMove
announceResult
Example 2: Supermarket Prize Scheme
⚫ Supermarket needs to develop software to
encourage regular customers.
⚫ Customer needs to supply his:
⚫ Residence address, telephone number, and the
driving licence number.
⚫ Each customer who registers is:
⚫ Assigned a unique customer number (CN) by the
computer.
Example 2: Supermarket Prize Scheme
⚫ A customer can present his CN to the staff
when he makes any purchase.
⚫ The value of his purchase is credited against
his CN.
⚫ At the end of each year:
⚫ The supermarket awards surprise gifts to ten
customers who make highest purchase.
Example 2: Supermarket Prize Scheme
⚫ Also, it awards a 22 carat gold coin to
every customer:
⚫ Whose purchases exceed Rs. 10,000.
⚫ The entries against the CN are reset:
⚫ On the last day of every year after the prize
winner’s lists are generated.
Example 2: Use Case Model
register
Customer customer Clerk
register
sales
Sales Clerk
select
winners
Supermarket
Prize scheme
Manager
Example 2: Initial Domain Model
SalesHistory CustomerRegister
1 1
* *
SalesRecords CustomerRecord
* *
SalesRecords CustomerRecord
RegisterCustomerBoundary RegisterCustomerController
RegisterSalesBoundary RegisterSalesController
SelectWinnersBoundary SelectWinnersControllers
Select
SelectWinners
Winners
SelectWinners
*computeSales
*browse
register
register
checkDuplicate
*match
[duplicate]
showError
generateCIN
create
register :Customer
Record
displayCIN
:Register :Register
:Sales
Sales Sales
History
Boundary Controller
RegisterSales registerSales
registerSales
create :Sales
Record
confirm
confirm
:Register
:Sales
Sales
History
Boundary
registerSales
RegisterSales
create :Sales
Record
confirm
SalesHistory CustomerRegister
selectWinners findWinnerDetails
registerSales register
1 1
* *
SalesRecords CustomerRecord
salesDetails name
address
computerSales browse
browse checkDuplicate
create create
Summary
⚫ We discussed object-oriented concepts
⚫ Basic mechanisms: Such as objects, class,
methods, inheritance etc.
⚫ Key concepts: Such as abstraction,
encapsulation, polymorphism, composite
objects etc.
Summary
⚫ We discussed an important OO language UML:
⚫ Its origin, as a standard, as a model
⚫ Use case representation, its factorisation such as
generalization, includes and extends
⚫ Different diagrams for UML representation
⚫ In class diagram we discussed some relationships
association, aggregation, composition and
inheritance
Summary
cont…
⚫ Other UML diagrams:
⚫ Interaction diagrams (sequence and collaboration),
⚫ Activity diagrams,
⚫ State chart diagrams.
⚫ We discussed OO software development
process:
⚫ Use of patterns lead to increased productivity and
good solutions.