Title: Designing the system : Objectoriented design
1Designing the system Object-oriented
design
2Information hiding(1)
- Design modules items likely to change are hidden
- Change cannot affect other modules
- Example
- class JobQueue
-
- // instance variables
- private int queueLength // length of job
queue - private int queue new int25 // queue
can contain up to 25 jobs - // methods
- public void initializeJobQueue ()
-
- // body of function
-
3Information hiding(2)
- public void addJobToQueue (int jobNumber)
-
- // body of function
-
- public void removeJobFromQueue (int jobNumber)
-
- // body of function
-
- // class JobQueue
- Now queue and queueLength are inaccessible
4Information hiding(3)
5Object(1)
- Variables (objects) are instantiations of
abstract data types - Object ADT Inheritance ( Polymorphism )
- Abstract Data Types(ADT) Data Operations
- Class A specification for an arbitrary number
of similar objects (serves as a template from
which object can be created). - Classical paradigm
- record_1.field_2
- Object-oriented paradigm
- thisObject.attributeB
- thisObject.methodC
6Object(2)
- Identity
- Each object is a discrete, distinguishable
entity. - Classification
- Objects with the same data structure and
operations are grouped into a class. Each object
is an instance of a class. - Message sending
- objects communicate through the interface via
message passing.
7Inheritance(1)
- Property of inheritance is essential feature of
object-oriented - Define humanBeing to be a class
- A humanBeing has attributes, such as age, height,
gender - Assign values to attributes when describing
object - Define parent to be a subclass of humanBeing
- A parent has all attributes of humanBeing, plus
attributes of his/her own (name of oldest child,
number of children) - A parent inherits all attributes of humanBeing
8Inheritance(2)
9Inheritance(3)
- JABA Implementation
- class HumanBeing
-
- private
- int age
- float height
- enum male, female gender
- public
- // declarations of operations on HumanBeing
- // class HumanBeing
- class Parent extends HumanBeing
-
- private
- char nameOfOldestChild20
- int numberOfChildren
- public
- // declarations of operations on Parent
- // class Parent
10Aggregation
11Association
12Aggregation and association
Aggregation (System box CPU MemoryDisk)
System box
Mouse
CPU
Memory
Association
Keyboard
Association
Disk
Modem
Monitor
13Polymorphism and dynamic binding(1)
- Classical paradigm
- Object-oriented paradigm
14What is Object-oriented design(OOD)?
- Characteristics of OOD
- Abstractions
- Independent entities
- System functionality operations or services
associated with each object - Shared data areas are eliminated.
- Objects may be distributed and execute either
sequentially or in parallel. - OO development
- OO analysis
- OO design
- OO programming
15Advantages of OOA/OOD
- Design changes are localized.
- Unexpected interaction with other program modules
are unlikely - Suitable for distributed, parallel or sequential
implementation. - Shared data areas are reduced.
- Increases
- reusability
- maintainability
- extensibility
- understandability
16OO Approach steps Vs. Functional approach steps
- Common OO approach steps
- step1. Identify objects(attributes and methods)
- step2. Determine the relationships among objects
- step3. Design implement objects
- Functional approach steps
- step1. Identify functionality
- step2. Determine the relationships among
functions - step3. Design and implement functions
17Object identification
- One of main problems in OO design.
- Various proposals
- Use a grammatical analysis of a natural language
description of a system. Objects and attributes
are nouns, operations or services are verbs. - Use tangible entities
- Use a behavioral approach
- Use a scenario-based analysis
18Grammatical analysis example(1)
- Hood method by European Space Agency
- The Office Information Retrieval System(ORIS)
can file documents under some name in one or more
indexes, retrieve documents, display and maintain
document indexes, archive documents and destroy
documents. The system is activated by a request
from the user and always returns a message to the
user indicating the success or failure of the
request
Retrieval system
Document
User
Index
Name
Name
User command
File Retrieve Archive Destroy
Display Delete entry Add entry
Get command Put message
19Grammatical analysis example(2)
- Problems
- Different ways to reference the same object.
Designers cannot simply assume that nouns are
always objects and verbs are their associated
operations. - No support for inheritance
- incomplete formalism, etc
20Function-oriented design(1)
- Decomposing the system into a set of interacting
functions with a centralized system state shared
by these functions
21Function-oriented design(2)
- Activities
- Data flow design
- Structural decomposition
- Detailed design description Describe the
entities in the design and their interfaces. - Data-flow design
- Show how data passes through the system and is
transformed by each system function. - Design a sequence of functional transformations
that convert system inputs into the required
outputs. - Represented by data flow graph
22Function-oriented design(3)-ATM
23Function-oriented design(4)
- Structural decomposition
- Model how functions are decomposed into
sub-functions - Decomposition hierarchy is represented by using
graphical structure charts. - Three-stage systems Input some data with
validation and checking, process the data, then
output the data. - Data validation and output formatting functions
should be subordinates to input and output
function respectively. - The role of functions near the top of the
structural hierarchy may be to control a set of
lower-level functions.
24Function-oriented design(5)
- Each node in the structure chart should have
between two and seven subordinates - Loosely coupled, highly cohesive
25Issues in design creation
- Modularity and levels of abstraction
- Collaborative design
- Differences in personal experience,
understanding, and preference - People sometimes behave differently in groups
from the way they would behave individually. - Designing the user interface
- Cultural Issues
- User preferences
- Concurrency
- Synchronization
- Mutual exclusion
- Design patterns and reuse
26OOT adoption by organization
- Factors influencing a companys ability to learn
OOT - The technologys complexity and immaturity
- Compatibility with organizational culture
- Industry competitiveness
- Guidelines for successful OOT adoption
- Select an appropriate level and pace
- Build realistic expectations Employ change agents
- Encourage learning-by-doing program
- Leverage existing technologies
- Build an OO architecture
- Continuously scan for new toolsets
- Institutionalize learned behaviors