1/26
On-demand Learning Series
Software Engineering of Web Application
- Object-Oriented Development & UML
Hunan University, Software School
2/26
1.1 An object has behaviors In old style programming, you had:
data, which was completely passive functions, which could manipulate any data
An object contains both data and methods that manipulate that data (Encapsulation) An object is active, not passive; it does things An object is responsible for its own data
Information Hiding But: it can expose that data to other objects
1 OO Introduction
3/26
1.2 An object has state An object contains both data and methods that manipulate that
data The data represent the state of the object Data can also describe the relationships between this object and
other objects
Example: A BankAccount might have A balance (the internal state of the account) An owner (some object representing a person)
1 OO Introduction
4/26
1.3 Example: A “Rabbit” object You could (in a game, for example) create an object
representing a rabbit It would have data:
How hungry it is How happy it is Where it is
And methods: eat, run, dig
1 OO Introduction
5/26
1.4 Classes describe objects
Every object belongs to (is an instance of) a class fields, or variables methods
A class is like a template, or cookie cutter
1 OO Introduction
6/26
1.5 Other Concepts Inheritance Polymorphism Message communication Access Control
1 OO Introduction
7/26
1.6 Object-oriented development Object-oriented analysis, design and programming are related but
distinct. OOA is concerned with developing an object model of the application
domain. OOD is concerned with developing an object-oriented system model
to implement requirements. OOP is concerned with realising an OOD using an OO programming
language such as Java or C++.
1 OO Introduction
8/26
1.7 Characteristics of OOD Objects are abstractions of real-world or system entities and manage
themselves. Objects are independent and encapsulate data and method. System functionality is expressed in terms of object services. Shared data areas are eliminated. Objects
communicate by message passing. Objects may be distributed and may execute
sequentially or in parallel.
1 OO Introduction
9/26
1.8 Advantages of OOD Easier maintenance. Objects may be
understood as stand-alone entities. Objects are potentially reusable components. For some systems, there may be an obvious
mapping from real world entities to system objects.
1 OO Introduction
10/26
2.1 The Unified Modeling Language Standard language for visualisation, specification, construction
and documentation of problems/solutions in a software-intensive system.
2 UML Introduction
11/26
2.2 What’s UML Not a software development process or methodology May be used in all processes/phases in the development
cycle, across different implementation technologies
2 UML Introduction
12/26
2.3 UML Concepts UML is used to:
Show main functions and boundaries in a system using use cases and actors.
Illustrate use case realisations using interaction diagrams. Represent a static structure of a system using class diagrams. Modelling object behaviour using state diagrams. Show implementation of the physical architecture using component and
deployment diagrams. Enhance the functionality using stereotypes.
2 UML Introduction
13/26
2.4 Use UML: Diagram Type Structure Diagram (Static)
Class Diagram(Object Diagram) Component Diagram Deployment Diagram
Behavior Diagram (Dynamic) Use case Diagram Sequence Diagram Collaboration Diagram State chart Diagram Activity Diagram
2 UML Introduction
14/26
2.5 Use Case Diagram
Actor
Use Case
2 UML Introduction
In-Store Customer
Telephone Customer
Customer
Identify Movie
Open Account
Return Movie
Clerk
Review Account Status
15/26
DVDMovie VHSMovie VideoGame
Customer
RentalItem
RentalInvoice1
1..*
1
Checkout Screen
0..1
1
1..*
1 0..1
Simple
Association
Class
Abstract
Class
Simple
Aggregation
Generalization
Composition
(Dependency)
Multiplicity
2.6 UML Class Diagram
16/26
: Clerk : CheckoutMgr cust :
Customer : Inventory : RentalItem
1: findCustomer( )
2: searchCustomer()
3: enterMovie()
4: search(String)
5: rentMovie()
6: generateRentalItem()
7: printInvoice()
8: generateRentalTotal()
2.7 Sequence Diagram - Rent Movie
2 UML Introduction
Object
Lifeline
ActivationMessage
17/26
: Employee
: CheckoutMgr Cust : Customer
: Inventory
: Rentalitems
1: find customer( )3: enter movie()5: rent movie()7: printInvoice() 2: searchCustomer( )
4: search(String)
6: generateRentalItem()8: generateRentalTotal()
2.8 Collaboration Diagram - Rent Movie
Object
Message
2 UML Introduction
18/26
Clerk User Interface
Customer DataBusiness
System client
<<facade>>
Rental Screen
(to business system)
Business System
2.9 Package Diagram
ClassPackage
2 UML Introduction
19/26
Suppl i ed by Mi crosof t
DB Server i nterf ace (dbsvr. dl l )
<<l i brary>>
Appl i cat i on Framework(appf r. dl l )
<<l i brary>>
Vi edo Workstat i on(vstat i on. exe)
<<appl i cat i on>>
2.10 Component DiagramComponent
Dependency
Note
2 UML Introduction
20/26
Node
Communication
Association
2.11 Deployment Diagram
2 UML Introduction
Pr i nt er
Cl i ent
HTTP Web Server
DB Server
Chi na Uni onPay Syst em Server
<<i nt er net >>
Tr ai nServer
Cr edi t Check
Or acl e 9i
I nt ernet Expl orer 6. 0Onl i ne Tr ai nReservat i on
21/26
I dentyfiy Cal l er
Obtai n Name
Current Customer?
Open Account?
Create Account
[ No ]
[ Yes ]
[ No ]
[ Yes ]
Action Activity
Start State
Decision
End State
2.12 Activity Diagram
2 UML Introduction
22/26
Validate
do/ Check account
Check-Out
do/ check-out video
Check-Out Complete
customer appears
[ account not valid ]
[ account valid ] / get first video
[ no more videos ]
[ more videos ] / get next video
2.13 State Diagram
State
Transition
ActivityGuard
Action
Event
2 UML Introduction
23/26
2.14 Relations between UML Diagram
Use CaseRequriments Class (E)
State Chart
Sequence
Class (S)
Activity
Collaboration
2 UML Introduction
24/26
2.15 Rational Unified Process
2 UML Introduction
25/26
Reading Materials Object-Oriented Design & Patterns UML Notation Guide Software Development with UML
UML Programming Guide 中文教程
26/26
Questions If You don’t know the answer, maybe I can
make one up!