Designing the system : Objectoriented design - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

Designing the system : Objectoriented design

Description:

Designing the system : Object-oriented design. Information hiding(1) Design modules items likely to change are hidden. Change cannot affect other modules ... – PowerPoint PPT presentation

Number of Views:44
Avg rating:3.0/5.0
Slides: 27
Provided by: onyxYo
Category:

less

Transcript and Presenter's Notes

Title: Designing the system : Objectoriented design


1
Designing the system Object-oriented
design
2
Information 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

3
Information 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

4
Information hiding(3)
5
Object(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

6
Object(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.

7
Inheritance(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

8
Inheritance(2)
9
Inheritance(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

10
Aggregation
11
Association
12
Aggregation and association
Aggregation (System box CPU MemoryDisk)
System box
Mouse
CPU
Memory
Association
Keyboard
Association
Disk
Modem
Monitor
13
Polymorphism and dynamic binding(1)
  • Classical paradigm
  • Object-oriented paradigm

14
What 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

15
Advantages 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

16
OO 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

17
Object 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

18
Grammatical 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
19
Grammatical 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

20
Function-oriented design(1)
  • Decomposing the system into a set of interacting
    functions with a centralized system state shared
    by these functions

21
Function-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

22
Function-oriented design(3)-ATM
23
Function-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.

24
Function-oriented design(5)
  • Each node in the structure chart should have
    between two and seven subordinates
  • Loosely coupled, highly cohesive

25
Issues 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

26
OOT 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
Write a Comment
User Comments (0)
About PowerShow.com