itec315_lecture 9 about object oriented analysis and design
2. 2
Object-Oriented Analysis and Design with the Unified Process
Objectives
Explain how statecharts can be used to describe
system behaviors
Use statecharts to model system behavior and
method logic
Explain the importance of design patterns in object-
oriented design
Briefly describe and use the singleton, adaptor, and
observer design patterns
3. 3
Object-Oriented Analysis and Design with the Unified Process
Objectives (continued)
Explain why enterprise-level systems require special
design consideration
Apply UML deployment architectural notation to
Web-based systems
Explain how Web services work to obtain
information on the Internet
4. 4
Object-Oriented Analysis and Design with the Unified Process
Overview
Model system and object behavior
Statecharts
Protect and stabilize systems
Protection from variations and indirection
Establish best practices in system construction
Design patterns, or templates
Design for enterprise-level and Web-based systems
Distributed and networked environments
5. 5
Object-Oriented Analysis and Design with the Unified Process
Modeling System Behavior and
Method Logic with Statecharts
Statecharts were used in the requirements discipline
to capture status conditions of objects
Statecharts are used in the design discipline to
Define the behavioral constraints of the system
classes created during design
◘Windows menus, authentication and security classes,
error-handling classes
Describe the method logic within class methods
◘Action-expressions contain information that help
define method logic
6. 6
Object-Oriented Analysis and Design with the Unified Process
System-level Statecharts
Designate the states and processing controls of a
system
Which menu items are enabled or disabled
Which windows are modal
Which tool bars and icons are active
Document possible options presented to users
Use state variables to record the value of the
current state
8. 8
Object-Oriented Analysis and Design with the Unified Process
Messages, Transitions, and
Methods
A message causes a transition to fire
A transition in a statechart is the execution of a
method
A method signature is defined by the message to a
destination object
Action expressions in a statechart define method
logic
Describes the actions to be performed during a
transition
9. 9
Object-Oriented Analysis and Design with the Unified Process
Figure 9-2
Comparison of methods, messages, and transitions
10. 10
Object-Oriented Analysis and Design with the Unified Process
Action-expressions and Method
Logic
A sequence diagram may not contain enough
internal details about a method
Design statecharts extend requirements statecharts
Action-expressions contain logic for later coding
Transitions that allow the object to remain in the
same state
Temporary states for inter-model consistency
Decision pseudostates to indicate decision points on
a paths
13. 13
Object-Oriented Analysis and Design with the Unified Process
Design Principles-Protection From
Variations
Parts of a system that are unlikely to change are
segregated from those that will
Drives the multilayer design pattern
Stable business logic can be protected from
variations in the user interface
Changes in the business logic are isolated to the
controller class
14. 14
Object-Oriented Analysis and Design with the Unified Process
Design Principles-Indirection
Indirection is an implementation of the protection
from variations principle
Decouples classes or other system components by
placing an intermediate classes between them
Used in many corporate security systems between
an internal network and the Internet
A proxy server catches all incoming messages and
redistributes them to the recipients
15. 15
Object-Oriented Analysis and Design with the Unified Process
Importance of Design Patterns
Standard design templates can speed OO design
Patterns can exist at different levels of abstraction
At the most concrete level, a class definition with
code
At the most abstract level, an approach to a problem
Patterns should contain five main elements
Pattern name, problem, solution, example, benefits
and consequences
17. 17
Object-Oriented Analysis and Design with the Unified Process
Basic Design Patterns
The authors of Elements of Reusable Object-
Oriented Software (referred to as the Gang of
Four) developed a basic classification scheme for
patterns (Figure 9-7)
The 23 GoF patterns are some of the most
fundamental and important patterns in use
Scores of other patterns have been defined
For example, both Java and .NET have sets of
enterprise patterns
19. 19
Object-Oriented Analysis and Design with the Unified Process
Singleton Pattern
For classes that must have only one instance, but
need to be invoked from several classes and
locations within the system
The class itself controls the creation of only one
instance
A static variable of the class refers to the object
that is created
A class method instantiates the object on the first
call, and returns a reference to the object on
subsequent calls
21. 21
Object-Oriented Analysis and Design with the Unified Process
Adaptor Pattern
Plugs an external class into a system
Converts the method calls from within the system to
match the method names in the external class
A standard solution for protection from variations
Insulates the system from frequently changing
classes
An interface is frequently used to specify and
enforce the use of correct method names
23. 23
Object-Oriented Analysis and Design with the Unified Process
Observer pattern
Used to handle event-processing and reduce
coupling
The domain class
Allows other classes to “subscribe” as listeners
“Publishes” the changes to the listeners
The windows class
Sends a reference of itself to subscribe as a listener
Implements the method to be invoked when
notified
◘Inherits the method from the listener interface
27. 27
Object-Oriented Analysis and Design with the Unified Process
Designing Enterprise-level
Systems
Enterprise-level systems share components among
multiple people or groups in an organization
Enterprise-level systems almost always use
multiple tiers of computers
Can be client/server network-based or Internet
based
Designed with deployment diagrams
A type of implementation diagram that shows
physical components across different locations
28. 28
Object-Oriented Analysis and Design with the Unified Process
Figure 9-14
Differences between client/server and Internet systems
29. 29
Object-Oriented Analysis and Design with the Unified Process
UML Notation for Deployment
Diagrams
Component
Executable module or program
Has an application program interface (API) that is
available to the outside world
Node
A physical entity at a specific location
Frameset
A high-level object that holds items to be displayed
by a browser
31. 31
Object-Oriented Analysis and Design with the Unified Process
Figure 9-16
UML node notation
Figure 9-17
UML extension for
frameset
32. 32
Object-Oriented Analysis and Design with the Unified Process
Simple Internet Architecture
Used for viewing static information
The browser component executes on the client
computer
The Internet server component executes on the
server computer
Pages reside on the server and are sent to the
browser for display
Program logic is inserted through scripting
languages, applets, or other controls
34. 34
Object-Oriented Analysis and Design with the Unified Process
Two-layer Architecture
Primarily captures information from the user and
updates the database
The domain layer and data access layer are usually
combined
Input data is sent to a CGI or an application server
The user-interface classes often contain the
business logic and data access
Processing takes place with servlets (Java) or code
behind classes (.NET)
36. 36
Object-Oriented Analysis and Design with the Unified Process
Three-layer Architecture
Separates domain layer and data access layers
Necessary for systems with complex business logic
or multiple user interfaces
Using CGI
Provide a use case controller for each form
Using an application server
Java tools: Java Server Pages and servlets
.NET tools: Common Runtime Language and code
behind classes
38. 38
Object-Oriented Analysis and Design with the Unified Process
Web Services
A program that provides a service via the Internet
The service is posted in a directory so that systems
can find it
Requests for information go to the UDDI directory
UDDI provides the Internet address of a program
offering that service
The application then requests the information
All communication is based on XML to allow for
generic data exchange
40. 40
Object-Oriented Analysis and Design with the Unified Process
Summary
Design statecharts
Specify precise behavior and constraints of the
various portions of the final system
Describe the method logic within an object
Good design is based on two factors
Good principles
Standard design patterns
41. 41
Object-Oriented Analysis and Design with the Unified Process
Summary (continued)
Protection from variations
Separates components that are likely to change
Indirection
Intermediate class provides an interface between
elements
Design pattern examples
Singleton
Adaptor
Observer