Elizabeth Bigelow - PowerPoint PPT Presentation

About This Presentation
Title:

Elizabeth Bigelow

Description:

characterized by the actions that it suffers and that it requires of ... Acquaintance (or association) implies that an object merely knows of another object. ... – PowerPoint PPT presentation

Number of Views:44
Avg rating:3.0/5.0
Slides: 22
Provided by: SCS6
Learn more at: http://www.cs.cmu.edu
Category:

less

Transcript and Presenter's Notes

Title: Elizabeth Bigelow


1

UML Part II -- Structural Modeling
  • Elizabeth Bigelow
  • School of Computer Science
  • Carnegie Mellon University

2
Whats a class?
  • Description of a set of objects that share the
    same attributes, operations, relationships, and
    semantics. A class implements one or more
    interfaces.
  • Well structured classes have clear boundaries and
    form part of a balanced distribution of
    responsibilities across the system.

3
Whats an object?
  • An entity
  • which has state
  • characterized by the actions that it suffers and
    that it requires of other objects
  • is an instance of some class
  • denoted by a name
  • restricted visibility of and by other objects
  • may be viewed either by its specification or by
    its implementation

4
Systems Designed in O-O
  • Exhibit characteristics different from those
    designed in functional manner
  • Large o-o systems tend to be built in layers of
    abstraction, each layer denoting a collection of
    objects and classes of objects with restricted
    visibility to other layers
  • Collections are called subsystems
  • Elements of a subsystem tend to be flat rather
    than hierarchical and deeply nested

5
Canonical Structure of Large O-O System
6
Flow of Control
  • Global flow of control is different from
    functionally decomposed system
  • Often cannot identify a central thread of
    control!
  • Subprogram calls are often very deeply nested

7
Methods
  • Denotes the response by an object to a message
    from another object
  • Classes of operations
  • constructor (alters state of an object)
  • selector (evaluates current state)
  • iterator (permits all parts of an object to be
    visited)

8
Classes of Objects
  • Actor, Agent or Server
  • depends on how relates to surrounding objects
  • actor only acts on other objects
  • server suffers operations but may not operate on
    other objects
  • agent performs task on behalf of another object

9
Very Important Property
  • Each object is a unique instance of some class.
  • Alternatively, a class denotes a set of similar
    but unique objects.
  • Example class of Window from which we
  • create instances or objects. Operations defined
  • for class, but only have effect on object.

10
Class
  • Specifies objects internal data and
    representation defines operations it can perform
  • Objects are created by instantiating a class.

11
Terms and Concepts
  • Names
  • Attributes
  • Operations
  • Responsibilities

12
Class Inheritance
  • New classes can be defined in terms of existing
    classes using class inheritance.
  • When a subclass inherits from a parent class, it
    includes the definitions of all the data and
    operations that the parent class defines.

13
Inheritance
Parent Class
Operation
Subclass
14
Example of Inheritance
15
(No Transcript)
16
(No Transcript)
17
Class versus Type
  • Objects class defines how the object is
    implemented (internal state and implementation of
    operations)
  • Objects type only refers to its interface--the
    set of requests to which it can respond
  • Can an object have many types?
  • Can objects of different classes have the same
    type?

18
Aggregation
  • Aggregation implies that one object owns or is
    responsible for another. (having or being part of
    another object) gt identical lifetimes!
  • Acquaintance (or association) implies that an
    object merely knows of another object. May
    request operations of each other but are not
    responsible for one another. (looser coupling)

19
Aggregation Types
  • Aggregations can be fixed,variable or recursive
    (read diamond as is made up of
  • .

20
Model Goals
  • Communication
  • Expression of graphical constraints
  • Abstraction
  • Reasoning

21
Constraints
  • Functional relationships between entities of an
    object model (objects, classes, attributes, links
    and associations)
  • Restriction of values that entity can assume

1
Employee
Member-of
1 1
salary lt boss.salary
Person
Committee
Salary

Chair-of
Write a Comment
User Comments (0)
About PowerShow.com