Title: Chapter 22: Object-Oriented System analysis and Design
1Chapter 22 Object-Oriented System analysis and
Design
2Topics
- Whats an Object and an Object Class?
- Common Themes Underlying An Object
- Object Technology Domains
- Object-Oriented Development? What And Why?
- Object-Oriented Analysis
- Object-Oriented Design
- Object-Oriented Modeling
- UML- A Quick Reference
3 I. WHAT'S AN OBJECT?
- A DEFINITION
- AN OBJECT IS A PACKAGE OF INFORMATION AND A
- DESCRIPTION OF ITS MANIPULATIONS.
- Â
- TO PROVIDE THAT ABILITY OF REPRESENTING THE
REAL WORLD AS CLOSELY AS POSSIBLE, AN OBJECT
MUST CONSIST OF - Â
- DATA COUPLED WITH ALL THE OPERATIONS THAT
CAN ACT AGAINST IT. OPERATIONS REFERRED TO AS
METHODS. COMMUNICATIONS BETWEEN OBJECTS
REFERRED TO AS MESSAGES.
4WHAT'S AN OBJECT? (CONTD)
- IN OTHER WORDS, MANIPULATIONS OF THE
- OBJECTS IMPLY A MECHANISM MUST EXIST TO
- Â
- 1. REPRESENT THE DATA STRUCTURE OF AN OBJECT.
- 2. SPECIFY THE PROCESS TO ACT UPON THE DATA
STRUCTURE. - 3. INVOKE THE PROCESS PER PRESCRIBED PROCEDURES.
5WHAT'S AN OBJECT? (CONTD)
Data Operations
Message
Action
- Model Entities in the real world.
- Have Data Structure.
- Have State.
- Have Methods to define actions.
- Are Messages driven.
6AN OBJECT CLASS (Abbreviation CLASS)
- An object class describes a group of objects with
similar - properties (attributes), common behavior
(operations), - common relationships to other objects, and common
- semantics. --- James Rumbaugh ---
- My definition
- A group of like objects make up a class.
7What's in A Class?
A CLASS HAS A NAME, A COLLECTION OF OPERATIONS
FOR MANIPULATING ITS INSTANCESN AND CHANGING
ITS STATE. Â THE OPERATIONS THAT MANIPULATE THE
INSTANCES OF A CLASS ARE CALLED
METHODS. Â THE STATE OR REPRESENTATION OF AN
INSTANCE IS STORED IN AN INSTANCE VARIABLE. Â THE
METHODS ARE INVOKED THROUGH SENDING MESSAGES TO
THE INSTANCES.
8A Barn vs. A Horse
- Even a barn and a horse both have a cost and age,
- they may belong to different classes. if barn
and - horse were regarded as purely financial assets,
they - may belong to the same class. the interpretation
of - semantics depends on the purpose of each
- application and is a matter of judgment.
- --- James Rumbaugh --
9STATE
- ASSOCIATED WITH AN OBJECT TO SATISFY
- SOME CONDITION. IT REPRESENTS THE GROSS
- BEHAVIOR OF AN OBJECT. FOR EXAMPLE
- THE LAUNCHING OF A SATELLITE
- IT GOES THRU THE FOLLOWING STATES
- READY
- FIRING
- ASCENING
- ON THE ORBIT.
- Â
- AN AUTOMOBILE TRANSMISSION MIGHT
- BE IN THE STATE OF REVERSE OR NEUTRAL
- OR FIRST OR SECOND OR THIRD GEAR.
10METHODS AND MESSAGES
- METHOD IS PART OF AN OBJECT. ONLY THE METHODS
- OF AN OBJECT HAVE ACCESS TO ITS STATE, AND A
- METHOD CAN ONLY BE INVOKED BY SENDING THE OBJECT
- A MESSAGE.
- Â
- FOR EX
- SENDING THE DRAW MESSAGE TO A LINE INVOKES
ITS DRAW METHOD SENDING THE SAME MESSAGE TO A
CIRCLE INVOKES A DIFFERENT METHOD.
11CLASS vs. INSTANCE
- A CLASS DEFINITION DEFINES BOTH THE INSTANCE
- VARIABLE (STATE OR REPRESENTATION) AND THE
- METHODS (OPERATIONS) FOR OBJECTS OF THAT TYPE.
12II. COMMON THEMES UNDERLYING AN OBJECT
1. DATA ABSTRACTION Â 2.
ENCAPSULATION (INFORMATION HIDING) Â 3.
INHERITANCE (SHARING BOTH DATA STRUCTURE
AND BEHAVIOR) Â
4. DYNAMIC BINDING
13DATA ABSTRACTION
The process and mechanism to suppress irrelevant
implementation detail and to treat data as a
representation of some worldly subject matter. Â
Automobile
Automobile class Object
Data Abstraction Attributes
Frame size
Wheel size
Engine power
Operations
Start Stop Move
14ABSTRACT DATA TYPES
- - DESCRIBE A SET OF OBJECTS (DATA) WITH THE
- SAME REPRESENTATION AND BEHAVIOR.
- Â
- -- REPRESENT A CLEAR SEPARATION BETWEEN THE
EXTERNAL INTERFACES OF A DATA TYPE AND ITS
INTERNAL IMPLEMENTATIONS. -
- -- ARE IMPLEMENTED THROUGH CLASSES.
15ENCAPSULATION
THE STATE OF A SOFTWARE MODULE IS
REPRESENTED BY PRIVATE VARIABLES THAT ARE
VISIBLE AND ACCESSIBLE ONLY WITHIN THE SCOPE
OF THE MODULE. THE INTERNAL STRUCTURE OF THE
PRIVATE VARIABLES IS INACCESSIBLE OUTSIDE
THE SCOPE OF THE MODULE. Â A SET OF
PROCEDURES OR FUNCTIONS LOCAL TO THE MODULE
MAY DIRECTLY MANIPULATE THE PRIVATE DATA. THESE
PROCEDURES OR FUNCTIONS ARE PUBLIC AND MAY BE
INVOKED OUTSIDE THE MODULE.
16ENCAPSULATION
The principle that an object should hide things
from other Objects, limiting visibility about
what I know and do.
Data
Private Functions
Public Functions
17C in CLASS
- A class definition (abstract data type) defines
both the - instance variable (state or representation) and
the - methods (operations) for objects of that type.
For ex - Class Date
- // the default is private
- Int DAY
- Int MONTH
- Int YEAR
- Public
- Date (Void) / an inline constructor /
- daymonthyear 0
- Date int Da, int Mo, Int Yr
- -Date () / null destructor /
- Void display(void)
-
18C in CLASS
IN THIS EXAMPLE, WE HAVE DECLARED
THREE PRIVATE INSTANCE VARIABLES CALLED
DAY, MONTH, YEAR. Â THESE PRIVATE INSTANCE
VARIABLES can only be read and changed by
functions that are themselves members of
the class. Â Usually, the private parts are
variables and public parts are functions. Â
THIS CONSTRUCTOR FUNCTION EXECUTES WHEN YOU
DECLARE A DATE OBJECT WITHOUT INITIALIZING
VALUES Â DATE DATE_BORN / Create an
Object / DATE DATE_retired (25, 6, 97)
/ Create another object /
19INHERITANCE
A CLASS IS A TEMPLATE FROM WHICH OBJECTS ARE
CREATED. Â AN OBJECT CLASS DESCRIBES A GROUP OF
OBJECTS WITH SIMILAR PROPERTIES(ATTRIBUTES) AND
COMMON BEHAVIOR (OPERATIONS). FOR EX AUTOMOBILE,
PERSON. EACH AUTOMOBILE HAS AN ENGINE, BODY
FRAME AND A SET OF WHEELS. A PERSON HAS AN AGE
AND OTHER PHYSICAL PROPERTIES SUCH AS EYES, HANDS
AND ETC.
20INHERITANCE
- The principle that a class can extend from
another previously defined class. The guiding
principle is to organize the classes according to
generalization/specialization.
21INHERITANCE (continued)
INHERITANCE ALLOWS SUBCLASS TO BE FORMED FROM AN
ABSTRACT DATA TYPE. ALL THE MEMBERS OF A
SUBCLASS INHERIT THE PROPERTIES OF THE PARENT
CLASS (ABSTRACT DATA TYPE). Â FOR EXAMPLE, A
PROBLEM DOMAIN MAY CONTAIN, IN ADDITION TO THE
GENERAL CONCEPT OF SHAPE, THE SLIGHTLY LESS
GENERAL CONCEPTS OF CIRCLES AND TRIANGLES. THE
CONCEPTS OF CIRCLES AND TRIANGLES ARE RELATED, IN
THE SENSE THEY ARE BOTH SHAPES.
22INHERITANCE IN C
CLASS PERSON PUBLIC
CHAR NAME20 CHAR ADDRESS20
INT AGE Â CLASS EMPLOYEE
PUBLIC PERSON PUBLIC
INT EMPLOYID
23INHERITANCE IN C
EMPLOYEE WANG ...... STRCPY
(WANG.NAME, 'JOHN WANG') STRCPY (
WANG.ADDRESS, ' SOMEWHERE') WANG.AGE
23 WANG.EMPLOYID 1222
 THE
