uml 101 – an introduction julie daniels staff software engineering specialist ibm rational...
TRANSCRIPT
UML 101 – An IntroductionJulie Daniels
Staff Software Engineering SpecialistIBM Rational Software
UML 101 – An IntroductionJulie Daniels
Staff Software Engineering SpecialistIBM Rational Software
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 2
.
.
.
.
.
.
.
.
..
.
.
. .
.
. ..
..
.
.
.
.
.
“26% of software projects succeed.”Standish Group, CHAOS Report, 2000
The Good News…
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 3
.
.
.
.
.
.
.
.
..
.
.
. .
.
. ..
..
.
.
.
.
.
That means 74% failed!Standish Group, CHAOS Report, 2000
The Bad News…
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 4
How do we resolve these problems?
Requirem
ents N
ot Managed Ambiguous Communication
Brittle Architectures
Overwhelming
Complexity
Undetected
Inconsistencies
Insufficient Testing
Uncontrolled Change Propagation
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 5
Use Component Use Component ArchitecturesArchitectures
Industry Best Practices Address Problems
Develop IterativelyDevelop Iteratively
Manage RequirementsManage Requirements
ContinuouslyContinuouslyVerify QualityVerify Quality
Control ChangeControl Change
BestPractices
BestPractices
Model VisuallyModel Visually
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 6
Use Component Use Component ArchitecturesArchitectures
Implementing Industry Best Practices
Model VisuallyModel Visually
Object Object TechnologyTechnology
UMLUML
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 7
Agenda
Object TechnologyIntroductionFour Principles
Visual Modeling with UMLImportance of ModelingIntroducing UML
Two Key ElementsEight Diagrams
UML in ActionUML Tool MarketplaceIBM Rational XDE
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 8
What Is Object Technology?
A set of principles (abstraction, encapsulation, modularity, hierarchy) guiding software construction, together with languages, databases, and other tools that support those principles. (Object Technology - A Manager’s Guide, Taylor, 1997.)
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 9
The Strengths of Object Technology
Reflects a single paradigm Facilitates architectural and code reuse Reflects real world models more closely Encourages stability Is adaptive to change
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 10
Major object technology milestones
Simula
1967
C ++
Late 1980s
Smalltalk
1972
Java
1991
The UML
1996
???
2003+
The History of Object Technology
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 11
Where Is Object Technology Used?
Client/Server Systems and Web Development Encapsulates business
information in objects
Real-time systems Software, like hardware,
is built from components 4
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 12
Basic Principles of Object Technology
Object Technology
Enca
psul
atio
n
Abs
trac
tion
Hie
rarc
hy
Mod
ular
ity
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 13
Principle 1: Abstraction
Student Professor
Course Offering (9:00 a.m., Monday-Wednesday-Friday)
Course (e.g. Algebra)
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 14
Principle 2: Encapsulation
Improves Resiliency
Hides implementation from clients. Clients depend on interface.
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 15
Principle 2: Encapsulation with Polymorphism
Manufacturer AManufacturer B
Manufacturer C
OO Principle:Encapsulation
The ability to hide many different implementations behind a single interface
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 16
Principle 3: Modularity
Breaks up something complex into manageable pieces.
Helps people understand complex systems.
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 17
Principle 4: Hierarchy
Decreasing abstraction
Increasing abstraction
Asset
RealEstate
Savings
BankAccount
Checking Stock
Security
Bond
Elements at the same level of the hierarchy should be at the same level of abstraction.
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 18
Where Are We?
Object TechnologyIntroductionFour Principles
Visual Modeling with UMLImportance of ModelingIntroducing UML
Two Key ElementsEight Diagrams
UML in ActionUML Tool MarketplaceIBM Rational XDE
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 19
What Is a Model?
A model is a simplification of reality.
Why do we model?
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 20
Why Do We Model?
Modeling achieves four aims: Visualize a system Specify the structure or behavior of a system Have a template to guide construction Document our decisions
We build models of complex systems because we cannot comprehend such a system in its entirety.
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 21
The Importance of Modeling
Paper Airplane Fighter Jet
Less Important More Important
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 22
Software Teams Often Do Not Model
Many software teams build applications like building paper airplanes Start coding from project requirements Work longer hours and create more code Lack any planned architecture Doomed to failure
Modeling is a common thread to successful projects.
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 23
No Single Model Is Sufficient
Non-trivial systems best approached through a small set of nearly independent models. Create models that can be built and studied separately,
but are still interrelated.
Process View Deployment View
Logical View
Use-Case View
Implementation View
End-userFunctionality
ProgrammersSoftware management
Performancescalabilitythroughput
System integrators
System topologydelivery, installation
communication
System engineering
Analysts/Designers
Structure
Where have you seen many models of a single entity?
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 24
Where Are We?
Object TechnologyIntroductionFour Principles
Visual Modeling with UMLImportance of ModelingIntroducing UML
Two Key ElementsEight Diagrams
UML in ActionUML Tool MarketplaceIBM Rational XDE
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 25
What Is the UML?
A language for modeling object-oriented software Used for
• Visualizing• Specifying• Constructing• Documenting
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 26
Visualizing, Specifying, Constructing, Documenting
Forward Engineering (Code Generation) and Reverse Engineering
DomainExpert
User InterfaceDefinition
Use CaseDiagram
Actor A
Use Case 1
Use Case 2
Use Case 3
Actor B
Activity Diagram
[yes]
Actor A Actor B
Class Diagram
GrpFile
read( )open( )create( )fillFile( )
rep
Repository
name : char * = 0
readDoc( )readFile( )
(from Persistence)
FileMgr
fetchDoc( )sortByName( )
DocumentList
add( )
delete( )
Document
name : int
docid : intnumField : int
get( )open( )
close( )read( )
sortFileList( )create( )
fillDocument( )
fList
1
FileList
add( )delete( )
1
File
read( )
read() fill the code..
State TransitionDiagram
Openning
Writing
ReadingClosing
add file [ numberOffile==MAX ] /
flag OFF
add file
close file
close file
Component Diagram
Document
Repository
FileList
FileManager
GraphicFile File
Collaboration Diagram
user : »ç¿ëÀÚ
mainWnd : MainWnd
fileMgr : FileMgr
repository : Repositorydocument : Document
gFile : GrpFile
9: sortByName ( )
L1: Doc view request ( )
2: fetchDoc( )
5: readDoc ( )
7: readFile ( )
3: create ( )
6: fillDocument ( )
4: create ( )
8: fillFile ( )
Sequence Diagram
usermainWnd fileMgr :
FileMgrrepositorydocument :
DocumentgFile
1: Doc view request ( )
2: fetchDoc( )
3: create ( )
4: create ( )
5: readDoc ( )
6: fillDocument ( )
7: readFile ( )
8: fillFile ( )
9: sortByName ( )
ƯÁ¤¹®¼ ¿¡ ́ ëÇÑ º¸±â¸¦ »ç¿ëÀÚ°¡ ¿äûÇÑ´Ù.
È ÀÏ°ü̧ ®ÀÚ´Â Àоî¿Â ¹®¼ ÀÇ Á¤º¸¸¦ ÇØ´ç ¹®¼ °´Ã¼¿¡ ¼³Á¤À» ¿äûÇÑ´Ù.
È ̧é °´Ã¼´Â ÀоîµéÀÎ °´Ã¼µé¿¡ ´ëÇØ ÀÌ̧ §º°·Î Á¤·ÄÀ» ½ÃÄÑ È ̧é¿¡
º¸¿©ÁØ´Ù.
Modelspace
Executable System
DeploymentDiagram
Window95
¹®¼ °ü¸® Ŭ¶óÀ̾ðÆ®.EXE
WindowsNT
¹®¼ °ü¸® ¿£Áø.EXE
WindowsNT
Windows95
Solaris
ÀÀ¿ë¼ ¹ö.EXE
AlphaUNIX
IBM Mainframe
µ¥ÀÌŸº£À̽º¼ ¹ö
Windows95
¹®¼ °ü¸® ¾ÖÇø´
ºÐ»ê È °̄æÀÇ Çϵå¿þ¾î¹× ³×Æ®¿÷À¸·ÎÀÇ Á¤º¸ ½Ã½ºÅÛ ¿¬°á ̧ 𵨠- À©µµ¿ì 95 : Ŭ¶óÀ̾ðÆ® - À©µµ¿ì NT: ÀÀ¿ë¼ ¹ö
- À ´̄нº ̧ Ó½Å: ÀÀ¿ë ¼ ¹ö ¹× µ¥ÀÌŸ ¼ ¹ö, Åë½Å ¼ ¹ö - IBM ¸ÞÀÎÇÁ·¹ÀÓ: µ¥ÀÌŸ ¼ ¹ö, Åë½Å ¼ ¹ö
Forward Engineering (Code Generation) and Reverse Engineering
Source Code edit, compile,
debug, link
1919
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 27
History of the UML
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 28
Inputs to the UML
Fusion
Operation descriptions,message numbering
Fusion
Operation descriptions,
Meyer
Before and after conditions
Meyer
Harel
State charts
Harel
State charts
Wirfs-Brock
Responsibilities
Wirfs-Brock
Responsibilities
Embley
Singleton classes, high -level view
Embley
Singleton classes, -level view
Odell
Classification
Odell
Classification
Shlaer - Mellor
Object lifecycles
Shlaer - Mellor
Gamma, et.al
Frameworks, patterns,notes
Gamma, et.al
Frameworks, patterns,notes
BoochRumbaugh Jacobson
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 29
Where Are We?
Two key UML elementsObjectClass
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 30
Truck
Chemical Process
Linked List
What Is an Object?
An entity, either physical, conceptual, or software.
Physical entity
Conceptual entity
Software entity
Like a “part”
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 31
Representing Objects in the UML
An object is represented as a rectangle with an underlined name.
J Clark : Professor
: Professor
Named Object
Anonymous Object
Professor J Clark
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 32
What Is a Class?
A class is a description of a set of objects that share the same attributes, operations, relationships, and semantics. A class is an abstraction of an object An object is an instance of a class
A class is an abstraction in that it Emphasizes relevant characteristics Suppresses other characteristics
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 33
Representing Classes in the UML
A class is represented using a rectangle with compartments.
Professor J Clark
Professor
- name- employeeID : UniqueId- hireDate- status- discipline- maxLoad
+ submitFinalGrade()+ acceptCourseOffering()+ setMaxLoad()+ takeSabbatical()
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 34
Where Are We?
Object TechnologyIntroductionFour Principles
Visual Modeling with UMLImportance of ModelingIntroducing UML
Two Key ElementsEight Diagrams
UML in ActionUML Tool MarketplaceIBM Rational XDE
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 35
Seven UML Diagrams
1. Use-Case Diagram2. Activity Diagram3. Class Diagram4. Sequence Diagram5. Collaboration Diagram6. Statechart7. Deployment Diagram8. Component Diagram
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 36
1 - UML Use-Case Diagram
Models system requirements
Shows interaction between the system and its environment Student
View Report Card
Register for Courses
Login
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 37
UML Use-Case Diagram
Course Catalog
View Report Card
Register for Courses
Submit Grades
Select Courses to Teach
Student
Professor
Billing System
Maintain Student Information
Maintain Professor Information
Login
Close Registration
Registrar
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 38
2 - UML Activity DiagramActivity State
Synchronization Bar (Fork)
Guard Condition Synchronization Bar (Join)
Decision
Concurrent threads
Transition
Select Course
Check Schedule
Check Pre-requisites
Assign to course
Resolve conflicts
Update schedule
[ student added to the course ]
[ add course ]
Delete Course[ delete course ]
[ checks completed ] [ checks failed ]
Supplements the use-case diagram
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 39
3 – UML Class Diagram
Static view of a system
RegisterForCoursesForm<<boundary>>
CourseOffering<<entity>>
Schedule<<entity>>
0..*0..4
0..*0..4
Student<<entity>>
0..*1 0..*1
RegistrationController<<control>>
1 11 1
0..1
0..1
0..1
0..1
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 40
UML Interaction Diagrams
Models the dynamics of a system Shows messaging between objects
Sequence Diagrams Collaboration Diagrams
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 41
4 - UML Sequence Diagram
: Student
: :RegisterForCoursesForm : :RegistrationController : Course Catalog
: :CourseCatalogSystem
1: create schedule( )
5: display course offerings( )
2: get course offerings( )
3: get course offerings(forSemester)
6: display blank schedule( )
4: get course offerings( )
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 42
5 - UML Collaboration Diagram
: Student
: RegisterForCoursesForm
: RegistrationController : CourseCatalogSystem
5: display course offerings( )6: display blank schedule( )
: Course Catalog
1: create schedule( )
2: get course offerings( )
3: get course offerings(forSemester)
4: get course offerings( )
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 43
6 - UML Statechart
Enrolled
Freshman
Sophmore
Junior
Senior
H
First year
Second year
Third year
Fourth year
Graduated
[ credits >= 112 ]
Applied
[ rejected ]
[ accepted ]
H
[ credits >= 28 ]
[ credits >= 56 ]
[ credits >= 84 ]
Hiatus
return
leave
Specifies the sequence of states that an object can take on.
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 44
7 - UML Deployment Diagram
Desktop PCDesktop PC
Registration Server
Course Catalog
<<legacy>>
Billing System
<<legacy>>
<<Campus LAN>> <<Campus LAN>>
<<Campus LAN>><<Campus LAN>>
•Shows the configuration of processing nodes at run-time
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 45
8 - UML Component Diagram
Billing System
Course Registration System
IBillingSystem
Shows modular, deployable, and replaceable parts of a system Each component encapsulates implementation and exposes a set of interfaces.
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 46
Summary
Using component architectures and visually modeling software help increase software development success rates
Object technology is used to develop software using components Modeling is common thread to successful applications
UML is used to visually model software The two key elements in UML are objects and classes
No single model is sufficient for a non-trivial system UML provides eight diagrams that can be built and
studied separately, yet are interrelated.
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 47
Where Are We?
Object TechnologyIntroductionFour Principles
Visual Modeling with UMLImportance of ModelingIntroducing UML
Two Key ElementsEight Diagrams
UML in ActionUML Tool MarketplaceIBM Rational XDE
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 48
Main Players in UML Tool Marketplace .NET Players
Borland (TogetherSoft) ControlCenter/JBuilder• $5995
Microsoft Visio in Visual Studio Enterprise Architect edition• $2500 Included with Visual Studio Enterprise Architect
IBM Rational XDE .NET• $1595 Modeler Edition, $2995 Developer Edition
Java Players Borland (TogetherSoft) Control Center 5.5/JBuilder
• $5995 Embarcadero Describe
• $995/Developer Edition, $2995 Enterprise Edition IBM Rational XDE Java
• $1595 Modeler Edition, $2995 Developer Edition
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 49
Modeling for Business, Application and Data Modelers
One notation: UML One tool: IBM Rational XDE
Application ModelingApplication Modeling Data ModelingData Modeling
Business ModelingBusiness Modeling
Fundamentals of Visual Modeling with UMLCopyright © 2001 Rational Software, all rights reserved 50
Roundtrip Engineering in Rational XDE
The Model Has Been
Updated …
The Model Has Been
Updated …
… And The Code Has Been
Updated
… And The Code Has Been
Updated
… And Synchronize To
Update The Code AND The
Model
… And Synchronize To
Update The Code AND The
Model