Object-oriented Design - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

Object-oriented Design

Description:

New use cases often generate new requirements as ... generating test cases. ... Class diagrams are static -- they display what interacts but not what happens ... – PowerPoint PPT presentation

Number of Views:45
Avg rating:3.0/5.0
Slides: 21
Provided by: cisF
Learn more at: http://www.cis.famu.edu
Category:

less

Transcript and Presenter's Notes

Title: Object-oriented Design


1
Object-oriented Design
2
Objectives
  • To explain how a software design may be
    represented as a set of interacting objects that
    manage their own state and operations
  • To describe the activities in the object-oriented
    design process
  • To introduce various models that can be used to
    describe an object-oriented design
  • To show how the UML may be used to represent
    these models

3
Topics covered
  • Objects and object classes
  • An object-oriented design process
  • Design evolution

4
Object-oriented development
  • Object-oriented analysis, design and programming
    are related but distinct.
  • OOA is concerned with developing an object model
    of the application domain.
  • OOD is concerned with developing an
    object-oriented system model to implement
    requirements.
  • OOP is concerned with realising an OOD using an
    OO programming language such as Java or C.

5
Characteristics of OOD
  • Objects are abstractions of real-world or system
    entities and manage themselves.
  • Objects are independent and encapsulate state and
    representation information.
  • System functionality is expressed in terms of
    object services.
  • Shared data areas are eliminated. Objects
    communicate by message passing.
  • Objects may be distributed and may execute
    sequentially or in parallel.

6
Interacting objects
7
Advantages of OOD
  • Easier maintenance. Objects may be understood as
    stand-alone entities.
  • Objects are potentially reusable components.
  • For some systems, there may be an obvious
    mapping from real world entities to system
    objects.

8
Objects and object classes
An object is an entity that has a state and a
defined set of operations which operate on that
state. The state is represented as a set of
object attributes. The operations associated with
the object provide services to other objects
(clients) which request these services when some
computation is required. Objects are created
according to some object class definition. An
object class definition serves as a template for
objects. It includes declarations of all the
attributes and services which should be
associated with an object of that class.
9
The Unified Modeling Language
  • Several different notations for describing
    object-oriented designs were proposed in the
    1980s and 1990s.
  • The Unified Modeling Language is an integration
    of these notations.
  • It describes notations for a number of different
    models that may be produced during OO analysis
    and design.
  • It is now a de facto standard for OO modelling.

10
Employee object class (UML)
11
UML associations
  • Objects and object classes participate in
    relationships with other objects and object
    classes.
  • In the UML, a generalised relationship is
    indicated by an association.
  • Associations may be annotated with information
    that describes the association.
  • Associations are general but may indicate that an
    attribute of an object is an associated object or
    that a method relies on an associated object.

12
An association model
13
An object-oriented design process
  • Structured design processes involve developing a
    number of different system models.
  • They require a lot of effort for development and
    maintenance of these models and, for small
    systems, this may not be cost-effective.
  • However, for large systems developed by different
    groups design models are an essential
    communication mechanism.

14
Object identification
  • Identifying objects (or object classes) is the
    most difficult part of object oriented design.
  • There is no 'magic formula' for object
    identification. It relies on the skill,
    experience and domain knowledge of system
    designers.
  • Object identification is an iterative process.
    You are unlikely to get it right first time.

15
A use case is a summary of scenarios for a single
task or goal. An actor is who or what initiates
the events involved in that task. Actors are
simply roles that people or objects play. The
picture below is a Make Appointment use case for
the medical clinic. The actor is a Patient. The
connection between actor and use case is a
communication association (or communication for
short).
  • determining features (requirements). New use
    cases often generate new requirements as the
    system is analyzed and the design takes shape.
  • communicating with clients. Their notational
    simplicity makes use case diagrams a good way for
    developers to communicate with clients.
  • generating test cases. The collection of
    scenarios for a use case may suggest a suite of
    test cases for those scenarios

16
A Class diagram gives an overview of a system by
showing its classes and the relationships among
them. Class diagrams are static -- they display
what interacts but not what happens when they do
interact.
17
  • association -- a relationship between instances
    of the two classes. There is an association
    between two classes if an instance of one class
    must know about the other in order to perform its
    work. In a diagram, an association is a link
    connecting two classes.
  • aggregation -- an association in which one class
    belongs to a collection. An aggregation has a
    diamond end pointing to the part containing the
    whole. In our diagram, Order has a collection of
    OrderDetails.
  • generalization -- an inheritance link indicating
    one class is a superclass of the other. A
    generalization has a triangle pointing to the
    superclass. Payment is a superclass of Cash,
    Check, and Credit.

18
Packages and object diagrams To simplify complex
class diagrams, you can group classes into
packages. A package is a collection of logically
related UML elements. The diagram below is a
business model in which the classes are grouped
into packages.
19
A sequence diagram is an interaction diagram that
details how operations are carried out -- what
messages are sent and when. Sequence diagrams are
organized according to time. The time progresses
as you go down the page. The objects involved in
the operation are listed from left to right
according to when they take part in the message
sequence.
20
Collaboration diagrams are also interaction
diagrams. They convey the same information as
sequence diagrams, but they focus on object roles
instead of the times that messages are sent. In a
sequence diagram, object roles are the vertices
and messages are the connecting links.
Write a Comment
User Comments (0)
About PowerShow.com