ABOVE OBJECT WANG INHERITS MEMBERS FROM THE
PERSON BASE CLASS.
24MULTIPLE INHERITANCE IN C
IN THE FOLLOWING EXAMPLE, DERIVED CLASS Z
INHERITS MEMBERS FROM BOTH X Y
CLASSES. Â CLASS X
PUBLIC INT
X CLASS Y PUBLIC INT X CLASS
Z PUBLIC X, PUBLIC Y PUBLIC INT X
F() X1 Y 2 Z 3
25CODE SHARING
INHERITANCE INCREASES CODE SHARING BY ALLOWING
THE LANGUAGE RATHER THAN THE PROGRAMMER TO REUSE
CODE FROM ONE CLASS IN ANOTHER RELATED
CLASS. Â USE THE ACCOUNT CLASS FOR EX EACH
ACCOUNT TYPE INCLUDES AN ACCOUNT NUMBER, AN
ACCOUNT OWNER, A BALANCE, AND AN INTEREST RATE.
SAVINGS ACCOUNT DO NOT ALLOW CHECK WITHDRAWALS
BONUS SAVINGS ACCOUNTS HAVE A HIGHER RATE.
26CODE SHARING-Continued
USE INHERITANCE TO CAPTURE THE SIMILARITY AND
DIFFERENCES IN THE ACCOUNT TYPES. Â WHAT ARE
INHERITED METHODS DEPOSIT, WITHDRAW AND
CHECK REPRESENTATION ACCOUNTNUMBER,
ACCOUNTOWNER, BALANCE AND RATE.
27POLYMORPHISM
POLYMORPHISM (OVERLOADING) ALLOWS A PROGRAMMER
TO HAVE THE SAME INTERFACE TO DIFFERENT
OBJECTS. Â FOR EX THE CLASS FILE MAY HAVE
AN OPERATION CALLED PRINT. DIFFERENT
METHODS (OPERATIONS) COULD BE IMPLEMENTED TO
PRINT ASCII FILES OR BINARY FILES.
POLYMORPHISM IS CLOSELY RELATED TO
LATE-BINDING (DYNAMIC BINDING).
28POLYMORPHISM
- The principle that objects in different classes
may understand the same message yet respond in
different ways.
Group Exercise
I do it my way
I do it my way
29DYNAMIC BINDING
DYNAMIC BINDING MEANS THE SYSTEM BINDS
MESSAGE SELECTORS TO THE METHODS THAT IMPLEMENT
THEM AT RUN TIME INSTEAD OF COMPILE TIME.
WHY IT'S NEEDED. Â 1. THE DETERMINATION OF THE
PARTICULAR METHOD TO BE EXECUTED FOR A MESSAGE
IS DONE DYNAMICALLY AT RUN TIME. Â 2. A
VARIABLE'S OBJECT CLASS OR TYPE MAY NOT BE KNOWN
UNTIL AT RUN TIME.
30DYNAMIC BINDING IN C
YOU CAN HAVE SEVERAL FUNCTIONS WITH THE SAME
NAME IN THE SAME SCOPE. THE COMPILER
DISTINGUISHES THE FUNCTIONS BASED ON THE
ARGUMENT TYPES. THIS IS CALLED OVERLOADING.
VOID DISPLAY (INT) //DISPLAY AN
INTEGER VOID DISPLAY (CHAR) //DISPLAY A
CHARACTER VOID DISPLAY (LONG) //DISPLAY
A LONG VOID DISPLAY (DOUBLE) //DISPLAY
A DOUBLE Â SUPPORT FOR OVERLOADING IS ONE
REASON WHY C NEEDS PROTOTYPES FOR
EVERYTHING.
31DYNAMIC BINDING IN C
C SUPPORTS DYNAMIC BINDING THROUGH
VIRTUAL FUNCTIONS. A VIRTUAL FUNCTION ALLOWS
OVERRIDING OF THE SAME MEMBER FUNCTION NAME
FOR ALL CLASSES WITHIN THE HIERARCHY.
CLASS SHAPE ......
PUBLIC VIRTUAL VOID DRAW()
......
32DYNAMIC BINDING IN C
DURING EXECUTION, THE RUN TIME ENVIRONMENT
DECIDES WHICH FUNCTIONS TO INVOKE. THE
DECISION IS BASED ON THE OBJECT TYPE. Â
CLASS CIRCLE PUBLIC SHAPE VOID
DRAW() ......
CLASS TRIANGLE PUBLIC SHAPE
VOID DRAW() ......
33C OBJECT-ORIENTED PROPERTIES
FOR EACH CLASS, A PREDEFINED STRUCT IS
INITIALIZED WITH POINTERS TO EACH METHOD
AVAILABLE TO THE CLASS. EACH OBJECT CONTAINS A
POINTER TO THE METHOD STRUCTURE FOR ITS CLASS.
 C SUPPORTS DYNAMIC BINDING THROUGH VIRTUAL
