Objectoriented concepts - PowerPoint PPT Presentation

1 / 47
About This Presentation
Title:

Objectoriented concepts

Description:

The Utilisation Relationship (via Navigability) This class ... Introduces the concept of Navigability, ie. one class 'knows about' another class directly. ... – PowerPoint PPT presentation

Number of Views:100
Avg rating:3.0/5.0
Slides: 48
Provided by: CIS471
Category:

less

Transcript and Presenter's Notes

Title: Objectoriented concepts


1
Object-oriented concepts UML 2
  • LectureAdopting the O-O ParadigmIdentifying
    O-O Entities

2
The Object-Oriented Approach
  • Adopting the Object Paradigm

3
Key Players
  • Grady Booch (Booch Method, UML)
  • Bjarne Stroustrup (C)
  • Coad and Yourdon (OOA, OOD)
  • Rumbaugh , Blaha, Premerlani, Eddy and Lorensen
    (OMT, UML)
  • Jacobson, Christerson, Jonsson and Overgaard
    (OOSE, UML)
  • Wasserman, Pircher and Muller (OOSD)
  • NASA (GOOD)
  • European Space Agency (HOOD)
  • Jackson (JSD, OOJSD)
  • Wilfs-Brock (CRC)
  • Martin and Odell (Ptech)
  • Shlaer and Mellor (OOSA, OODLE)
  • Embley (OSA)
  • Coleman and Hayes (Fusion)
  • Etc. etc. etc. etc .

4
Categories of Analysis and Design
  • Structured Analysis and Design (eg. SSADM)
  • Data-Oriented Analysis and Design (eg. JSP)
  • Object-Oriented Analysis and Design (see later)

5
The Object Model
  • A conceptual framework, a specific way of
    thinking
  • Three stages in using O-O to model the
    world-OOA (Object-Oriented Analysis)OOD
    (Object-Oriented Design)OOP (Object-Oriented
    Programming)

6
Object-Oriented Analysis
  • Examines user requirements
  • Produces a model of the problem
  • Focus on classes rather than actual object
    instances
  • Initial stage prior to design
  • Analysis model feeds into design process

7
Object-Oriented Design
  • Provides solutions to the problem modelled during
    analysis
  • Follows on from the analysis process and feeds
    into the implementation stage
  • Uses notations to express the logical and
    physical models of the system
  • Concentrates on depicting both static and dynamic
    models

8
Object-Oriented Programming
  • Implements the design models as actual computer
    code
  • Utilises some or all of the principles employed
    by object-orientation
  • There are many O-O languages, not just Ceg.
    Eiffel, Smalltalk, Object Pascal, Simula
  • Some languages are Object-Based rather than
    Object-Oriented, eg. Ada

9
Object Model Elements
  • Abstraction
  • Encapsulation
  • Modularity
  • Hierarchy
  • Typing
  • Concurrency
  • Persistence

10
  • Characteristics of Object Orientation
  • Data abstraction
  • Encapsulation (information hiding)
  • Inheritance
  • Message passing
  • Polymorphism
  • Advantages of Object Orientation
  • Reusability
  • Extensibility
  • Modularity
  • Intuitiveness

11
Abstraction
  • Denotes the essential characteristics of an
    object
  • Crisply defined conceptual boundaries
  • Relative to the perspective of the viewer
  • Abstract classes and objects may not actually
    exist

12
Encapsulation
  • Aka Information hiding
  • Abstraction and Encapsulation are complementary
  • Compartmentalises the state and behaviour of
    classes and objects that need to be hidden from
    other classes and objects
  • Focus on the implementation of non-essential
    characteristics

13
Modularity
  • Partitioning into individual components to help
    reduce complexity
  • Achieved by the use of objects and classes
  • We require high cohesion (objects and classes)
    and loose coupling (relationships and message
    passing)

14
Hierarchy
  • The ranking or ordering of abstractions
  • Inheritance is hierarchical
  • Subclasses inherit from their superclasses
    (generalisation/specialisation relationship)
  • Other relationships can be hierarchical, eg.
    aggregation

15
Typing
  • Abstract Data Typing (ADT) (eg. char, int,
    float)
  • Classes are synonymous to data types
  • Both strong and weak typing is possible
  • Subclasses related by inheritance from the same
    superclasses are of a similar type. Static
    (early) and dynamic (Late) binding can then
    occur.

16
Concurrency
  • Multiple events happening at the same time
  • Objects are concurrent, they can live and operate
    at the same time (think about it!)
  • Objects co-operate and can be both currently
    active or inactive, but still continue to be
    concurrent

17
Persistence
  • A objects life cycle is dynamic. Instances are
    created, exist for a length of time then are
    destroyed
  • However, an object does have the capacity to
    persist, ie. remain in existence across space
    and time
  • Thus objects can exist longer than their creator
    and they can move within the address space within
    which they are created

18
Digging out Objects, Classes and Attributes
  • Look for Nouns, these provide classes, attributes
    and object instances (proper nouns)eg. The cat
    sat on the mat. Cat and Mat are classes A cat
    called Tiddles sat on a mat called
    Martin. Tiddles is an instance of class
    Cat Martin is an instance of class Mat A cat
    with 10 whiskers sat on a mat of length
    2m. Whiskers is an attribute of class Cat and
    has value 10 Length is an attribute of class
    Mat and has value 2m

