UML 101 An Introduction Julie Daniels Staff Software

  • Slides: 50
Download presentation
UML 101 – An Introduction Julie Daniels Staff Software Engineering Specialist IBM Rational Software

UML 101 – An Introduction Julie Daniels Staff Software Engineering Specialist IBM Rational Software

The Good News… . . . “ 26% of software projects succeed. ”. .

The Good News… . . . “ 26% of software projects succeed. ”. . . Standish Group, CHAOS Report, 2000. Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved . 2 .

The Bad News… . . . That means 74% failed!. . . Standish Group,

The Bad News… . . . That means 74% failed!. . . Standish Group, CHAOS Report, 2000. Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved . 3 .

How do we resolve these problems? s nt ed g a an t. M

How do we resolve these problems? s nt ed g a an t. M o N Am ity lex p om big uo g. C min el h erw q Re tect Co Unde mm un Ov e m ire us u ica tio n Uncontrolled Change Propagation In su f fic Britt le A rchi tectu res ie nt Te s tin g Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 4 ies stenc onsi ed Inc

Industry Best Practices Address Problems Develop Iteratively Manage Requirements Use Component Architectures Model Visually

Industry Best Practices Address Problems Develop Iteratively Manage Requirements Use Component Architectures Model Visually Best Practices Continuously Verify Quality Control Change Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 5

Implementing Industry Best Practices Use Component Architectures Object Technology Model Visually Fundamentals of Visual

Implementing Industry Best Practices Use Component Architectures Object Technology Model Visually Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved UML 6

Agenda w Object Technology w Introduction w Four Principles w Visual Modeling with UML

Agenda w Object Technology w Introduction w Four Principles w Visual Modeling with UML w Importance of Modeling w Introducing UML w Two Key Elements w Eight Diagrams w UML in Action w UML Tool Marketplace w IBM Rational XDE Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 7

What Is Object Technology? w A set of principles (abstraction, encapsulation, modularity, hierarchy) guiding

What Is Object Technology? w 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 UML Copyright © 2001 Rational Software, all rights reserved 8

The Strengths of Object Technology w Reflects a single paradigm w Facilitates architectural and

The Strengths of Object Technology w Reflects a single paradigm w Facilitates architectural and code reuse w Reflects real world models more closely w Encourages stability w Is adaptive to change Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 9

The History of Object Technology w Major object technology milestones Simula C ++ The

The History of Object Technology w Major object technology milestones Simula C ++ The UML 1967 Late 1980 s 1996 1972 1991 2003+ Smalltalk Java ? ? ? Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 10

Where Is Object Technology Used? w Client/Server Systems and Web Development § Encapsulates business

Where Is Object Technology Used? w Client/Server Systems and Web Development § Encapsulates business information in objects w Real time systems § Software, like hardware, is built from components Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 11

Basic Principles of Object Technology Fundamentals of Visual Modeling with UML Copyright © 2001

Basic Principles of Object Technology Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 12 Hierarchy Modularity Encapsulation Abstraction Object Technology

Principle 1: Abstraction Student Professor Course Offering (9: 00 a. m. , Monday-Wednesday-Friday) Fundamentals

Principle 1: Abstraction Student Professor Course Offering (9: 00 a. m. , Monday-Wednesday-Friday) Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved Course (e. g. Algebra) 13

Principle 2: Encapsulation w Hides implementation from clients. § Clients depend on interface. Improves

Principle 2: Encapsulation w Hides implementation from clients. § Clients depend on interface. Improves Resiliency Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 14

Principle 2: Encapsulation with Polymorphism w The ability to hide many different implementations behind

Principle 2: Encapsulation with Polymorphism w The ability to hide many different implementations behind a single interface Manufacturer A Manufacturer B OO Principle: Encapsulation Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 15 Manufacturer C

Principle 3: Modularity w Breaks up something complex into manageable pieces. w Helps people

Principle 3: Modularity w Breaks up something complex into manageable pieces. w Helps people understand complex systems. Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 16

Principle 4: Hierarchy Increasing abstraction Asset Security Bank. Account Decreasing abstraction Savings Checking Fundamentals

Principle 4: Hierarchy Increasing abstraction Asset Security Bank. Account Decreasing abstraction Savings Checking Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved Stock Real. Estate Bond Elements at the same level of the hierarchy should be at the same level of abstraction. 17

