Module UFC016QMObject-Oriented Design and ProgrammingUnit 1 – What’s OO?
2
Agenda
Module overviewFire alarmTeaching approachContact detailsFree Software!What is Object-Orientation?The Object-Orientated lifecycleIntroduction to use casesTutorial details
3
Module Goals
Gain an understanding of object-oriented concepts, to be able to analyse, design and implement systems in a object-oriented programming languageDevelop a critical awareness of the possibilities and limitations of the OO paradigm, its methods and toolsDevelop an understanding of the benefits and problems associated with software reuse
4
Learning Outcomes
Fully use a modelling tool to analyse and design an object-oriented systemFully use the facilities of a typical object-oriented programming language (e.g. Java) to implement and test an object-oriented design
5
Module Overview1. Use Cases2. Classes and Objects3. OO Analysis (!)4. Message Passing5.6.7. Case Study8.9. Activity diagrams (!)10.11.12. Revision
1.2.3.4.5. Java Message Passing6. Inheritance7. Case Study8. Java GUI9.10. Java Exceptions11. Java Threads12. Revision
DESIGN PROGRAMMING
6
Teaching Approach
You can’t do object-oriented design without knowledge of the OO programming language, but...You can’t do object-oriented programming without knowledge of OO design, so...must interleave the two! 1 hour lecture, 2 hour practical.http://www.cems.uwe.ac.uk/~jsa/OODP/
7
Assignment
OO analysis, design, implementation, testing…Reflection.Essay based questions.Due date TBC but probably mid December.
8
Contact Details
Appointments available on:Monday, Tuesday and Thursday
Email: [email protected]: [email protected] (faster!)
Email: [email protected]
9
Free Software!
Microsoft Academic Alliance3P12 with ID cardWindows XP, Visual Studio etc.Visio
10
Reading: Books - Java
Introduction to Java Programming5th Edition - Y. Daniel Liang (0131489526)
Java Software Solutions: Foundations of Program Design
4th Edition – Lewis and Loftus (0321322037)Or any Java (not JavaScript) book you already have!
11
Reading: Books - UML
Oreilly UML 2.0 Nutshell/Full (0596007957) (£20)UML Distilled: A Brief Guide to the Standard Object Modeling Language (0321193687) (£20)Unified Modeling Language User Guide (Grady Booch) (0321267974) (£30)Using UML – Pooley (0201648601) (£37)
12
Reading: Links
Unified Modeling Language:http://www.uml.org
UML tutorial:http://bdn.borland.com/article/0,1410,31863,00.html
Java Language Whitepaper:http://sunsite.ee/java/whitepaper/java-whitepaper-1.htmlhttp://java.sun.com/docs/overviews/java/java-overview-1.html (shorter)
UML 2.0 Specification:http://www.uml.org/#UML2.0
13
Design is art! (Well in some cases…)
Many ways to achieve same result.Opinionated.Subject to fashion!Don’t take everything you read as gospel.
14
A system made up of objectsComputer
System
Function
Data
Object
15
Objects Collaborate With Other ObjectsGet Total Price
Get Cost
“War & Peace”Book£9.99
“War & Peace”Book£9.99
Get Cost
“Mission Impossible”
DVD£6.99
“Mission Impossible”
DVD£6.99
Get Cost
“Best Ever Hits 2005”
CD£10.99
“Best Ever Hits 2005”
CD£10.99
Shopping Basket
Shopping Basket
Computer
System
16
Comparison with “structured” systems
The System
data / information
space
function space
state space
“orthogonal” view(Tom DeMarco, Ed Yourdon)
17
Role of OO modelsConceptual
(domain) models
Analysis models
Design models
Implementation (Code)
Computer
System
Logical, platform independent model
Physical, platform specific model
Business Process Context
18
Object Oriented Lifecycle - simplifiedUse Cases
Java Technical Architecture
Logical
PhysicalClass Model (static), Interaction Model,
State / Activity Model (dynamic)
Java Source Code
19
Unified Modelling Language
“The Unified Modelling Language (UML) is a language for specifying, visualizing,
constructing, and documenting the artifacts of a software-
intensive system.”
UML SpecificationObject Management Group (OMG) Version 2.0,
October 2004, www.omg.org/uml
UML SpecificationObject Management Group (OMG) Version 2.0,
October 2004, www.omg.org/uml
20
“Object-Oriented Modellingand Design” (1991)
“Object-Oriented Modellingand Design” (1991)
“Object-Oriented Software Engineering: A Use Case Driven Approach” (1992)
“Object-Oriented Software Engineering: A Use Case Driven Approach” (1992)
GRADYBOOCH
IVARJACOBSON
IVARJACOBSON
JAMESRUMBAUGH
JAMESRUMBAUGH
“Object-Oriented Design withApplications” (1993)
“Object-Oriented Design withApplications” (1993)
Major Contributors
21
UML: Unified Modeling Language
“Modeling is the designing of software applications before coding.” [OMG]Standards for…
Model elementsFundamental modelling elements and concepts e.g. use case, class, object, state etc.
NotationVisual rendering of model elements into graphical diagrams
22
Diagram Types
Structure Diagrams: (static)Class, Object, Component, Composite Structure, Package and Deployment.
Behaviour Diagrams: (general)Use case, activity and state machine.
Interaction Diagrams:Sequence, communication, timing and interaction overview.
23
“Outside” versus “Inside” view of system
Use Cases
System Actors
Interaction Model
State Model
Class Model
ActivityActivity
Computer
System
24
UML Graphical Diagrams (1)
Use Case Diagram
25
UML Graphical Diagrams (2)
::Stock
«business»Copy
uniqueReferencecreateLoanoverduePriceareYouRentablepriceOfTheLoan$CreatedeleteYourself
«business»Video
directoractorscertificategetActorgetDirectorgetCertificate
«business»Compact Disk
artistgetArtist
«business»Title
{Abstract}typerunningTimenamedateAddedpriceOverdueloanPricePerDayoverduePricereserveOnDateForgetReservations
addACopydeleteYourself$CreateaddDetailsgetTitlegetDateAddedgetRunningLengthwhatIsYourClassgetCopiesdeletegetTypecopiesAvailabledecrementCopies
«business»Store
storeName
«business»Catalogue
findTitlegetPickingList
«business»Copy
uniqueReferencecreateLoanoverduePriceareYouRentablepriceOfTheLoan$CreatedeleteYourself
«business»Video
directoractorscertificategetActorgetDirector
«business»Compact Disk
artistgetArtist
«business»Title
{Abstract}typerunningTimenamedateAddedpriceOverdueloanPricePerDayoverduePricegetReservation
addACopydeleteYourself
$CreateaddDetails
getTitlegetDateAddedgetRunningLengthwhatIsYourClassgetCopiesdeletegetTypecopiesAvailabledecrementCopies
«business»Store
storeName
«business»Catalogue
findTitlegetPickingList
1
*
*
*
1
Class Diagram
getType
addDetails
26
UML Graphical Diagrams (3)
Behaviour Diagrams
* State Diagram
* Activity Diagram
* Interaction Diagrams
- Sequence Diagram
- Collaboration Diagram
27
UML Graphical Diagrams (4)
Implementation Diagrams
* Component Diagram
* Deployment Diagram
28
Use Cases: Definition
“Use cases are a means for specifying required usages of a system.” [UML spec. v2.0]Collection of related scenarios“Black Box” view of system behaviourTextual narrativeUnit of interaction between actor and system
what the system does, not howSequence / Flow yielding result of value to actor Basis of system scope, construction and testing
29
Use Cases: Notation
“The cinema manager adds details of a new film. Film details include Title, Age Rating, Duration, and short trailer description.”
Add Film
30
Use Cases: Actors
“An actor specifies a role played by a user or any other system that interacts with the subject.” [UML spec. v2.0]Initiate use cases.Exist outside of the scope of a use case.Not necessarily human, i.e. external system.
<<actor>>
Manager
31
Use Cases: Diagram
32
How do Actors interact with system?
SYSTEMActor requests to search for Widget System displays list of
potential Widgets
Actor chooses Widget
ACTOR
System provides Widget Details
Actor amends Widget Details
System updates Widget Details
“ping-pong”interaction
“ping-pong”interaction
SequenceSequence
Amend Widget Details
33
How do I Identify Use Cases?
Identify candidate system actors identify candidate use casesRefine and scope units of interaction (use cases)
start point (look for actor and initial event)end point (look for beneficial result – the goal - for actor)
34
Use Cases: Generalization
General and specific requirements.Shared.Include or Includes?Identify by looking for duplications in the requirements.BTW – Actors can also be generalised.AKA – Extend.
Make Reservation________________
<<extension points>>Add Extra Guest
35
Use Cases: Include
Remove duplicate functionality.Shared.Include or Includes?Identify by looking for duplications in the requirements.
36
Use Cases: Include or Extend
If on its own a use case does not complete a task then it should be included.Go to lunch rule.Extend complete tasks.
37
Use Cases: Example
… A car rental company currently takes bookings for cars over the phone. The sales clerk takes the customer details (dates for reservation, car, contact name and address). The clerk then checks availability and prices the order. The quote is offered to the customer where it is either accepted or rejected. If the quote is accepted the car is marked as booked on the requested days. …
38
Use Cases: Example
39
Use Cases: Example
Sales Clerk Make Reservation
Check Availability
<<include>>
40
Summary
Object-Orientationobjects are function and data in the same place
The Object-Oriented lifecycleuse cases, class and object modelling, code
Introduction to Use Cases“black-box” interaction between actor and system
41
Tutorial
Familiarise yourself with the UweFlixCinema Booking System case studyUsing the UweFlix system requirements:
Identify possible system actors and use casesProvide an objective for each use caseCreate a use case diagram in your UML modelling tool