19
Digging out Relationships and Behaviours
  • Look for Verbs, these provide insight into the
    relationships between classes/objects and the
    behaviours of classes/objectseg. The cat sat on
    the mat. Class Cat has an association
    relationship with class Mat by sitting on
    it. The cat, which is made up from a cat body,
    cat head, 4 cat limbs and a cat tail, sat on the
    mat. Class cat has a 11 aggregation
    relationship with classes Cat Body, Cat Head,
    Cat Tail and a 14 aggregation relationship
    with class Cat Limbs

20
Digging out Relationships and Behaviours
  • eg. The purring cat sat on the flying mat. To
    purr is a behaviour of the class Cat To fly is
    a behaviour of the class mat The tiger, which
    is a member of the cat family, sat on the rug,
    which is a kind of mat . Class Tiger inherits
    from the Cat class Class Rug inherits from the
    Mat class

21
The UML Method
  • Class Diagrams

22
Notation Components
  • There are two parts to the Class Diagram- 1. A
    graphical Class Diagram 2. Supporting textual
    Specifications
  • Both have Essential concepts and Advanced
    concepts

23
Graphical Class Diagrams
  • Represent the following O-O characteristics using
    various diagrammatical icons-

Parameterised ClassesClass UtilitiesInterfacesA
bstract ClassesConstraintsQualified
Associations Derived Associations Association
Classes
ClassesClass relationships RolesRelationship
NavigabilityVisibilityCompositionNotes
Advanced
Essentials
24
The UML Class
  • Icon for the Class is-

Appropriate name for the class Name
Class Name Attribute List Operation List
List of class attributes Name Type
List of class methods (behaviours) Name( )
25
Class Example
  • The Person Class

26
Class Relationships
  • There are four relationships modelled- Associa
    tions Inheritance Aggregation
    (has) Utilisation (uses)
  • Each relationship can be adorned with qualifying
    information (Descriptions, Cardinalities, Roles)

27
The Association Relationship
  • Has the following icon-

Qualifying Adornment
Role
Role
28
Association Example
Host
Attends Birthday Party
Guest
29
The Inheritance Relationship
  • Has the following icon-

This class ...
inherits ...
from this class
30
Inheritance Example
Party Person
DancingStamina Integer
Dance() GiveAPresent()
31
The Aggregation Relationship
  • Has the following icon-

This class ...
has a number of ...
this class
32
Aggregation Example
Party Person
DancingStamina Integer
Dance() GiveAPresent()
33
The Utilisation Relationship (via Navigability)
  • Introduces the concept of Navigability, ie. one
    class knows about another class directly.
    Utilisation occurs when this knowing about
    involves one class using another.
  • Navigability has the icon-

This class ...
knows about ...
this class
34
Utilisation Example
Uses
35
Cardinality Adornments
  • These consist of- 1 Exactly
    one N Unlimited number (ie. zero or
    more) 0 N Zero or more 1 N One or more 0
    1 Zero or one n m Specified range (eg.
    2 8) n m, x Specified range or exact
    number (eg. 2 8, 10)

36
Cardinality Example
Class B
Class G
1...N
1
Class A
01
Class C
01
24
Class D
Class F
5
Class E
37
Visibility Adornments
  • Used to indicate the interface of each class.
    Applied to both attributes and methods.
  • They consist of- Public access - Private
    access Protected access

38
Visibility Example
Uses
39
Composition Adornments
  • Indicates the method a class uses to contain
    another class. They are indicated on the
    Aggregation Relationship

Simple aggregation (containment by reference)
Composition, ie. Strongly owns its
parts (containment by value)
40
Composition Example
Host
Party
- Presents List
0 N
- Start Time Time - End Time Time
- ManageMusic() ReceivePresents() - TidyUp()
Organise() ControlMusic() CleanUp()
Party Person
1 N
- DancingStamina Integer
- Dance() GiveAPresent()
41
Use of Notes on Diagrams
  • Notes are attached to the various elements of the
    diagram to provide a textual annotation
  • Has the following icon-

this element
on ...
Annotation ...
42
Example of Using Notes
Host
Party
- Presents List
0 N
- Start Time Time - End Time Time
- ManageMusic() ReceivePresents() - TidyUp()
Organise() ControlMusic() CleanUp()
Party Person
- DancingStamina Integer
1 N
Hopefully, someone will come
- Dance() GiveAPresent()
43
Textual Specifications
  • Textual specifications are written for the
    following diagram elements- Classes Operati
    ons
  • Again, both Essential and Advanced concepts are
    covered

44
Class Specifications
  • The Class Specification elements we shall be
    concerned with are the following-Responsibiliti
    es A textual description of what the class
    represents and is responsible for in the
    systemAttributes list A list of the
    attributes contained in the classOperations
    list A list of the operations contained in the
    classVisibility How the class, its attributes
    and operations appear to other
    classsesCardinalities How the class scales with
    relation to other classes

45
Class Specification Example
  • Class CarResponsibilities Represents all
    vehicles which are considered a
    carAttributes Colour Private Engine
    Size Private Registration PrivateOperations
    Move() Public Stop() Public ShowReg() P
    ublic

46
Operation Specifications
  • The Operation Elements we shall be concerned with
    are the following-Qualification What the
    operation doesReturn class A reference to the
    class the operation returnsArguments List
    of formal argumentsVisibility How the
    operations appear to the other classes,
    therefore indicating the interface to the
    class

47
Operation Specification Example
  • Operation ShowReg()Qualification Provides an
    inquiring object with the Registration of the
    carReturn Class RegistrationArguments None
    requiredVisibility Public
Write a Comment
User Comments (0)
About PowerShow.com