METHOD RESOLUTION AND THE ABILITY TO OVERRIDE AN
OPERATION IN A SUBCLASS ARE ONLY AVAILABLE IF THE
OPERATION IS DECLARED VIRTUAL IN THE SUPERCLASS.
34Example Pointer To Methods
FOR EACH CLASS, A PREDEFINED STRUCT IS
INITIALIZED WITH POINTERS TO EACH METHOD
AVAILABLE TO THE CLASS. EACH OBJECT CONTAINS A
POINTER TO THE METHOD STRUCTURE FOR ITS CLASS.
CLASS PERSON INT AGE
CHAR SEX PUBLIC
VOID GET(INT A, CHAR S) A AGE S SEX
VOID SET (INT A, CHAR S) AGE A
SEX S VOID PRINT()
(PRINTF("AGE D SEX C", AGE,
SEX) TWO PRIVATE INSTANCE VARIABLES, AGE
AND SEX, ARE DECLARED. THEY ARE ONLY
ACCESSIBLE THRU GET AND SET METHODS.
35Example The This Pointer
TO THE THE THIS POINTER Â CLASS PERSON
PERSON SPOUSE PUBLIC
GOTMARRIEDTO (PERSON P)
THIS -gt SPOUSE P Â GIVEN AN
INSTANCE VARIABLE CALLED SPOUSE IN THE PERSON
CLASS, THE GOTMARRIEDTO METHOD MODIFIES THIS
INSTANCE VARIABLE'S POINT PERSON IDENTIFIED AS
THE SPOUSE.
36III. OBJECT TECHNOLOGY DOMAINS
- 1. OBJECT ENVIRONMENTS
- FOR EXAMPLE MS-WINDOWS OS/2 THE APPLE
MACINTOSH HEWLETT-PACKARD'S NEW WAVE. - Â Â
- 2. OBJECT TOOLS AND METHODOLOGY
- PROMOTING THE USE OF OBJECT-ORIENTED
APPROACH TO THE SYSTEMS DEVELOPMENT THRU THE
USE OF OBJECT-ORIENTED ANALYSIS AND DESIGN
37OBJECT TECHNOLOGY DOMAINS
- 3. OBJECT-ORIENTED DATABASE MANAGEMENT
- PROVIDING A MECHANISM FOR THE STORAGE
AND MGT OF OBJECTS WHICH CONTAIN BOTH DATA
AND - BEHAVIOR.
-
- Â
- 4. OBJECT-ORIENTED LANGUAGES
- PROVIDING THE FACILITIES OF ENFORCING
THE BASIC CONCEPTS OF OBJECTS IN THE
ABOVE THREE - APPLICATIONS.
38IV. THE OBJECT-ORIENTED DEVELOPMENT
- 1. WHAT 'S A OBJECT-ORIENTED DEVELOPMENT?
- Â
- 2. OBJECT-ORIENTED ANALYSIS
-
- 3. OBJECT-ORIENTED DESIGN
- Â
- 4. SUMMARY AND MAJOR METHODOLOGIES FOR OOAD
-
39WHAT'S AN OBJECT-ORIENTED DEVELOPMENT
- AN OBJECT-ORIENTED DEVELOPMENT IS A MODEL
BUILDING STYLE CLOSELY RELATED TO THE
FUNCTIONALITY AND STATE OF THE REAL WORLD. - Â
- FACTS
- THE IMPLEMENTATION DETAILS OF REAL-WORLD
THINGS ARE LIKELY TO CHANGE OVER TIME. - Â
- ADVANTAGES
- AN OBJECT-ORIENTED MODEL IS BUILT AROUND,
AND - HIDES THE DETAILS OF THESE REAL-WORLD
THINGS. AS A RESULT, CHANGES TO THESE THINGS
WILL BE LOCALIZED IN THE MODEL.
40How Objects Make Programming More effectively
Structured Development Analysis, design and
coding take place in The traditional waterfall
way. Each step is isolated from the other.
A
D
P
Object-oriented development One multifaceted
model is used from Concept to code. Because one
underlying model is used, teams apply Analysis,
design And programming Concurrently.
A
D
P
41WHY?
- 1. INCREASED PRODUCTIVITY- OBJECT ORIENTED
PARADIGM CLOSELY RELATED TO THE BEHAVIOR OF THE
ELEMENTS OF THE WORLD WE LIVE IN. - Â
- 2. SHORTEN THE TIME AND LOWER THE COST
OF DEVELOPMENT AND SOFTWARE MAINTENANCE BY - USING REUSABLE SOFTWARE COMPONENTS --
- ACHIEVED THRU INHERITANCE AND BY
- CREATING OBJECTS AND SHARING PROPERTIES
- WITH SIMILAR OBJECTS.
- Â
- 3. LOCALIZING CHANGES TO THE
- IMPLEMENTATION OF ONE OR MORE CLASSES.
42MORE CLOSELY RELATED TO THE REAL WORLD
1. WE PERCEIVE THE REAL WORLD AS A
VARIETY OF OBJECTS. 2. A CLASS
IS A TEMPLATE FROM WHICH OBJECTS ARE
CREATED. Â 3. AN OBJECT MODEL (DEPICTING
THE REAL WORLD) CONSISTS OF ONE OR
MORE MODULES. 4. A MODULE IS A
LOGICAL CONSTRUCT FOR GROUPING CLASSES,
ASSOCIATIONS, AND GENERALIZATIONS.
43Major Methodologies for OOAD
- 1. Coad and Yourdon Object-Oriented Analysis
- 2. Rumbaugh/Blaha/Premerlani/Eddy/Lorensen
- Object-Oriented Modeling and Design Prentice
Hall, - Englewood Cliffs, New Jersey, 1991.
- 3. Shlaer and Mellor Object-Oriented
Analysis/Design. - Object-Oriented Systems Analysis Yourdon
Press, - Englewood Cliffs, New Jersey, 1988.
- 4. Grady Booch Object-Oriented Design.
- Object-ORIENTED DESIGN REDWOOD CITY,
CALIF. - BENJAMIN/CUMMINGS, 1991
44OO Development Consists of Two Areas
- Object-Oriented Analysis
- Object-Oriented Design
45V. OOA (OBJECT-ORIENTED ANALYSIS
- The Class/Object Layerthe classes and objects
- The Structure Layerrelationship and inheritance
- The Service Layermessages and behavior
- The Attribute Layer--attributes
- The Subject Layergroup of classes
46Object-Oriented Analysis
- Class Level pertaining to an object class
documenting - Â
- Data what information must be included for an
object - class.
- Process (services) provided by an object class
such as - Occur (instances add, change, delete and select)
- Calculate Monitor.
- Behavior an event which may change a significant
change - in the state of an object.
- Â
- System Level pertaining to a group of objects
documenting - Their relationships and communications among
them. - Â
47Class Level-Object Class
Operations
Behavior
Data Structure
48System Level-Object Class
Object Class A
Object Class A
1M
11
Event
Message
MM
1M
Object Class B
Object Class C
Object Class B
Object Class C
49V.1 The Class/Object Layer Analyzing Classes and
Objects
- Identify Objects and Classes
- 1. Tangible things such as vehicles or books
- Â
- 2 Roles enacted by persons and organizations
such as customers or owners. - Â
- 3. Incidents or Events-- such as flight or
meeting. - Â
- 4. Interactions-such as a sale or a marriage
- Â
- 5. Specifications-such as insurance policy.
- Â
50V.2 The Structure Layer-Analyzing Structure
(Organize The Objects and Classes)
- 1. PARTS/WHOLE RELATIONSHIPS
- Â
- 2 Generalization Specialization
51PARTS/WHOLE RELATIONSHIPS
52PARTS/WHOLE RELATIONSHIPS
- THE PART-WHOLE OR A-PART-OF RELATIONSHIP
IS AN - AGGREGATION RELATIONSHIP. AGGREGATION IS A
- STRONG FORM OF ASSOCIATION IN WHICH AN
- AGGREGATE OBJECT IS MADE OF COMPONENTS.
- COMPONENTS ARE PART OF THE AGGREGATE.
- Â
- OFTEN IT IS NOT OBVIOUS IF AN ASSOCIATION
SHOULD - BE MODELED AS AGGREGATION.
53Generalization Specialization
Aircraft
Specialization
Generalization
Commercial
Military
B52
B-1B
747
777
54SUBTYPES SUBCLASSES
Faculty
Full Time Faculty
Part Time Faculty
Part (day) Time Faculty
Part (Night)Time Faculty
55V.3 The Service Layer-Analyzing Services
(Specifying the Method)
- 1. IDENTIFY PUBLIC VS PRIVATE METHODS.
- Â
- 2. DIVIDE OPERATIONS INTO THE BASE
(PRIMITIVE) - AND EXTENDED OPERATIONS.
- Â
- 3. DETERMINE THAT THE OPERATIONS CAN BE
INHERITED IN WHOLE OR IN PART FROM A CLASS
ALREADY IN THE SYSTEM. -
- 4. DEVELOP A SPECIFICATION FOR EACH METHOD.
56V.4 The Attribute Layer-Analyzing Attributes
- Points to consider.
- Â
- Each attribute represents a single meaningful
fact pertinent to, and necessary for all
instances of that object class. - 2. Every attribute has a specific domain, the
set of legal values and instances of the object
class may assume. - Every attribute must be normalized with respect
to the object class. -
-
57V. The Subject Layer
- This layer provides a means of dividing a complex
specification into logical work units.
58VI. OOD (OBJECT-ORIENTED DESIGN)-Four Components
- The Problem Component.
- Reuse Design
- Implementation Structure
- Language Accommodation
- Â
- 2. The Human Interface Component-GUI .
- Â
- 3. The Data Management Component (DMC).
-
- 4. The Task Component (TMC).
- DMC TMC are closely related.
59User Interface
Customer
Input processing
Customer commands
Status Display
Output Processing
Affiliated Bank
Bank account OK
Dispense Cash Print Receipt Eject Card
Cash Machine
ATM
Account OK
Bank Consortium
Control and System Management
60Object-Oriented Preliminary Design
- Five components
- At the center of the architecture represents the
essential core of the system which has been
defined during analysis phase. - Input processing- translating incoming real-world
events and data into a form usable by the
essential core. - Output processing- translating outgoing data and
event from the essential core into a form usable
by the real world.
61Object-Oriented Preliminary Design
- Control and system management- providing internal
computational support services to the essential
core. - 5. User interface- provides interface between
the user and the system. Two kinds
person-computer interfaces and system-to-system
interfaces
62Object-Oriented Detail Design
- Data Structure Design OODBMS
- Procedure Structure Design-Algorithm
- Performance Optimization-Fine-tuning
process-combining objects to reduce
communications or splitting objects when
computing resources are fragmented.
63Summary Object-Oriented Design
SELECT AN APPROPRIATE ARCHITECTURE TO IMPLEMENT
THE SYSTEM. THE DESIGN IS A MAPPING OF THE
SPECIFICATION. 1. HOW IS DATA ORGANIZED
AND STORED? OPTIMIZE ACCESS PATHS TO
DATA. Â 2. DESIGN ALGORITHMS TO IMPLEMENT
OPERATIONS. 3. ADJUST
CLASS STRUCTURE TO INCREASE INHERITANCE. Â 4.
HOW ARE PROCESSES GENERALIZED TO MAXIMIZE
REUSE? Â 5. PACKAGE CLASSES AND ASSOCIATIONS
INTO MODULE.
64 USER INTERFACES
MS WINDOWS RESOURCES-- USED TO MANAGE WINDOWS AND
USER-DEFINED OBJECTS DEFINED IN A TEXT FILE
CALLED A RESOURCE SCRIPT. THEY ARE COMPILED THRU
A UTILITY CALLED THE RESOURCE COMPILER AND LINKED
WITH THE WINDOW APPLICATIONS. Â 1. ICONS AND
CURSORS 2. MENUS 3. DIALOG BOXES 4. FONTS 5.
BITMAPS 6. CHARACTER STRINGS 7. USER-DEFINED
RESOURCES 8. KEYBOARD ACCELERATORS
65USER INTERFACES
TWO POPULAR GUI'S-- MICROSOFT WINDOWS AND
MACINTOSH (IMAC, POWERMAC) TOOLBOX. GUIS PROVIDE
AN API (APPLICATION PROGRAMMING INTERFACE)
TO Â 1. CREATE SCREEN OBJECTS 2. DRAW SCREEN
OBJECTS 3. MONITOR MOUSE ACTIVATION Â TO CREATE
SCREEN OBJECTS, THE DEVELOPER DEFINES A
CLASS SPECIFYING THE NECESSARY PROPERTIES.
INSTANCES OF THE WINDOW CLASS CAN THEN BE
CREATED. TO COMMUNICATE WITH INSTANCES OF A
WINDOW CLASS, MESSAGES ARE SENT AND RECEIVED BY
A SPECIAL FUNCTION CALLED THE WINDOW FUNCTION.
66OBJECT-ORIENTED DATABASES
1. WHY? OODBMS Â 2. OODBMS FUNCTIONALITY
3. OODBMS VS RELATIONAL DB Â 4. OBJECT SQL
EXAMPLES Â
67WHY? OBJECT-ORIENTED DATABASES
1. SERVING AS AN INTEGRATOR IN THE INTEGRATED
ENVIRONMENT, OODBMS PROVIDES SHARING OF
DATA AND INFORMATION ACROSS COMPONENTS,
PRODUCTS, AND COMPUTING ENVIRONMENT. Â 2.
PROVIDING PERMANENT STORAGE FOR OBJECTS-
PERSISTENCE. 3. HANDLING
COMPLEX DATA STRUCTURES AND ABSTRACT DATA
TYPES.
68 OODBMS VS RELATIONAL DB
RELATIONAL
OODBMS -------------------------
--------------------------------------------------
------------------ CONSTRUCT DATA STRUCTURE
DATA STRUCTURE
BEHAVIOR ------------------------------
--------------------------------------------------
-------------- STRUCTURE TABLES
APPLICATION-DEFINED
INHERITANCE
AGGREGATION
ASSOCIATION ------------------------
--------------------------------------------------
-------------------- ACCESS SQL
METHODS
OBJECT SQL ---
69OBJECT SQL EXAMPLE
FIND NAMES OF ALL STUDENTS LESS THAN 25 YEARS
OLD...
SELECT S.STUNAME
FROM STUDENT S WHERE
S.AGE lt 25
USING METHODS Â
SELECT S.STUNAME FROM STUDENT
S WHERE S.GETAGE () lt 25
70OBJECT SQL EXAMPLE
FIND NAMES OF PARTS THAT ARE ON ORDER.
SELECT P-gt PARTNAME () FROM
PART P WHERE P -gt
QTYONORDER() gt 0
FIND NAMES OF PARTS THAT
ARE ON ORDER AND COST lt 10 Â
SELECT P.PARTNAME() FROM PART
P WHERE P.COST () lt 10
71FEATURES OF OOP SYSTEMS
1. CLASS LIBRARY OF REUSABLE
DATATYPES. 2. INHERITANCE OF
VARIABLES AND METHODS. Â 3. EARLY OR
DELAYED BINDING OF METHODS BASED ON
TYPES. Â 4. IMPLICIT/EXPLICIT STORAGE
DEALLOCATION (GARBAGE
COLLECTION) Â 5. EXPLICIT REPRESENTATION OF
STATE FOR VARIABLES (PRIVATE/PUBLIC/PROT
ECTED). Â 6. METHODS ASSOCIATED WITH
CLASSES
72 FEATURES OF OOP ENVIRONMENT
1. INTEGRATED AND INTERACTIVE PROGRAMMING
ENV. 2. INCREMENTAL COMPILATION AND
EXECUTION Â 3. BROWSERS FOR CLASS AND
METHOD LIBRARIES 4. PROGRAMMING
BY MODIFICATION 5.
METALEVEL FACILITIES FOR BUILDING PROGRAMMING
TOOLS
73 OBJECT-ORIENTED PROGRAMMING LANGUAGES
1. FEATURES OF OOP SYSTEMS Â 2. FEATURES OF
OOP ENVIRONMENT 3. CLASSES IN C AND
EXAMPLES Â 4. INHERITANCE IN C AND
EXAMPLES Â 5. DYNAMIC BINDING IN C AND
EXAMPLES
74Current Directions
1. PROTOTYPES VS CLASSES Â 2. TOOLKITS,
FRAMEWORK AND VISUAL PROGRAMMING Â 3.
PERSISTENT OBJECTS AND DATABASES
75PROTOTYPE
PROTOTYPE SYSTEMS ALLOW CREATING CONCEPTS
FIRST. THEN GENERALIZING THEM BY SAYING WHAT
ASPECTS OF THE CONCEPT ARE ALLOWED TO VARY. Â
OBJECTS DELEGATE MESSAGES TO ONE ANOTHER,
THEREBY INHERITING METHODS OR VALUES
STORED IN OTHER OBJECTS.
76TOOLKITS/FRAMEWORK/VISUAL PROGRAMMING
TOOLKIT PROGRAM CONSTRUCTION BY
COMPOSING EXISTING PARTS. Â FRAMEWORK
PROGRAM CONSTRUCTION BY SPECIALIZING A LIBRARY
OF CLASSES. Â VISUAL PROGRAMMING
PROGRAM CONSTRUCTION BY DIRECT MANIPULATING
A VISUAL REPRESENTATION OF THE APPLICATION
DOMAIN.
77FRAMEWORK
- A set of classes that embodies an abstract
design for solutions to a family of related
problems - defined by Ralph Johnson Brian Foote, 1988
- Frameworks are not simply collections of
classes. Rather, frameworks come with rich
functionality and strong wired-in
interconnections between object classes that
provide an infrastructure for the developer
78FRAMEWORK
- Framework is not a complete application, only
part of one. Developers must extend a framework
to create an application, a process that is tied
closely to the way the framework is encapsulated - At the lowest level, some framework support
system-level functionality, while others support
network access, user interfaces or database
access. Microsoft Foundation classes (MFC) or
Javas Abstract Window toolkit (AWT) are examples
of frameworks at this level.
79SUMMARY
1. OBJECT-ORIENTED ANALYSIS IS AN APPROACH TO
UNDERSTANDING A PROBLEM DEMAIN. Â 2.
OBJECT-ORIENTED DESIGN IS REALLY AN
ARCHITECTURE. Â 3. THE TRANSITION TO DESIGN IS
THE SELECTION OF AN ARCHITECTURE AND A
MAPPING OF THE ANALYSIS INTO THE CHOSEN
ARCHITECTURE.