Software Architecture - PowerPoint PPT Presentation

1 / 31
About This Presentation
Title:

Software Architecture

Description:

Dr. Mohamed Fayad, J.D. Edwards Professor. Department of Computer ... Ternary. association. August 24, 2000. UNL CSE M.E. Fayad. L5-S13 OO Concepts-3. 13 ... – PowerPoint PPT presentation

Number of Views:37
Avg rating:3.0/5.0
Slides: 32
Provided by: fay6
Category:

less

Transcript and Presenter's Notes

Title: Software Architecture


1
Software Architecture Frameworks
  • Dr. Mohamed Fayad, J.D. Edwards Professor
  • Department of Computer Science Engineering
  • University of Nebraska, Lincoln
  • Ferguson Hall, P.O. Box 880115
  • Lincoln, NE 68588-0115
  • http//www.cse.unl.edu/fayad

2
Lesson 5 Object-Oriented Concepts-3
2
3
Lesson Objectives
  • Discuss UML Associations
  • Discuss UML aggregation
  • Understand UML- inheritance
  • Explore use case concepts
  • Understand How to identify UML
  • Artifacts

3
4
Associations
  • An association shows a two-way relationship
    between objects (instances) of two or more
    classes and requiring special implementation to
    ensure integrity.
  • A particular instance of an association is often
    called a link.
  • Associations between classes are required if the
    objects need to communicate.
  • Associations are often named, and have role-names
    for each side of the link.

4
5
More on Associations
Association Name
Person
Car
Vehicle Registration
model year of doors
name age address
registeredCar owner
Roles Names
5
6
More on Associations
  • Simple example
  • An association has a name and a numerical
    specification (multiplicity indication) of how
    many objects on one side of the association are
    connected with how many objects on the other
    side.
  • Associations are called use relationships even
    if this may seem somewhat cheeky in the example
    below

displays
0..
Window
GeomFigure
employs
0..
6
Company
Person
Employer
Employee
7
More on Associations
  • Associations are directed (one way),
    bidirectional, and undirected.
  • UML makes no distinction between bidirectional
    and undirected associations.

Multiplicity
Stereotype RelationName Constraints

7
Class1
Class2
role1
Role2 interface
8
More on Associations
  • Recursive association A class has a relation
    with itself.
  • It is also possible to model associations that
    are valid only temporarily stereotype or
    temporary
  • Constraints may be used to restrict the relation
    under specific aspects.
  • A role name describes how the object is seen by
    the opposite object in the association.
  • An association can be described in more detail by
    means of constraints, tagged values, and
    stereotypes.
  • Stereotypes are noted before or above the
    relation name, constraints, and tagged values
    after or below the name.

8
9
More on Associations
  • Directed association is a one-way association, in
    which one side knows the other, but not vice
    versa.
  • Multiplicity Specification
  • 1 exactly one
  • 0, 1 zero or one
  • 0..4 between zero and four
  • 3, 7 either three or seven

9
10
More on Associations
  • More multiplicity specifications
  • 0.. greater than or equal to zero (default)
  • ditto
  • 1.. greater than or equal to one
  • 0..3, 7, 9.. between zero and three, or exactly
    seven, or greater than or equal to
    nine.

10
11
More on Associations
  • Recursive associations are associations in which
    one class is involved.

has
Patient
Employee name staffNo roomNo
office clerk
relative


1
Person
manager
leads
11
reports to
12
N-ary Association
  • An n-ary association is like a common (binary)
    association, except that more than two
    association roles involved in it.

N-ary association
Class1
Class2
Ternary association
12
Class3
13
More on n-ary Association
Reservation
Seat
Train
1..
1
carriageNo seatNo
date trainNo
1..
Passenger
name title
Ternary association
13
14
More on Associations
  • Recursive Associations
  • N-ary Associations
  • Attributed Associations (Association Class)
  • Association Constraints
  • Qualified Associations
  • Derived Associations
  • Directed Associations
  • Ordered Associations
  • Realization/Refinements
  • Dependency

14
15
More on Associations
  • Associations are usually bidirectional
  • Allows each object involved in the relationship
    to refer to the object to which it is related.
  • Bidirectional association means at the
    relationship has an inverse.
  • Associations do not have to be bidirectional.

15
16

