Module 0 - About This Course Rational University Curriculum DEV275 Essentials of Visual Modeling with UML 1 day DEV110 Principles of Modeling 2 hours OR Path 1 DEV111 Principles of UC
Trang 2IBM Rational University
DEV275 Essentials of Visual Modeling with UML 2.0
Student Guide
Part No 800-027076-000
Trang 3Student Manual
Version 2004.06.00
June 2004
Copyright © International Business Machines Corporation, 2004 All rights reserved
This document may not be reproduced in whole or in part without the prior written permission of IBM
The contents of this manual and the associated software are the property of Rational Software and/or its licensors, and are protected by United States copyright laws, patent laws, and various international treaties For additional copies of this manual or software, please contact Rational Software
IBM and the IBM logo are trademarks or registered trademarks of IBM Corporation, in the United States, other countries or both
Rational, the Rational logo, ClearQuest, ClearCase, ClearCase LT, ClearCase MultiSite, Unified Change Management, Rational Developer Network, Rational Rose, Rational XDE, Purify, PureCover-age, Rational Unified Process, ClearDDTS, and Quantify are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries or both
Microsoft Visual Basic, Windows NT, Windows 2000, Windows 95/98, Windows XP, Microsoft Word, Windows Explorer, DOS, PowerPoint, and Visual SourceSafe, among others, are trademarks or regis-tered trademarks of Microsoft Corporation
Java and all Java-based marks, among others, are trademarks or registered trademarks of Sun systems in the United States, other countries or both
Micro-UNIX is a registered trademark of The Open Group in the United States, other countries or both.Other company, product and service names may be trademarks or service marks of others
Printed in the United States of America
This manual prepared by:
IBM Rational Software
18880 Homestead Road
Cupertino, CA 95014-0721
USA
Trang 4Contents
Intended Audience and Prerequisites 0-3 Course Objectives 0-4
Module 1 Introduction to Object Technology 1-1
What Is Object Technology? 1-4 Where Is Object Technology Used? 1-8
Module 2 Principles of Visual Modeling 2-1
What Is a Model? 2-4 Four Principles of Modeling 2-11 What Is the UML? 2-17
A Language Is Not Enough to Build a System 2-25
Module 3 Concepts of Object Orientation 3-1
What Is an Object? 3-4 Basic Principles of Object Orientation 3-10 What Is a Class? 3-20 The Relationship Between Classes and Objects 3-23 What Is a Package? 3-35
Major Concepts in Use-Case Modeling 4-8 Use Cases and Actors 4-12 What Is an Activity Diagram? 4-15
Module 5 Interaction Diagrams 5-1
What is an Interaction Diagram? 5-5 What Is a Sequence Diagram? 5-9 What Is a Communication Diagram? 5-18 Sequence and Communication Diagram Similarities 5-24
What Is a Class Diagram? 6-4 What Is an Association? 6-10 What Is an Aggregation? 6-16 Review: What Is Generalization? 6-19
What Are State Machine Diagrams? 7-6 What Is a Deployment Diagram? 7-15 What Is a Node? 7-16
Glossary
Trang 6Gary Bastoky of Rational University for his graphics support
Last but certainly not least, DeAnna Roberts and the Rational University production team for their logistical support
Rational University, Product Manager/ OO Curriculum
michael.lang@us.ibm.com
Trang 7Works Cited
The following sources were used to develop this courseware When quoted directly, we cite the source after the quoted passage For all other uses, we respectfully acknowledge below the authors’
contributions in the development of this courseware
The Deadline: A Novel About Project Management, Tom DeMarco, Dorset House Publishing,
1997
Design Patterns: Elements of Reusable Object-Oriented Software, Erich Gamma, Richard Helm,
Ralph Johnson, John Vlissides, Addison-Wesley, 1995
Designing Enterprise Applications with the Java 2 Platform, Enterprise Edition, Nicholas Kassem,
Enterprise Team, Sun Microsystems, 2000
Dictionary of Object Technology: The Definitive Desk Reference, Donald G Firesmith and Edward
M Eykholt, Prentice Hall, 1995
Enterprise Java with UML, CT Arrington, Wiley Computer Publishing, 2001
Fundamentals of Object-Oriented Design, Meilir Page-Jones, Addison-Wesley, 2001
Mastering Enterprise Java Beans and the Java 2 Platform, Enterprise Edition, Ed Roman, Wiley
Computer Publishing, 1999
Meta Fax, 09/15/97
Object Technology: A Manager’s Guide, David A Taylor, Addison-Wesley, 1999
Pattern-Oriented Software Architecture: A System of Patterns, Frank Buschman et al., John Wiley &
Sons, 1996
The Rational Unified Process, An Introduction, Phillippe Kruchten, Addison-Wesley, 1999
UML Bible, Tom Pender, Wiley Publishing Inc., 2003
UML Distilled, Third Edition, Martin Fowler, Addison-Wesley, 2004
UML 2 Toolkit, Hans-Erik Eriksson, Magnus Penker, Brian Lyons, and David Fado, Wiley
Publishing, Inc., 2004
The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar Jacobson,
Addison-Wesley, 1999
The Unified Modeling Language Reference Manual – Second Edition, James Rumbaugh, Ivar
Jacobson, Grady Booch, Addison-Wesley, 2004
Visual Modeling with Rational Rose and UML, Terry Quatrani, Addison-Wesley, 1998
Trang 9 Your background, experience
Object technology experience
Software development experience
Your expectations for this course
Trang 10Module 0 - About This Course
Intended Audience and Prerequisites
A desire to learn about visual modeling
The assumption here is that those attending this class work for a software company
Trang 11 Explain what the UML represents.
Explain abstraction, encapsulation, modularity, and hierarchy.
Describe the physical structure of a class.
Identify the relationship between a class and an object.
Define polymorphism and generalization.
Trang 12Module 0 - About This Course
Rational University Curriculum
DEV275 Essentials
of Visual Modeling with UML
1 day
DEV110 Principles of Modeling
2 hours
OR
Path 1
DEV111 Principles of
UC Modeling with UML
2 hours
DEV113 Principles of Analysis II
2 hours
DEV112 Principles of Analysis I
2 hours
Path 2
DEV475 Mastering Object Oriented Analysis &
Design with UML
4 days
DEV160 Principles of Modeling Behavior
2 hours
The above courses are the courses that Rational University offers As you can see for each major software development team role, Rational University offers a professional development course
Trang 13Rational University Curriculum
Path 1
DEV111 Principles of
UC Modeling with UML
2 hours
DEV113 Principles of Analysis II
2 hours
DEV112 Principles of Analysis I
2 hours
Path 2 OR
DEV110 Principles of Modeling
2 hours
DEV275 Essentials
of Visual Modeling with UML
1 day
DEV475 Mastering Object Oriented Analysis &
Design with UML
4 days
Trang 14Module 0 - About This Course
Rational University Curriculum
REQ480 Management with Use Cases
3 days
OR
REQ370 Essentials of Rational RequisitePro
1 day
REQ310 Essentials of Rational RequisitePro
5 hours
OR
DEV110 Principles of Modeling
2 hours
DEV275 Essentials of Visual Modeling with UML
1 day
Trang 16Module 0 - About This Course
Other Sources of Information
9
Other Sources of Information
Rational Web site
http://www-• The Rational Web site provides the latest information on new products, visual modeling and development, events, customer support, documentation and training, to name just a few
• Rational developer Works, a customer-only site is IBM’s resource for
developers
• The UML Resource Center provides additional UML resources like Whitepapers and recommended reading It facilitates newsgroups and information about services and training
• The Rational Edge is a free new e-zine dedicated to the practitioners and
decision-makers in the Rational community Brought to you monthly by Rational Software, this publication will help you use Rational products and services to their very best advantage, and develop high-quality software at the speed today's marketplace demands
Trang 19 Explain the history of object technology.
Discuss how object technology is used today.
Trang 20Module 1 - Introduction to Object Technology
Where Are We?
3
Where Are We?
What is object technology?
Where is object technology used today?
Trang 21What Is Object Technology?
4
What Is Object Technology?
A set of principles (abstraction, encapsulation, polymorphism) guiding software construction, together with languages, databases, and other tools that support those
principles (Object
Technology - A Manager’s Guide, Taylor,
• Models created using object technology are conveniently implemented in software using object-oriented programming languages
• Object technology is not just a theory, but a well-proven technology used in a large number of projects and for building many types of systems
• Successful implementation of object technology requires a method that integrates
a development process and a modeling language with suitable construction
techniques and tools (UML Toolkit, Eriksson and Penker, 1997.)
Trang 22Module 1 - Introduction to Object Technology
The Strengths of Object Technology
5
The Strengths of Object Technology
Reflects a single paradigm
Facilitates architectural and code reuse
Reflects real world models more closely
• Reflects a single paradigm It provides a consistent language that can be applied for both system and business engineering
• Facilitates architectural and code reuse by clearly articulating the major components and the critical interfaces between them
• Reflects real world models more closely The objects themselves often correspond to phenomena in the real world that the system is to handle
• Is more stable, a change to the system can be localized to a small part of the system
• Is adaptive to change -a small change in requirements does not mean massive changes to the system
Trang 23The History of Object Technology
• Object technology is not a new idea It has been around for over 30 years Below is a brief history of the major milestones in the history of object technology
• In 1967, Simula was designed and became the first language to use objects and classes
• In 1972, Alan Kay and others at Xerox PARC created Smalltalk whose roots were tied to Simula In 1980, Smalltalk became the first commercial release of an object-oriented programming environment
• Bjarne Stroustrop, the originator of the C language, released C++ to the public
in the late 1980’s C++ was not an entirely new language, but an extension of C abilities
• In 1991, James Gosling created a language named Oak that was the predecessor
to Java It was created because his development team at Sun Microsystems was writing software for information appliances He found that C++ was too complex and insecure for the job Therefore, he created the Oak language
• UML 2.0 replaces UML version 1.4 Released in 2004, the Object Management Group (OMG) developed two complementary specifications called the
Infrastructure and Superstructure specification The Infrastructure defines the foundational language constructs required for UML 2.0 and serves as an architectural foundation The Superstructure defines the user level constructs
Trang 24Module 1 - Introduction to Object Technology
Where Are We?
7
Where Are We?
What is object technology?
Where is object technology used today?
Trang 25Where Is Object Technology Used?
8
Where Is Object Technology Used?
Client/Server Systems and Web Development
Object technology allows companies to encapsulate business information in objects and helps to distribute processing across the Internet or a network.
Object technology allows companies to encapsulate business information in objects and helps to distribute processing across the Internet or a network Enterprise development environments such as Sun’s J2EE and Microsoft’s Net technologies use objects as the basis for their technology
Trang 26Module 1 - Introduction to Object Technology
Where Is Object Technology Used? (continued)
9
Where Is Object Technology Used? (continued)
Real-time systems
Object technology enables real-time systems to be developed with higher quality and flexibility.
4
Object technology is used in the following industries and software applications:
Telecommunications – circuit switching systems, wireless systems, transmission systems, satellite systems, fault management, call/connection control, and protocol development
Data communications – LAN hub switches, multi-protocol routers, packet switching
& frame relay, ATM switching systems, connection control, node management, fault management, and protocol development
Defense and aerospace – command and control systems, missile control systems, defense simulators, cockpit control systems, air traffic control systems, target tracking, distributed computer modeling, man machine interface control, communication modes and control, redundancy management
Industrial control – office equipment, factory control systems, multi-processor high speed printers, automotive systems, PWB and IC water fabrication, device control, system management, distributed process control, machine position control, bandwidth allocation
Trang 27Differences Between OO and Structured Design
Has a high level of encapsulation
Promotes reuse of code differently
Permits more software extensibility
In the world of structured design, there has always been an uneasy relationship between the data model in an entity-relationship diagram and the dataflow diagram The dataflow process and the data meet in some places, but in not others, they miss each other altogether Object-orientation (OO) melds the data and dataflow process together early in the lifecycle In object-orientation, concern yourselves with defining the static and dynamic views of the system (Jones, p.65)
Object-orientation has a very high level of encapsulation associated with it Data, operations, and entire classes can be encapsulated Structured programming relies upon data structures, sophisticated algorithms, and elaborate relationships between procedure and data (Jones, p.65)
Object-orientation promotes reuse of code at the class level rather than at the level of the individual subroutine (Jones, p 66)
The goal of extensible software is to share a solution that most closely fits the problem By doing this, you can ensure that a small requirements change doesn’t require major modifications to your system Because object orientation is built using classes that are abstractions of actual business objects, OO techniques come closer to permitting software extensibility than structured design
Trang 28Module 1 - Introduction to Object Technology
Trang 30A Language Is Not Enough to Build a System 2-25
Trang 32Module 2 - Principles of Visual Modeling
Where Are We?
Trang 33What Is a Model?
4
What Is a Model?
A model is a simplification of reality.
According to Grady Booch, IBM Fellow, a model provides the blueprints of a system Models may encompass detailed plans, as well as more general plans that give a 30,000-foot view of the system under construction A good model includes those elements that are not relevant to the given level of abstraction Every system may be described from different aspects using different models, and each model is therefore
a semantically closed abstraction of the system A model may be structural, emphasizing the organization of the system, or it may be behavioral, emphasizing the dynamics of the system
Trang 34Module 2 - Principles of Visual Modeling
Why Model?
5
Why Model?
Modeling achieves four aims:
Helps you to visualize a system as you want it to be.
Permits you to specify the structure or behavior of a system.
Gives you a template that guides you in constructing a system.
Documents the decisions you have made.
You build models of complex systems because you cannot comprehend such a system in its entirety.
You build models to better understand the system you are developing.
According to Booch in The Unified Modeling Language User Guide, modeling achieves
four aims:
1 Models help you to visualize a system, as you want it to be A model helps the
software team communicate the vision for the system being developed It is difficult for a software team to have a unified vision of a system that is described only in specification and requirement documents Models bring about
understanding of the system
2 Models permit you to specify the structure of behavior of a system A model
allows how to document system behavior and structure before coding the system
3 Models give a template that guide you in constructing a system A model is an
invaluable tool during construction It serves as a road map for a developer Have you experienced a situation where a developer coded incorrect behavior
because he or she was confused over the wording in a requirements document? Modeling helps alleviate that situation
4 Models document the decisions you’ve made Models are valuable tools in the long term because they give “hard” information on design decisions You don’t need to rely on someone’s memory
Trang 35The Importance of Modeling
6
The Importance of Modeling
Paper Airplane Fighter Jet
You can take a piece of paper and a paper clip, and, in a few minutes, have a paper airplane that entertains your kids If it isn’t built just right, you can always start over and build another airplane
Would it be smart for you to build a fighter jet in the same way? That is, start with some steel, nuts, bolts, and wiring and go right to work Of course not You’re building an airplane that costs millions of dollars, and the cost of failure is high
You’re also be part of a much larger team, needing blueprints and models to
effectively communicate with one another (The Unified Modeling Language User
Guide, Booch, 1999.)
Trang 36Module 2 - Principles of Visual Modeling
Software Teams Often Do Not Model
7
Software Teams Often Do Not Model
Many software teams build applications approaching the problem like they were building paper airplanes
Start coding from project requirements
Work longer hours and create more code
Lacks any planned architecture
Curiously, many software development organizations begin wanting to build complex software systems, but approach the problem as though they were building a paper airplane
With the increasing demand to build more complex software in shorter time, development teams often retreat to the only thing they know how to do well - pound out lines of code Developers start working longer hours and frequently produce code with a requirements document as their only source of input However, there eventually comes a time when the application collapses due to the lack of a well thought-out architecture Consequently, many of these software projects result in failure
Trang 37Model Driven Architecture (MDA)
8
Model Driven Architecture (MDA)
An approach to using models in software development
Separate the specification of the operation of a system from the details of the way that system uses the capabilities of its platform.
• specifying a system independently of the platform that supports it
• specifying platforms
• choosing a particular platform for the system
• transforming the system specification into one for a particular platform
The Model-Driven Architecture prescribes certain kinds of models to be used, how those models may be prepared, and the relationships of these different models
It’s termed model-driven because this provides a means for using models to guide the
understanding, design, construction, deployment, operation, maintenance and modification
The architecture of a system is the specification of the parts and connectors of the
system and the rules for the interactions of the parts using the connectors
Trang 38Module 2 - Principles of Visual Modeling
MDA Viewpoints
9
MDA Viewpoints
Computational Independent Model (CIM)
Focus is on environment of the system and requirements for the system
Platform Independent Model (PIM)
Focus is on system operation, independent of platform
Platform Specific Model (PSM)
Focus is on detailed usage of system on specific platform
A viewpoint on a system is the process of suppressing selected detail to establish a
simplified model, in order to focus on particular concerns within that system
A CIM does not show details of the structure of systems and is sometimes called a domain model The vocabulary used in its specification is familiar to the practitioners
of the domain in question The CIM plays an important role in bridging the gap between those that are experts in the domain and its requirements, and those that are experts in the design and construction of the artifacts that together satisfy the requirements
A PIM exhibits a specified degree of platform independence so as to be suitable for use with a number of different platforms A very common technique for achieving this independence is to target a system model for a technology-neutral virtual machine A virtual machine is defined as a set of parts and services (communications, scheduling, naming, etc.), which are defined independently of any specific platform and which are realized in platform-specific ways on different platforms
A PSM combines the specifications in the PIM with the details that specify how that system uses a particular type of platform
Trang 39Where Are We?
Process and visual modeling
Where Are We?
Trang 40Module 2 - Principles of Visual Modeling
Four Principles of Modeling
11
Four Principles of Modeling
The model you create influences how the problem is attacked.
Every model may be expressed at different levels of precision.
The best models are connected to reality.
No single model is sufficient.
Modeling has a rich history in all the engineering disciplines
The four basic principles of modeling are derived from this history
1 The models you create profoundly influence how a problem is attacked and how
a solution is shaped
2 Every model may be expressed at different levels of precision
3 The best models are connected to reality
4 No single model is sufficient Every non-trivial system is best approached through
a small set of nearly independent models