Download presentation
Presentation is loading. Please wait.
1
What Is Object-Oriented Design? (Chapter 1)
2
Software Development Life Cycle 1. Problem statement and requirements 2. Solution specification 3. Code design 4. Code implementation 5. Code testing and debugging 6. Code delivery 7. Code maintenance
3
New Focus " In previous courses you have mostly done just 4 and 5 (implementation and testing/debugging) " This course will add 2 and 3 (specification and design) using OOD.
4
What Is Design? Design: an abstract description of how something is built. Example: descriptions of a CD player: 1. Information level (ones and zeros) 2. Functional level (how it is used) 3. Physical level (what its parts are) - fig. 1-1
5
Block Diagram of a CD Player (fig. 1-1) Laser control Data Processor D/A Converter Controller LCD Displa y Audio Outpu t Input Panel Data Audio Index Data
6
Another Example Descriptions of a house: 1. Realtor point of view 2. Architect point of view 3. Materials science point of view Each level or point of view must use ABSTRACTION. Examples of abstraction are models and diagrams.
7
Abstraction Abstraction is the process of hiding details about an object while still describing its functionality. The physical description of a CD player hides the details of its functional use. The realtor's point of view of a house hides the details of the architectural point of view. Any design, by necessity, must hide details.
8
Design Hierarchy Example House Living Room Dining Room KitchenBathroomBedroom 1... Floor Covering Wall Covering Shower?
9
Factors In Design Quality Relative level of detail: should be appropriate for audience Number of top-level components: 5 to 10 Depth of hierarchy: should be appropriate for audience
10
Presenting Designs With Diagrams Hierarchical block diagrams Data-flow diagrams (as in fig. 1-1) Class diagrams Message-trace diagrams State diagrams
11
Approaches to Design by Abstraction Procedural oriented design (control oriented) -- see next slide Data oriented design (of which object oriented design is an example)
12
Procedural Design of Screen Editor (fig. 1-2) Control Get Next Command Refresh Display Process Command Read Input Determine Command...
13
Procedural Design In terms of modules, procedures, and data structures (machine oriented objects) There is a specific linear order to what needs to be done Control more important than data HOWEVER, most real world problems do not conform to this model (consider business and game applications) Often better to break up a problem by looking at data flow
14
Data-flow Diagram of a Compiler (fig. 1-3) Parse Trees Token Stream Source File Symbol Table Object File Lexical Analysis Parse Trees Parser Symbol Resolution Code Generation
15
Passive vs. Active Data Passive Data Numbers Strings Simple structures Real world data often more complex than this Active Data: data elements which "know how to do things," to themselves and other elements (virtual computers in software) Such active data elements are also called "objects"
16
Solar System as Objects (fig. 1-4) Solar System components:List update() Subsystem position: Vector mass:Real components:List update() Body position: Vector velocity:Vector mass:Real update() Simple Objects for a Solar-System Simulation
17
Object-Oriented Design (OOD) Describes a solution to a problem in terms of active data elements or objects (application oriented rather than machine oriented) An object is a composition of data and operations An object is like a "wrapper" around data, providing functionality to it Objects with the same data types and operations are grouped together in a class "Object" is sometimes used ambiguously to refer to both classes and individual objects
18
Keys to Constructing an Object- Oriented Design 1)Understand what an object of each class can be and do (view objects anthropomorphically) 2)Understand the interaction of the different classes 3)Define the interactions in such a way that the details of the internal operations are hidden from outside classes
19
Viewing Objects Anthropomorphically Look at objects as though they were people: They are "living" in that their properties can change over time They are "intelligent" in that they can undertake operations and in a sense "know" how to perform them They have a variety of types: physical objects, relationships, abstractions
20
Interaction of Classes Classes interact by: 1)Providing operations that can be invoked by other classes 2)Invoking other classes' operations in order to perform one's own OOD provides abstraction by isolating information inside classes A class interface is the set of operations and data the class makes available to other classes The interface does not say how desired behavior is achieved
21
OOD Methodology A Three-Step Process: 1)Identify the classes: Decide what the classes will be 2)Characterize the classes: Name each object and the data associated with it 3)Define the implementation: Define all of the operations using pseudocode
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.