SEG4110 Advanced Software Design and Reengineering - PowerPoint PPT Presentation

1 / 52
About This Presentation
Title:

SEG4110 Advanced Software Design and Reengineering

Description:

SEG4110 - Topic A- Review of UML. 3. Classes ... A Car's Automatic Transmission. A state diagram can be nested inside a state. ... – PowerPoint PPT presentation

Number of Views:36
Avg rating:3.0/5.0
Slides: 53
Provided by: timothyle
Category:

less

Transcript and Presenter's Notes

Title: SEG4110 Advanced Software Design and Reengineering


1
SEG4110 Advanced Software Design and
Reengineering
  • TOPIC A
  • Review of UML

2
5.1 What is UML?
  • The Unified Modelling Language is a standard
    graphical language for modelling object oriented
    software
  • At the end of the 1980s and the beginning of
    1990s, the first object-oriented development
    processes appeared
  • The proliferation of methods and notations tended
    to cause considerable confusion
  • Two methodologists Rumbaugh and Booch merged
    their approaches in 1994.
  • They worked together at the Rational Software
    Corporation
  • In 1995, another methodologist, Jacobson, joined
    the team
  • His work focused on use cases
  • In 1997 the Object Management Group (OMG) started
    the process of UML standardization

3
Classes
  • A class is simply represented as a box with the
    name of the class inside
  • The diagram may also show the attributes and
    operations
  • The complete signature of an operation is
  • operationName(parameterName parameterType )
    returnType

4
Naming classes
  • Use capital letters
  • E.g. BankAccount not bankAccount
  • Use singular nouns
  • Use the right level of generality
  • E.g. Municipality, not City
  • Make sure the name has only one meaning
  • E.g. bus has several meanings

5
Labelling associations
  • Each association can be labelled, to make
    explicit the nature of the association

6
Analyzing and validating associations
  • Many-to-one
  • A company has many employees,
  • An employee can only work for one company.
  • This company will not store data about the
    moonlighting activities of employees!
  • A company can have zero employees
  • E.g. a shell company
  • It is not possible to be an employee unless you
    work for a company

worksFor
1
Employee
Company

7
Analyzing and validating associations
  • Many-to-many
  • A secretary can work for many managers
  • A manager can have many secretaries
  • Secretaries can work in pools
  • Managers can have a group of secretaries
  • Some managers might have zero secretaries.
  • Is it possible for a secretary to have, perhaps
    temporarily, zero managers?

8
Analyzing and validating associations
  • One-to-one
  • For each company, there is exactly one board of
    directors
  • A board is the board of only one company
  • A company must always have a board
  • A board must always be of some company

9
Analyzing and validating associations
  • Avoid unnecessary one-to-one associations
  • Avoid this do this

10
Association classes
  • Sometimes, an attribute that concerns two
    associated classes cannot be placed in either of
    the classes
  • The following are equivalent

11
Reflexive associations
  • It is possible for an association to connect a
    class to itself

12
Directionality in associations
  • Associations are by default bi-directional
  • It is possible to limit the direction of an
    association by adding an arrow at one end

13
Object Diagrams
  • A link is an instance of an association
  • In the same way that we say an object is an
    instance of a class

14
An Example Inheritance Hierarchy
  • Inheritance
  • The implicit possession by all subclasses of
    features defined in its superclasses

15
The Isa Rule
  • Always check generalizations to ensure they obey
    the isa rule
  • A checking account is an account
  • A village is a municipality
  • Should Province be a subclass of Country?
  • No, it violates the isa rule
  • A province is a country is invalid!

16
Inheritance, Polymorphism and Variables
17
Avoiding unnecessarygeneralizations
Inappropriate hierarchy of classes, which should
be instances
Improved class diagram, with its
corresponding instance diagram
RecordingCategory
RecordingCategory
video
audio
subcategory
subcategory
subcategory
subcategory
subcategory
RecordingCategory
RecordingCategory
RecordingCategory
RecordingCategory
RecordingCategory
rock
blues
classical
jazz
music video
Recording
Recording
Let it be
9th Symphony
The Beatles
Beethoven
18
Avoiding having instances change class
  • An instance should never need to change class

19
5.6 More Advanced Features Aggregation
  • Aggregations are special associations that
    represent part-whole relationships.
  • The whole side is often called the assembly or
    the aggregate
  • This symbol is a shorthand notation association
    named isPartOf

20
Composition
  • A composition is a strong kind of aggregation
  • if the aggregate is destroyed, then the parts are
    destroyed as well
  • Two alternatives for addresses

21
Interfaces
  • An interface describes a portion of the visible
    behaviour of a set of objects.
  • An interface is similar to a class, except it
    lacks instance variables and implemented methods

22
Introduction to OCL
23
Use Case Diagrams
24
Example of generalization, extension and inclusion
25
Example Description of a Use Case
26
Sequence diagrams an example
27
Sequence Diagrams an example with replicated
messages
  • An iteration over objects is indicated by an
    asterisk preceding the message name

28
Sequence Diagrams an example with object
deletion
  • If an objects life ends, this is shown with an X
    at the end of the lifeline

29
State Diagrams an Example of Transitions with
Time-outs and Conditions
30
State Diagrams Example with Conditional
Transitions - CourseSection class
Planned
openRegistration
closeRegistration
requestToRegister (aStudent)
OpenNotEnoughStudents
Cancelled
cancel
/createRegistration
classSize gt minimum
cancel
closeRegistration
requestToRegister (aStudent)
Closed
OpenEnoughStudents
classSize gt maximum
/createRegistration
31
State Diagram An Example with Substates
CourseSection Class Again
32
State Diagram an Example with Actions Garage
Door Opener
33
Nested Substates and Guard Conditions A Cars
Automatic Transmission
  • A state diagram can be nested inside a state.
  • The states of the inner diagram are called
    substates.

selectReverse
Reverse
Neutral
selectNeutral
selectDrive
selectFirst
selectSecond
selectNeutral
reachThirdSpeed
reachSecondSpeed
driveSelected
driveSelected
dropBelowThirdSpeed
dropBelowSecondSpeed
driveSelected
selectFirst
selectSecond
34
Activity Diagrams An Example Course
Registration
35
Package Diagrams
36
Example of Multi-Layer Systems
37
Component Diagrams
38
An Example of a Distributed System
39
Example of a Broker System
40
Example of a Pipe-and-Filter System -Sound
Processing
41
Example of the MVC Architecture for a User
Interface
42
Example of the Service-Oriented Architecture
43
Abstraction-Occurrence
44
Abstraction-Occurrence
  • Square variant

45
General Hierarchy
46
Player-Role
47
Singleton
48
Observer
49
Delegation
50
Façade
51
Proxy
52
Deployment Diagrams
Write a Comment
User Comments (0)
About PowerShow.com