Chapter 2 The ObjectOriented Paradigm and UML: An Overview - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

Chapter 2 The ObjectOriented Paradigm and UML: An Overview

Description:

Object-Oriented Design with Applications (Second Edition) by Grady Booch ... Acquaintance: arrow-headed line. Object keeps a reference to another object ... – PowerPoint PPT presentation

Number of Views:131
Avg rating:3.0/5.0
Slides: 29
Provided by: brahimm
Category:

less

Transcript and Presenter's Notes

Title: Chapter 2 The ObjectOriented Paradigm and UML: An Overview


1
Chapter 2 - The Object-Oriented Paradigm and
UML An Overview
CIS 476/566 Software Architecture and Design
Patterns
  • Dr. Brahim Medjahed
  • brahim_at_umich.edu

2
Outline
  • The Object-Oriented (OO) Paradigm
  • Software Model
  • UML (Unified Modeling Language)

3
Important
  • This is not an OO or UML course
  • Not a complete overview of OO and UML
  • Focus on the concepts we will use the most in
    this course
  • More detailed description
  • Object-Oriented Design with Applications (Second
    Edition) by Grady Booch
  • UML Distilled Third Edition by Martine Fowler,
    Addison Wesley

4
The Object-Oriented (OO) Paradigm
5
Object
  • Centered on the concept of object
  • An object is
  • Conceptual level set of responsibilities
  • Specification level set of methods (behaviors)
  • Implementation level code and data
  • Objects public interface set of methods
    callable by other objects

6
Class and Instance
  • Class defines the types of objects based on the
    responsibilities these objects have
  • Instance a particular example of a class (it is
    always an object
  • Instantiation the process of creating an
    instance of a class (i.e., object)

7
Inheritance
  • A class inherits from another class if it
    receives some or all of the qualities (e.g.,
    methods) of that class
  • Starting class base, super, parent, generalized
    class
  • Inheriting class derived, sub, child,
    specialized class

8
Visibility
  • For data and methods
  • Public anything can see it
  • Private only object from this class can see it
  • Protected only objects of this class and derived
    classes can see it

9
Visibility (contd)
  • A derived class can define its own new members,
    and redefine members of the parent class.
  • If a method, m1(), is redefined in derived class,
    then a message sent to an object, d_obj, of the
    derived class will cause the redefined m1 to be
    invoked.
  • A user of d_obj can send a message
    d_obj.Parentm1() to use m1() defined in the
    parent class.

10
Public and Private Derivation
11
Abstract and Concrete Class
  • Abstract Class defines what a set of related
    classes can do
  • Act as a placeholder for other classes
  • Concrete Class a class that implements a
    particular type of behavior for an abstract class
  • Derived from abstract classes

12
Polymorphism
  • Ability to refer to different derivations of a
    class in the same way, but getting the behavior
    appropriate to the derived class being referred
    to
  • Example class shape
  • Polymorphism enables the programmer to define
    different area methods for any number of derived
    classes, such as circles, rectangles and
    triangles. No matter what shape an object is,
    applying the area method to it will return the
    correct results.

13
Software Models
14
What is a Software Model?
  • A description (specification) of the software
    which
  • Abstracts out irrelevant detail
  • Presents the software using higher-level
    abstractions

15
Example
case mainState of initial send(I am
here) end Off case event of
on send(oa,5) next(On) end off
next(Off) end end On case event
of off next(Off) end done
terminate end end end
16
How Models are Used?
  • To detect errors and omissions in designs before
    committing full resources to full implementation
  • Through (formal) analysis and experimentation
  • Investigate and compare alternative solutions
  • To communicate with stakeholders
  • Clients, users, implementers, testers,
    documenters, etc.
  • To derive implementation

17
Characteristics of Good Software Models
  • Abstract Emphasize important aspects while
    removing irrelevant ones
  • Understandable Expressed in a form that is
    readily understood by observers
  • Accurate Faithfully represents the modeled
    system
  • Predictive Can be used to derive correct
    conclusions about the modeled system
  • Inexpensive Much cheaper to construct and study
    than the modeled system

18
The Unified Modeling Language (UML)
19
What is UML?
  • Unified Modeling Language
  • The standard for software models in the
    object-oriented community
  • Visual defines a drawing notation with
    semantics
  • Has several types of diagrams to model the
  • Structure (e.g., Class Diagrams)
  • Behavior (Sequence Diagrams)

20
UML Diagram Types
21
The Class Diagram
  • Shows the relationships between classes
  • Show the static features of the system and do not
    represent any particular processing

22
UML Class
  • Class name at the top
  • Attributes/properties in the middle
  • Methods/operations

Public - Private
Protected
23
Adding Comments to a UML Class
Contains GPA
24
Basic Notations
  • We will sometimes adopt GoF notations (page 363)
  • OMT (Object Modeling Techniques)
  • Not completely similar to UML
  • Abstract Classes Italicized
  • Inheritance triangle connecting a subclass to
    its parent
  • Aggregation relationship
  • Arrow-headed line with a diamond at the base
  • The arrow points to the class that is aggregated

25
Basic Notations (contd)
  • Composition Whole-part relationship
  • The whole has responsibility for the parts. If
    the whole is deleted, all the parts will be
    deleted as well.
  • Represented by a filled diamond at the base
  • Acquaintance arrow-headed line
  • Object keeps a reference to another object
  • Instantiation Which classes instantiate which
    others
  • Dashed arrow-headed line
  • Cardinality filled circle to mean more than once
  • Multiple objects are being referenced or
    aggregated

26
UML Sequence Diagrams
  • Models Interaction
  • Used to show interaction between the objects in
    sequential order.
  • UML 2.0 sequence diagram improved over UML
    version 1 in the area of modeling logic in
    sequences

27
Basic Notations
Object
28
Example
Registrar office
student
Register for class
Check prerequisite
Prerequisite meet
Check seating of class
Still room in the class
Tuition and fees
Write a Comment
User Comments (0)
About PowerShow.com