Free Mini Course: Applying UML 2 with MagicDraw
2
Introduction
This presentation serves two goals:1. It is a free mini course on modeling with UML 22. It presents the principles of MagicDraw training classes
We are going to present the following topics:� Modeling with UML 2 – what is UML and why modeling is important� Sample UML 2 Diagrams from a Case Study Model – a sampler
demonstrating a case-study approach used in our training courses� Modeling Best Practices – some of the best practices that we
present in our training classes� MagicDraw in Action – some of the most powerful MagicDraw
features that you can learn using� About MagicDraw Training – our training group principles and some
marketing info
3
Contents
Modeling with UML 2
Sample UML 2 Diagrams from a Case Study Model
Modeling Best Practices
MagicDraw in Action
About MagicDraw Training
4
What Is UML?
� A language (notation) for modeling object-oriented systems
� A standard maintained by the Object Management Group
� A modeling language including 13 diagrams
� A means for visualizing, specifying, constructing, anddocumenting software systems
� http://www.uml.org
5
Long Story of UML
Grady Booch
Jim Rumbaugh(OMT)Other
Methodologies
Unified Method 0.8
UML 0.9 & 0.91
Ivar Jarcobson
UML 1.0
Partner’s Expertise
UML 1.1
UML 1.2
UML 1.3
RTF (Revision Task Force)
‘95
‘96
Jan ‘97
Sep ‘97
‘99
Fragmentation
Unification
Standardization
Industrialization
UML 1.4/1.5
’98(Internal)
‘01
UML 2.0‘05
UML 2.1‘06
6
Why Modeling Is Important?
� Modeling is the core of modern software & systems development, and speeds up implementation while elevating quality and user satisfaction;
� It applies to all development activities – from requirements to testing;
� Without efficient modeling skills you cannot be successful in today’s IT development!
Did You Know?
Software Development magazine Salary Survey 2005 has surveyed over 4000 software developers and managers and has identified that the MOST important skills needed to produce quality projects and products are architecture modeling and design (59% of the staff and 56% of the managers indicated this). The survey ranked this higher than programming, QA, testing, and requirements management. Therefore, don't miss your chance to spend your training budget on the right education!
7
Applying UML in Software Development Process
Implementation architecturePackage structureInteraction scenariosDetailed class and data modelsUser interface “maps”
Code generation from UMLVisualization of code structureModel transformationsCode model analysis
Test case action flowsTest data object structuresInteractions for test scenarios
Domain analysis modelVisual concept dictionaryUse case scenariosActivity trails
8
The Role of UML in Different Processes
RUP-like processes
Advocates UML-centric approach to software design and UML tool usage
Agile processes
Advocates informal modeling and using whiteboards, paper, and simple drawing editors
9
Contents
Modeling with UML 2
Sample UML 2 Diagrams from a Case Study Model
Modeling Best Practices
MagicDraw in Action
About MagicDraw Training
10
A Case Study Approach to Learning
� We believe that the best way to learn is through taking a case study system and working interactively on it.
� You can find out the details of UML 2 notation in its specification, but its much more difficult to find out how to apply UML 2 diagrams for modeling real-life projects.
� In the next slides we will provide some modeling examples for a library management software project that we are using as one of our training case studies.
11
MagicLibrary: Description of a Case Study System (1)
� A large organization needs to build a software system MagicLibrary for facilitating its internal library usage and management. Library contains two types of items – books and audio CDs. All items are assigned to one or more categories. There may be multiple copies of the same title. Library system should support three types of users – librarian, reader, and training manager.
� Reader can find items either by browsing the category tree or performing search by item properties. Having found a desirable item, a reader has to make a reservation for that item. If the item is immediately available then the reader should contact librarian for issuing a loan according to the reservation. Reader can keep the loaned item for a defined period. If a reader keeps a loaned item longer, he should be penalized – disabled to use library for some time, which is defined by how many days the return is overdue. If a desired item is already loaned or reserved by somebody else then the reader makes reservation and is put to a waiting list. When the item becomes available, the system makes the first waiting reservation active and sends a notification to the user either by e-mail or by SMS (according to user’s settings). An active reservation is cancelled if the reader doesn’t contact librarian in the time-span longer than the defined maximum reservation pending time.
12
MagicLibrary: Description of a Case Study System (2)
� Librarian manages library customers, items, and categories. Librarian is also responsible for registering item loans and returns. He is also responsible for changing system settings like maximum reservation pending time and loan duration, maximum number of reservations and loans per user, etc.
� Additionally, system needs to facilitate purchasing of new items. All users (readers and librarians) can request to purchase new items. Company’s training manager monthly reviews requests and assigns priorities to all of the requests. He also selects what items should be purchased each month. System should report to users about added new items if they prefer to receive this info.
� The system should be implemented using three-tier layered architecture and Java technologies. Librarian and training manager should be using rich-GUI client applications while readers should be able to access system using lightweight clients accessible through Internet browsers.
13
Modeling Framework
Domain AnalysisDomain AnalysisDomain AnalysisDomain Analysis(BMPN, class, state diagrams)
Use Case ModelUse Case ModelUse Case ModelUse Case Model(Use case + activity diagrams)
Architectural DesignArchitectural DesignArchitectural DesignArchitectural Design(Robustness, package,
implementation diagrams)
Detailed DesignDetailed DesignDetailed DesignDetailed Design(Class, sequence, package diagrams)
Source codeSource codeSource codeSource code(Java, C#, C++, XML, DDL)
14
Domain Analysis
Perform domain analysis by modeling domain entities and their relationships using
simplified class diagram. This diagram will serve as a visual dictionary of concepts. It will
also be a starting point for your design-level data model.
� With MagicDraw you can generate dictionary in HTML format
Reservation
Reader
Item
Loan
Category
Return
Penalty
is given for11
classified by1..*0..*
inactivates11
performs
1
0..*
books
0..*
1
given for overdue0..1
1
15
Use Case Model
Register items' return
extension pointsoverdue
Make item's reservation
Register items' loan
Review reader's history
Find item
Penalize for overdue
Librarian
Reader
<<extend>>(overdue)
<<include>>
<<include>>
Analyze functional requirements by
identifying user roles – actors – and
associating them to their use cases.
� With MagicDraw you can
document use case model
elements and generate ready-
to-use use case report.
16
Activity Diagram for Use Case Scenarios
Select returned items
Identify reader
Show list ofloaned items
Record return data
Penalize for overdue [overdue]
[on time]
Model abstract use case
implementation by creating activity
diagrams visualizing activity flows
for primary and secondary use
case scenarios.
� You can hyperlink use cases
to the activity diagrams
modeling their scenarios
� You can decompose activity
diagram elements using
hyperlinks to detailed
diagrams
� Assign activity diagrams as
use case primary and
secondary scenarios, which
includes them in use case
documentation
17
Robustness Analysis
Perform the robustness analysis to identify the major components in layered architecture:
user interface boundaries, business logic controls, and data entities.
SystemAccessService
NotificationService
ItemSearchForm
ItemBrowser SearchService
ReaderProfile LoanService
LoginDialog
Librarian
Reader
Loan
Item
Penalty
User
18
Package Dependencies
Prepare package dependencies diagram to group your implementation classes in
appropriate way. This will help you maintain the code well structured and avoid design
flaws such as cyclic dependencies or dependencies on unstable parts.
gui
persistence
services
web
domainSpecifics Stability
19
Interactions
Model component interactions for use case scenarios in order to find out new methods in existing classes or even new classes with specific responsibilities.
[for each reservation ]
loop
<<control>>
: NotificationService
<<boundary>>
: ReaderProfile
<<control>>
: LoanManager
: Reader <<entity>>
: Loan
Login
ref
cancelReservation()3:
inactivate()4:
getWaitingOrder5:
notifyUser(-)6:
select rezervations for canceling1:
cancelReservations()2:
[for each reservation ]
loop
Login
ref
20
Detailed Class Model
Create detailed class diagrams to capture your object-oriented data model. Later you will be able to transform them into executable code – database DDL scripts, XML schemas, Javacode, etc.
Reader
-firstName : String-lastName : String-birthday : date-email : String
Loan
-dateReturned : date = null-dateLoaned : date = null-dateReserved : date
Book
-numberOfPages : int
-published : date
-ISBN : String
-edition : int
Penalty
-suspendedUntil : date
Item
-description : String-price : float
-title : String
AudioRecord
-released : date
-artist : String-label : String
Category
-description : String-name : String
-overdueLoan1
-categories
1..*
0..*
-reader
1
-book
1
-childs
0..*
-parent
0..1
-loaner1
21
Implementation Architecture
J2EE Application Server
<<artifact>>
JSP pages
<<EJB-JAR>>
EJBServices.jar
<<EJB-JAR>>
EJBEntities.jar
Database Server
<<artifact>>
Database
Local Client
<<artifact>>
AdminGUI.jar
Web Client
<<artifact>>
Browser
TCP/IP
HTTP
JDBC
Define the major
artifacts that manifest
implementation of your
components.
Indicate how they are
deployed on hardware
nodes, their inter-
dependencies and
communication
protocols.
22
Prepare Platform-Specific Models
<<EJBSessionBean>>
SystemAccessService
+login( username : String, password : String ) : boolean
<<dao>>
User
+comparePassword( password : String ) : boolean+getUser( username : String ) : User
<<server page>>
LoginHandler.jsp
<<client page>>
main.html
<<client page>>
index.html
<<client page>>
error.html
<<form>>
login
<<builds>> <<builds>>
<<submit>>{parameters = name, password}
Identify implementation technologies and software component types.
Prepare models that are ready for code generation!
23
Contents
Modeling with UML 2
Sample UML 2 Diagrams from a Case Study Model
Modeling Best Practices
MagicDraw in Action
About MagicDraw Training
24
Why Best Practices for Modeling Are Important?
� Modeling is the core of modern software development
• Regardless of what process is applied
� Successful software development requires efficient modeling
� We share our best practices in modeling!
“A fool doesn't learn from his own mistakes…”
“A wise man learns from mistakes of others!”
25
12 Best Practices
1. Apply a subset of UML relevant to your role2. Focus on the most valuable modeling artifacts3. Maintain multiple abstraction levels4. Choose appropriate level of detail5. Model with style6. First focus on model, only then on diagrams7. Reuse model elements8. Organize models using notes, hyperlinks, and content diagrams9. Use reverse engineering for code analysis and visualization10. Apply patterns when modeling with UML11. Use model analysis tools12. Apply PIM to PSM transformations
26
Best Practice #4: Choose Appropriate Level of Details
Detailed diagrams are difficult to understand and maintain� Such diagrams are rarely used
� It is common to give up their maintenance, thus they become worthless since they do not correspond to the actual code
It is very important to choose appropriate level of details� Do not model / show irrelevant details
� Show only the most important associations
27
Different Levels of Details: Sample 1
Polygon
+getPoint( index : int ) : Point
+Polygon( points : Lis t )
+getLength() : float+toString() : String
+has Points () : int
Meas urableShape
+compareTo( obj : Object ) : int
Point
-x : int-y : int
+equals ( obj : Object ) : boolean
+Point( x : int, y : int )
+s etX( x : int ) : void+s etY( y : int ) : void
+toString() : String
+getX() : int+getY() : int
+Line( s tart : Point, end : Point )
+getLength() : float+toString() : String
+getStart() : Point+getEnd() : Point
Line
Meas urable
<<getter>>+getLength() : float
-s tart
-end
-points
2..*
Naming convention indicates method purpose,thus stereotype can be hidden
Trivial conventional methods, e.g. setters and getters, toString(), can be hidden
28
Different Levels of Details: Sample 2
Line
+Line( s tart : Point, end : Point )+getLength() : float...
MeasurableShape
+compareTo( obj : Object ) : int
Measurable
+getLength() : float
Point
-x : int-y : int
...
Polygon
+getPoint( index : int ) : Point+getLength() : float
+hasPoints () : int
...
-end
-points
2..*
-s tart
Associations with roles and multiplicities can be converted into attributes
29
Different Levels of Details: Sample 3
Line
-s tart : Point-end : Point
+Line( s tart : Point, end : Point )+getLength() : float...
Meas urableShape
+compareTo( obj : Object ) : int
Meas urable
+getLength() : float
Polygon
-points : Point [2..*]
+getPoint( index : int ) : Point+getLength() : float
+has Points () : int
...
Attribute and operation compartments can be suppressed if you need to see only hierarchy and other relationships between classes
30
Different Levels of Details: Sample 4
Line
Point
MeasurableShape
Polygon
Meas urable
-s tart -end -points 2..*
This diagram focuses on structural relationships between classes and hides all attributes and operations. When visualizing large class structures it is often a preferred level of details. Details of a specific class may be displayed in a separate diagram focusing on that particular class or from source code or API documentation.
31
Best Practice #7: Reuse Model Elements
Model elements can be reused in multiple diagrams:� Assign class as instance type in object diagrams;� Call defined class operations in sequence diagrams;� Assign class and state to data flow elements in activity diagrams;� Represent existing actors or components by activity swimlanes in
order to capture responsibilities;� Define signal class for triggering transitions between states;� Decompose and reuse activities, interactions, state machines, …� …
! The power of UML is the ability to specify consistent integrated models
32
Reusing Modeling Elements in Multiple Diagrams
: Open Enrollment Service
Send AutomatedEmail Announcement
Publish info
: Marketing : Trainer
Provide agenda : ClassInfo
[Announced]
Closed for Registration
Open for Registration
Running
Finished
Canceled
Announced
Announce Class
Marketing
Trainer
Update Website
Notify Local Customers
33
Contents
Modeling with UML 2
Sample UML 2 Diagrams from a Case Study Model
Modeling Best Practices
MagicDraw in Action
About MagicDraw Training
34
Learn MagicDraw Features!
� Define project structure and hyperlink model elements� Find related model elements for a given class� Reuse model element in multiple diagrams� Document use cases and generate report document� Transform class models to DB and XML schemas� Apply design patterns when modeling� Use layout tools for creating nice diagrams� Reverse, visualize and analyze source code structure� Decompose large projects into several modules� Compare model versions and find out changes� Track dependencies between different abstraction level
(analysis-, design-, and implementation-) models� Validate your model for completeness and correctness� Create new custom diagrams for your domain� Use MagicDraw Open API with custom plug-ins� … and much more!
Maximize you usage of MagicDraw UML by learning how to:
35
Sample MagicDraw Feature: Comparison of Two Model Versions (1)
Deleted elementsModified element – a diagram
Added element
36
Sample MagicDraw Feature: Comparison of Two Model Versions (2)
Find out modified parts in diagrams!
37
Contents
Modeling with UML 2
Sample UML 2 Diagrams from a Case Study Model
Modeling Best Practices
MagicDraw in Action
About MagicDraw Training
38
Training Scenario
1. Pre-course analysis for finding out customer training needs� Trainees fill in a short questionnaire
2. Customization of training contents� Trainer adopts samples & practical assignments for the group
3. Running training course� Highly interactive lectures� Consistent modeling examples from a software project� Sharing best practices� 50%-50% balance of theory and practical assignments
4. Post-course analysis and follow-up with samples and recommendations� Answering questions� Providing samples, analyzing models
39
Why Train with Us?
You have good reasons to stay with us:
1. Our instructors are MagicDraw experts – people who participate in development of the product
2. We have applied UML in numerous software projects including development of MagicDraw itself� We practice what we preach!
3. Our instructors are certified by OMG as UML professionals4. We always get good reviews by our customers5. We can offer training in most major languages6. We value training and consultations as the closest contact with
our customers!
40
Ways to Learn
Choose the most effective way to learn:
1. Send one or two employees to an open enrollment class!2. Order onsite training when purchasing new MagicDraw licenses!3. Consider adding one of our professional services consultants as
an on-staff mentor in your first MagicDraw project!4. Ask for a free one hour tour for new functionality demo!
41
Testimonials
“Course used our own project as case study and this was very effective. Darius and the team were very good at understanding our issues and showing how UML and MagicDraw can help us. Very impressive, friendly and helpful instructor.”
Colin Manning, Lead Engineer, ts.com
"Thank you very much for the great training Edita! I will recommend your training course 'Applying UML 2 with MagicDraw' to my company I'm working for.“
Michael Rüger, Software Developer,
MAN Roland Druckmaschinen AG
"I'm really enjoying your training this week, and getting to know Dan. He's a great guy, a good instructor, dry sense of humor, and he has incredible technical depth. He's the real deal. Also, really energized by what I'm learning about MagicDraw this week, which is a lot. I have used the tool (lightly) once, and "played" with the tool a fair amount, but the class is really giving me much deeper exposure to the power and flexibility of the tool under the covers. I really like what I see, and am actually rather amazed by it all after spending so much time with other UML tools. The tool has a lot of rich functionality, but the nice thing is it's very configurable to a given application of use or role. I like it.“
Alex Rush,ExperShare
42
Applicability of Gained Modeling Skills
Business Analysts� Model and refactor business processes� Analyze information flows
� Identify domain entities and relationships
� Specify lifecycles of important entities
� Capture user needs� Capture use case scenarios
Programmers� Prepare detailed class models
� Apply responsibility-driven design through interaction modeling
� Model complex algorithms� Reverse, visualize, and analyze code
� Prepare code documentation
� Generate DB and XML schemas
� Introspect structure of existing systems
System Architects� Model and relate various architectural
views
� Decompose system into components
� Model deployment architecture� Define package dependencies
� Specify reusable designs
� Manage modeling teamwork
QA Engineers� Introspect use case scenarios
� Specify test data� Model the structure of automated test code
43
Leading Instructor
Darius has been working with No Magic since 1998. He took part as Java developer in multiple
international projects. Darius has developed a modeling case study MagicLibrary and leaded
numerous MagicDraw UML training courses and consultations worldwide. He also taught
industrial courses on Requirements Management with UML, Software Design with UML, and
Java/J2EE Programming. Darius received PhD from Vytautas Magnus University, where he
teaches courses Software Development Methodology and Software Engineering. Darius
participates frequently in various conferences and gives talks on UML and other software
development topics. He holds the following professional certificates:
� Microsoft Certified Professional
� Sun Certified Programmer for the Java 2 Platform 1.4� OMG-Certified UML Professional Advanced
Dr. Darius Šilingas
MagicDraw Training Leader
44
Other Instructors
Our world-wide instructor group contains people who all have the following characteristics:
� Have experience in software development� Have applied UML in multiple industrial projects� Are experts of MagicDraw UML� Have good communication skills� Are customer-oriented� Believe in modeling
Most of our trainers are either� The best people from MagicDraw development group� The best independent consultants working with MagicDraw
Visit www.magicdraw.com/trainers for trainers description.
45
Where to Look for More Info
� We are offering you regular open enrollment classes in the USA, Europe, and Asia
� Check the online schedule www.magicdraw.com/training for locations and dates
� Onsite training is available anywhere in the world with the possibility to customize course to meet best your needs!
� Contact training group: [email protected]
� Register online at www.magicdraw.com/registration
Do you need MagicDraw training for just yourself or several employees?
Want MagicDraw training for a small group but want to get away?