Where Are We? w Object Technology w Introduction w Four Principles w Visual Modeling

Where Are We? w Object Technology w Introduction w Four Principles w Visual Modeling with UML w Importance of Modeling w Introducing UML w Two Key Elements w Eight Diagrams w UML in Action w UML Tool Marketplace w IBM Rational XDE Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 18

What Is a Model? w A model is a simplification of reality. Why do

What Is a Model? w A model is a simplification of reality. Why do we model? Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 19

Why Do We Model? w Modeling achieves four aims: § Visualize a system §

Why Do We Model? w Modeling achieves four aims: § Visualize a system § Specify the structure or behavior of a system § Have a template to guide construction § Document our decisions w We build models of complex systems because we cannot comprehend such a system in its entirety. Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 20

The Importance of Modeling Less Important More Important Paper Airplane Fundamentals of Visual Modeling

The Importance of Modeling Less Important More Important Paper Airplane Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved Fighter Jet 21

Software Teams Often Do Not Model w Many software teams build applications like building

Software Teams Often Do Not Model w 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 w Modeling is a common thread to successful projects. Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 22

No Single Model Is Sufficient w Non trivial systems best approached through a small

No Single Model Is Sufficient w 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. Logical View Analysts/Designers Implementation View End-user Functionality Structure Programmers Software management Use-Case View Process View Deployment View System integrators Performance scalability throughput Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved System engineering System topology delivery, installation communication 23 Where have you seen many models of a single entity?

Where Are We? w Object Technology w Introduction w Four Principles w Visual Modeling

Where Are We? w Object Technology w Introduction w Four Principles w Visual Modeling with UML w Importance of Modeling w Introducing UML w Two Key Elements w Eight Diagrams w UML in Action w UML Tool Marketplace w IBM Rational XDE Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 24

What Is the UML? w A language for modeling object oriented software w Used

What Is the UML? w A language for modeling object oriented software w Used for • • Visualizing Specifying Constructing Documenting Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 25

Visualizing, Specifying, Constructing, Documenting Use Case Diagram Activity Diagram Actor A State Transition Diagram

Visualizing, Specifying, Constructing, Documenting Use Case Diagram Activity Diagram Actor A State Transition Diagram Actor B add file Domain Expert Use Case 1 [yes] add file [number. Offile==MAX ] / Deployment Diagram Writing flag OFF Actor A Actor B Use Case 2 Openning close file Reading Closing Use Case 3 ºÐ» ê ȯ°æÀÇ Çϵå¿þ¾î¹× ³×Æ®¿÷À¸·ÎÀÇ Á¤º¸ ½Ã½ºÅÛ ¿¬°á ¸ðµ¨ À©µµ¿ì 95 : Ŭ¶óÀ̾ðÆ® À©µµ¿ì NT: ÀÀ¿ë¼ ¹ö À¯´Ð½º ¸Ó½Å: ÀÀ¿ë ¼ ¹ö ¹× µ¥ÀÌŸ ¼ ¹ö, Åë½Å ¼ ¹ö IBM ¸ÞÀÎÇÁ·¹ÀÓ: µ¥ÀÌŸ ¼ ¹ö, Åë½Å ¼ ¹ö Windows 95 ¹®¼ °ü¸® Ŭ¶óÀ̾ðÆ®. EXE Class Diagram 9: sort. By. Name ( ) ¹®¼ °ü¸® ¾ÖÇø´ Windows NT Solaris ¹®¼ °ü¸® ¿£Áø. EXE Document. List ÀÀ¿ë¼ ¹ö. EXE Document File. Mgr main. Wnd : Main. Wnd 1: Doc view request ( ) name : int docid : int num. Field : int File. List g. File : Grp. File 4: create ( ) get( ) open( ) close( ) read( ) sort. File. List( ) create( ) fill. Document( ) f. List 8: fill. File ( ) add( ) delete( ) Alpha UNIX IBM Mainframe L 2: fetch. Doc( ) User Interface Definition add( ) delete( ) fetch. Doc( ) sort. By. Name( ) Windows NT read() fill the code. . Repository µ¥ÀÌŸº£À̽º¼ ¹ö 1 File. Manager user : » ç¿ëÀÚ file. Mgr : File. Mgr 3: create ( ) rep Document 6: fill. Document ( ) Repository (from Persistence) 7: read. File ( ) File read( ) Grp. File name : char * = 0 5: read. Doc ( ) document : Document repository : Repository read( ) open( ) create( ) fill. File( ) read. Doc( ) read. File( ) Graphic. File. List Collaboration Diagram Component Diagram main. Wnd user ƯÁ¤¹®¼ ¿¡ ´ëÇÑ º¸±â¸¦ » ç¿ëÀÚ°¡ ¿äû ÇÑ´Ù. file. Mgr : File. Mgr document : Document g. File repository 1: Doc view request ( ) 2: fetch. Doc( ) Source Code edit, compile, debug, link 3: create ( ) 4: create ( ) 5: read. Doc ( ) È ÀÏ°ü¸®ÀÚ´ ÀÐ¾î¿ ¹®¼ ÀÇ Á¤º¸¸¦ ÇØ´ç ¹®¼ °´Ã¼¿¡ ¼³Á¤À» ¿äû ÇÑ´Ù. 6: fill. Document ( ) 7: read. File ( ) 8: fill. File ( ) È ¸é °´Ã¼´ ÀоîµéÀÎ °´Ã¼µé¿¡ ´ëÇØ À̸§º°·Î Á¤·ÄÀ» ½ÃÄÑ È ¸é¿¡ º¸¿©ÁØ´Ù. Model space 9: sort. By. Name ( ) Sequence Diagram Forward Engineering (Code Generation) and Reverse Engineering 19 Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 26 Executable System