Man
Woman
Association Type One-to-One One-to-Many (One-t
o-Zero-or-More) Many-to-Many Zero or One
Marriage
husband wife
Screen
Window
Windows
Nets
User
Authorization
Car
Trailer
16
17

Association Type Specified the of instances
on the many side Specify the possible
of instances using or Ternary relationship
Square
Line
Sides
Secure Room
Person
Occupants
TraditionalFamily
Male
Female
father mother children
17
Child
18
Association Class
Server
Client
Connection
Connection
baudRate protocol wireType disconnect rerouteLink
These attributes dont belong in either the
Client or Server class. They are attributes of
the connection itself.
18
The association class can have behaviors as
well as attributes.
19
Aggregation Composite
  • Aggregation is a special form of association.
  • Aggregation is used when the relationship is
    part/whole or contains/is-part-of
  • Aggregation is transitive and operations on
    whole often cascade down to parts.

19
20
Aggregation Composite
Computer
Server
Aggregation
whole part
52

CPU
Disk Drive
Client
Keyboard
Mouse
20
21
Aggregation Composite
  • Special diamond symbol used on whole side to
    indicate aggregation.
  • Aggregation is an anti-symmetric that is, if A is
    part of B, then B is not part of A.
  • DO NOT confuse aggregation with generalization
  • An essential property of aggregates is that the
    whole acts as a proxy for its parts.
  • A composition is a strict form of aggregation, in
    which the parts are existence-dependent on the
    entirely

21
22
Aggregation Composite
Aggregation
Part
Entirely
Composition
Existence- DependentPart
22
23
Aggregation Problem
  • Mr. Clintons hand is part-of Mr. Clinton Mr.
    Clinton is part-of U.S.A.
  • Therefore
  • Mr. Clintons hand is part-of U.S.A.

23
24

Keypad
Cash Register Example

Total Key
Subtotal Key
Number Keys
display
display
display
drawer
Drawer
Display
24
25
Attributes
  • Attributes are simply the information associated
    with the object.
  • The data type used to hold the attributes is
    often a fundamental type, such as int or char.
  • Sometimes the attribute can be a non-fundamental
    type, such as String type and Address type.
  • Avoid using attributes which might be better
    implemented as an association to a new class.

25
26
More on Attributes
  • For example
  • x

Using Association
Using Attributes
TV
TV
Manufacturer
String model String serialNum String manName
String model String serialNum
String name Address address
product manu- facturer
  • Why? Using an association to a Manufacturer
    class, the name and address of each manufacturer
    will be stored in one place rather than in each
    of the TV objects made by that manufacturer.

26
27
More on Attributes
  • If attributes only make sense in some instances
    of a given class but not in others. It will make
    sense to split the single class into two classes
    or more.

Employee
String name float salary
Employee
Split into two classes
String name float salary long clearanceNum
inheritance
ClearedEmployee
27
long clearanceNum openVault()
Ā Not all employees have clearances
28
Inheritance
  • When a relationship exists between classes such
    that lower-level classes (called subclasses)
    share certain attributes and behaviors which can
    be defined once in a higher-level class (called
    superclasses).
  • Subclasses inherit properties (attributes and
    behaviors) of its superclass and then adds its
    own unique properties and modifies any inherited
    properties.
  • This is called Generalization or Inheritance.

28
29
More on Inheritance
Window
paintWindow
size icon
bitmaps
textWindow
contents
29
30
Aggregation vs. Inheritance
Aggregation Inheritance Instances of distinct
classes Instances of a single class a-part-of
(APO) a-kind-of or is-a (AKO) Contains s
uperclass-of Aggregate parts Superclass
subclass and relationship or
relationship Propagated only if
specified Inheritance
30
31
Discussion Questions
  • What are the other terms for attributes
    operations?
  • Define an object and a class in UML
  • What is an association? Give examples
  • Associations are usually bidirectional. Please
    describe.
  • Describe the basic difference between aggregation
    and inheritance. What do they have in common?
  • What do you think multiple inheritance means?
  • Which type of association is more likely to yield
    savings in the amount of code required for
    implementation? why?
  • Define the process of identifying objects,
    classes, inheritance, associations aggregation,
    attributes, and behaviors
  • Define Polymorphism with examples
  • What do we mean by saying Model/View/Controller?

31
Write a Comment
User Comments (0)
About PowerShow.com