History of the UML Fundamentals of Visual Modeling with UML Copyright © 2001 Rational

History of the UML Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 27

Inputs to the UML Booch Rumbaugh Jacobson Meyer Operation descriptions, message numbering Before and

Inputs to the UML Booch Rumbaugh Jacobson Meyer Operation descriptions, message numbering Before and after conditions Embley Harel Singleton classes, high -level view State charts Gamma, et. al Wirfs-Brock Frameworks, patterns, notes Shlaer - Mellor Object lifecycles Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved Fusion 28 Odell Classification Responsibilities

Where Are We? w Two key UML elements w Object w Class Fundamentals of

Where Are We? w Two key UML elements w Object w Class Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 29

What Is an Object? w An entity, either physical, conceptual, or software. § Physical

What Is an Object? w An entity, either physical, conceptual, or software. § Physical entity Truck § Conceptual entity Chemical Process § Software entity w Like a “part” Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved Linked List 30

Representing Objects in the UML w An object is represented as a rectangle with

Representing Objects in the UML w An object is represented as a rectangle with an underlined name. Named Object Professor J Clark Anonymous Object Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 31

What Is a Class? w A class is a description of a set of

What Is a Class? w 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 w A class is an abstraction in that it § Emphasizes relevant characteristics § Suppresses other characteristics Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 32

Representing Classes in the UML w A class is represented using a rectangle with

Representing Classes in the UML w A class is represented using a rectangle with compartments. Professor J Clark Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 33

Where Are We? w Object Technology w Introduction w Four Principles w Visual Modeling

Where Are We? w Object Technology w Introduction w Four Principles w Visual Modeling with UML w Importance of Modeling w Introducing UML w Two Key Elements w Eight Diagrams w UML in Action w UML Tool Marketplace w IBM Rational XDE Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 34

Seven UML Diagrams 1. 2. 3. 4. 5. 6. 7. 8. Use Case Diagram

Seven UML Diagrams 1. 2. 3. 4. 5. 6. 7. 8. Use Case Diagram Activity Diagram Class Diagram Sequence Diagram Collaboration Diagram Statechart Deployment Diagram Component Diagram Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 35

1 UML Use Case Diagram w Models system requirements w Shows interaction between the

1 UML Use Case Diagram w Models system requirements w Shows interaction between the system and its environment View Report Card Student Register for Courses Login Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 36

UML Use Case Diagram View Report Card Student Register for Courses Course Catalog Maintain

UML Use Case Diagram View Report Card Student Register for Courses Course Catalog Maintain Professor Information Login Maintain Student Information Select Courses to Teach Registrar Professor Close Registration Submit Grades Billing System Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 37

2 UML Activity Diagram [ delete course ] Decision Delete Course Activity State [

2 UML Activity Diagram [ delete course ] Decision Delete Course Activity State [ add course ] Select Course Concurrent threads Synchronization Bar (Fork) Check Schedule Check Pre requisites Transition Guard Condition Synchronization Bar (Join) [ checks completed ] [ checks failed ] Assign to course Resolve conflicts [ student added to the course ] Update schedule Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 38 w Supplements the use case diagram

3 – UML Class Diagram w Static view of a system <<boundary>> Register. For.

3 – UML Class Diagram w Static view of a system <<boundary>> Register. For. Courses. Form <<control>> Registration. Controller 1 1 0. . 1 <<entity>> Student 1 Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 0. . * <<entity>> 0. . 1 Schedule 0. . * 39 <<entity>> Course. Offering 0. . 4

UML Interaction Diagrams w Models the dynamics of a system w Shows messaging between

UML Interaction Diagrams w Models the dynamics of a system w Shows messaging between objects Sequence Diagrams Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved Collaboration Diagrams 40

4 UML Sequence Diagram : : Student : Register. For. Courses. Form : :

4 UML Sequence Diagram : : Student : Register. For. Courses. Form : : Registration. Controller : : Course. Catalog. System : Course Catalog 1: create schedule( ) 2: get course offerings( ) 3: get course offerings(for. Semester) 4: get course offerings( ) 5: display course offerings( ) 6: display blank schedule( ) Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 41

5 UML Collaboration Diagram 5: display course offerings( ) 6: display blank schedule( )

5 UML Collaboration Diagram 5: display course offerings( ) 6: display blank schedule( ) 1: create schedule( ) : Register. For. Courses. Form : Student : Course Catalog 2: get course offerings( ) 4: get course offerings( ) 3: get course offerings(for. Semester) : Registration. Controller Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 42 : Course. Catalog. System

6 UML Statechart Applied [ accepted ] Enrolled [ rejected ] Freshman First year

6 UML Statechart Applied [ accepted ] Enrolled [ rejected ] Freshman First year [ credits >= 28 ] Sophmore Second year [ credits >= 56 ] Junioryear Third Hiatus leave [ credits >= 84 ] Senior year Fourth return H w. Specifies the sequence of states that an object can take on. Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved [ credits >= 112 ] Graduated 43

7 UML Deployment Diagram Desktop PC <<Campus LAN>> • Shows the configuration of processing

7 UML Deployment Diagram Desktop PC <<Campus LAN>> • Shows the configuration of processing nodes at run time Registration Server <<Campus LAN>> <<legacy>> Course Catalog Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 44 <<Campus LAN>> <<legacy>> Billing System

8 UML Component Diagram Billing System IBilling. System Course Registration System Fundamentals of Visual

8 UML Component Diagram Billing System IBilling. System Course Registration System Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved w. Shows modular, deployable, and replaceable parts of a system w. Each component encapsulates implementation and exposes a set of interfaces. 45

Summary w Using component architectures and visually modeling software help increase software development success

Summary w Using component architectures and visually modeling software help increase software development success rates w Object technology is used to develop software using components § Modeling is common thread to successful applications w UML is used to visually model software § The two key elements in UML are objects and classes w 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 UML Copyright © 2001 Rational Software, all rights reserved 46

Where Are We? w Object Technology w Introduction w Four Principles w Visual Modeling

Where Are We? w Object Technology w Introduction w Four Principles w Visual Modeling with UML w Importance of Modeling w Introducing UML w Two Key Elements w Eight Diagrams w UML in Action w UML Tool Marketplace w IBM Rational XDE Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 47

Main Players in UML Tool Marketplace w. NET Players § Borland (Together. Soft) Control.

Main Players in UML Tool Marketplace w. NET Players § Borland (Together. Soft) Control. Center/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 w Java Players § Borland (Together. Soft) 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 UML Copyright © 2001 Rational Software, all rights reserved 48

Modeling for Business, Application and Data Modelers w One notation: UML w One tool:

Modeling for Business, Application and Data Modelers w One notation: UML w One tool: IBM Rational XDE Business Modeling Application Modeling Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved Data Modeling 49

Roundtrip Engineering in Rational XDE The Model Has Been Updated … … And Synchronize

Roundtrip Engineering in Rational XDE The Model Has Been Updated … … And Synchronize To Update The Code AND The Model … And The Code Has Been Updated Fundamentals of Visual Modeling with UML Copyright © 2001 Rational Software, all rights reserved 50