ARCH-2: UML 101 - From Design to Implementation using UML Frank Beusenberg Senior Technical Consultant Theory vs. Practice The difference between theory and practice is that, in theory, there is no difference between theory and practice. ARCH-2: UML 101 - From Design to Implementation using UML 2 © 2006 Progress Software Corporation Shu-Ha-Ri Shu Ha Ri - Learning - Understanding - Be creative ARCH-2: UML 101 - From Design to Implementation using UML 3 © 2006 Progress Software Corporation Agenda Introduction UML 2.0 Diagrams Use Case View Logical View Dynamic View Implementation View Demonstration Q&A ARCH-2: UML 101 - From Design to Implementation using UML 4 © 2006 Progress Software Corporation Introduction What is UML? Facts UML = Unified Modeling Language First UML spec in 1997 Current version = 2.0 • Object Management Group (OMG) Graphical language • Object Oriented in nature • Has syntax rules • Can be extended using stereotypes NOT a methodology! ARCH-2: UML 101 - From Design to Implementation using UML 5 © 2006 Progress Software Corporation Introduction What is UML? ARCH-2: UML 101 - From Design to Implementation using UML 6 © 2006 Progress Software Corporation Introduction Why model? Manage complexity Mitigate risk Facilitate communication Modeling provides ability to visualize entire systems, assess options and designs • Software has grown from do-it-yourself into highly complex systems • Software is integral part of business process, so has to be well planned • Software has become capital equipment that cannot just be removed/changed ARCH-2: UML 101 - From Design to Implementation using UML 7 © 2006 Progress Software Corporation Introduction Why use UML? Specify, visualize, and document models of software systems • Current and new systems • Structure and design • Behavior and interaction De facto standard (Tool Support!) Unambiguous and consistent notation Documentation ARCH-2: UML 101 - From Design to Implementation using UML 8 © 2006 Progress Software Corporation Agenda Introduction UML 2.0 Diagrams Use Case View Logical View Dynamic View Implementation View Demonstration Q&A ARCH-2: UML 101 - From Design to Implementation using UML 9 © 2006 Progress Software Corporation UML 2.0 Diagrams UML 2.0 Types of Diagrams – Behavior Diagrams ARCH-2: UML 101 - From Design to Implementation using UML 10 © 2006 Progress Software Corporation UML 2.0 Behavioral Diagrams UML Use Case Diagram Describes the functional requirements of the system ARCH-2: UML 101 - From Design to Implementation using UML 11 © 2006 Progress Software Corporation UML 2.0 Behavioral Diagrams UML Activity Diagram Describe procedural logic, business processes and workflow ARCH-2: UML 101 - From Design to Implementation using UML 12 © 2006 Progress Software Corporation UML 2.0 Behavioral Diagrams UML Sequence Diagram Describes the message flow between objects in chronological order sd Serv ice Manager - Component Creation «interface» «interface» «interface» Interfaces::IServiceManager Interfaces::ISecurityManager Interfaces::IComponentFactory Component::Component System Reference= startService(logicalName,componentType) Authorized= isAuthorized() alt Authorized [TRUE] Reference= Check Local Cache for Component alt Component Started [No] Reference= createInstance(componentName,componentType) Create (from Actors) ARCH-2: UML 101 - From Design to Implementation using UML 13 © 2006 Progress Software Corporation UML 2.0 Diagrams UML 2.0 Types of Diagrams – Structure Diagrams ARCH-2: UML 101 - From Design to Implementation using UML 14 © 2006 Progress Software Corporation UML 2.0 Structural Diagrams UML Class Diagram Captures logical structure of system cd Ev aluate Testdriv e Class Name + # ~ Private Attribute: integer Public Attribute: character Protected Attribute: logical Package Attribute: decimal + # ~ Private Operation(character, logical) : void Public Operation() : void Protected Operation() : void Package Operation() : void ARCH-2: UML 101 - From Design to Implementation using UML 15 © 2006 Progress Software Corporation UML 2.0 Structural Diagrams UML Component Diagram Illustrates the pieces of software that will make up a system. ARCH-2: UML 101 - From Design to Implementation using UML 16 © 2006 Progress Software Corporation UML 2.0 Structural Diagrams UML Deployment Diagram Shows how and where the system will be deployed. ARCH-2: UML 101 - From Design to Implementation using UML 17 © 2006 Progress Software Corporation UML Modeling Logical View Implementation View id Business Entity (Client) cd Users «Include» Business Entities::Employee + + + + + + 1 + + + + + + Architecture Entities::User - UserEmail: CHARACTER UserLogin: CHARACTER 1 UserPassword: CHARACTER 0..* + + + + + + 1 Architecture Entities::UserGroups - Address: CHARACTER City: CHARACTER email: CHARACTER EmployeeLanguage: CHARACTER employmentEndDate: DATETIME-TZ employmentStartDate: DATE FirstName: CHARACTER LastName: CHARACTER MobilePhoneNumber: CHARACTER Notes: CHARACTER 0..* PhoneNumber: CHARACTER Position: CHARACTER PostCode: CHARACTER dsXxx.i includes - DEFINE DATASET <dataset-def>: includes «includes» ttContext.i Description: CHARACTER Language: CHARACTER createEmployee() : void deleteEmployee() : void findEmployee() : void isAvailable() : LOGICAL updateEmployee() : void validateEmployee() : void «Program» «include» Architecture Entities:: Language 1 - «includes» ClientXxx.p «Include» etXxx.i Use Case View includes «Include» proSIproxyStart.i ud Manage Employees - UserGroupDescription: CHARACTER UserGroupName: CHARACTER NEW GLOBAL SHARED VARIABLE ghProxySIproc: «realize PERSISTENT» AutoEdge System Brow se Employees «Program» proSIproxy.p «use» Delete Employee - NEW GLOBAL SHARED VARIABLE ghttProxySIproc: HANDLE + + fetchWhere(CHARACTER, HANDLE, DATASET-HANDLE*) : void saveChanges(CHARACTER, HANDLE, CHARACTER*) : void «use» Update Employee Dynamic View Deployment View Manager (from Actors) «include» sd Login Create Employee Client Server Gateway Security «extend» Create User Session Context dd Integration Request("Security", "Login", ...) HQ System isValidUser(Login, password) ValidUser Sonic [if Valid User]: createSession sessionID Sonic Dealer System 1 Sonic Dealer System 2 Sonic Dealer System 3 Sonic Dealer System n [if valid user]: sessionID (from Architecture Components) (from Architecture Components) (from Architecture Components) (from Architecture Components) ARCH-2: UML 101 - From Design to Implementation using UML 18 © 2006 Progress Software Corporation Model-Driven Architecture (MDA) ARCH-2: UML 101 - From Design to Implementation using UML 19 © 2006 Progress Software Corporation Agenda Introduction UML 2.0 Diagrams Use Case View Logical View Dynamic View Implementation View Demonstration Q&A ARCH-2: UML 101 - From Design to Implementation using UML 20 © 2006 Progress Software Corporation AutoPark - Use Case View Describing system functionality Gathering requirements • Functional & non-functional requirements Document functional requirements • UML Use Case Diagram • Use Case Description Documents Identify actor(s) and association to use case Create different levels of use cases (re-use!) ARCH-2: UML 101 - From Design to Implementation using UML 21 © 2006 Progress Software Corporation AutoPark - Use Case View Use Case Packages ARCH-2: UML 101 - From Design to Implementation using UML 22 © 2006 Progress Software Corporation AutoPark - Use Case View ud Testdriv e Appointment Maintenance Use Case Diagram AutoPark Testdrive Maintenance Manage test driv e appointments Sales Person (from Actors) Print and send testdriv e inv itation Print list of testdriv e appointments Administrativ e Person (from Actors) Process ev aluation form Process TestDriv e Request «extend» Manage Customers (from Testdrive Person Maintenance) Request TestDriv e Customer (from Actors) ARCH-2: UML 101 - From Design to Implementation using UML 23 © 2006 Progress Software Corporation AutoPark - Use Case View Describing use case scenario(s) Scenario = Use Case Activity Flow Basic Scenario Alternate Scenario(s) UML Activity Diagram • Describe what happens, now how! ARCH-2: UML 101 - From Design to Implementation using UML 24 © 2006 Progress Software Corporation AutoPark - Use Case View ad Activ ity Diagram - Process TestDriv e Request ad Activ ity Diagram - Process Request Process TestDrive Request Start Activity Diagram Display List of Requests «UserActivity» Select Request to process and rev iew [Action = PROCESS] Process Request Start Validate User Business Request? [Business Request = NO] [BusinessRequest = YES] Create TestDriv e Appointment Create TestDriv e Request XML File Process Request [Action = REJECT] Delete Request Process Request End Process TestDrive Request ARCH-2: UML 101 - From Design to Implementation using UML 25 © 2006 Progress Software Corporation AutoPark - Use Case View Creating Test Scenarios Identify paths in activity diagram Create minimal test-scenarios (using each path once) Create all possible test-scenarios (combining all paths to create unique scenarios) ARCH-2: UML 101 - From Design to Implementation using UML 26 © 2006 Progress Software Corporation Agenda cd Logical View Ev aluation Introduction UML 2.0 Diagrams Use Case View Logical View Dynamic View Implementation View Demonstration Q&A ARCH-2: UML 101 - From Design to Implementation using UML - EvalCustomer: name EvalDate: date EvalScore: number 1-10 + validateEvaluation() : void Testdriv e - TestdriveDate: date TestdriveCustomer: customer TestdriveEmployee: employee TestdriveCar: car 27 © 2006 Progress Software Corporation AutoPark - Logical View Designing The System Structure Identify entities/things used in use case • • • • Identify attributes Identify operations Identify entity relations Identify multiplicity Create class diagram ARCH-2: UML 101 - From Design to Implementation using UML 28 © 2006 Progress Software Corporation AutoPark - Logical View cd Logical Data Model - Process TestDriv e Requests Class Diagram Request TestDriv e::Request Manage TestDriv e Appointments:: TestDriv e - Date: DATE EvalForm: LOGICAL currentCar: Car currentPerson: Person + + + + + + createTestDrive() : LOGICAL deleteTestDrive() : LOGICAL readTestDrive() : CHARACTER updateTestDrive() : LOGICAL findTestDrive() : CHARACTER validateTestDrive() : LOGICAL - FirstName: CHARACTER LastName: CHARACTER Email: CHARACTER PhoneNumber: CHARACTER BirthDate: DATE LicenseDate: DATE Brand: CHARACTER Model: CHARACTER Version: CHARACTER Engine: CHARACTER Business: LOGICAL + + + + createRequest() : LOGICAL deleteRequest() : LOGICAL readRequest() : CHARACTER findRequest() : CHARACTER 0..* 0..* 1 1 Manage Cars::Car - Brand: CHARACTER Model: CHARACTER Version: CHARACTER Color: CHARACTER Engine: CHARACTER Fuel: CHARACTER Description: CHARACTER AvailForTD: LOGICAL DateAdded: DATE + + + + + + createCar() : LOGICAL deleteCar() : LOGICAL readCar() : CHARACTER updateCar() : LOGICAL findCar() : CHARACTER validateCar() : LOGICAL Manage Customers::Person - FirstName: CHARACTER LastName: CHARACTER PhoneNumber: CHARACTER BirthDate: DATE LicenseDate: DATE + + + + + + createCustomer() : LOGICAL deleteCustomer() : LOGICAL updateCustomer() : LOGICAL readCustomer() : CHARACTER findCustomer() : CHARACTER validateCustomer() : LOGICAL ARCH-2: UML 101 - From Design to Implementation using UML 29 © 2006 Progress Software Corporation AutoPark - Logical View Patterns "A pattern is a proven solution to a problem in a context." ARCH-2: UML 101 - From Design to Implementation using UML 30 © 2006 Progress Software Corporation Agenda Introduction UML 2.0 Diagrams Requirements Logical View Dynamic View Implementation View Demonstration Q&A ARCH-2: UML 101 - From Design to Implementation using UML 31 © 2006 Progress Software Corporation AutoPark - Dynamic View Describing Behavior Identify objects involved Identify interactions (messages) • Use public operations Describe how things work ARCH-2: UML 101 - From Design to Implementation using UML 32 © 2006 Progress Software Corporation AutoPark - Dynamic View Describing Behavior e Diagram - Process TestDriv e Request (Client) Client Server «interface» Administrative Person Viewer Control Entity Request BE Process TestDrive Request::IProcessTDRequest listRequests showSelectScreen getRequests getRequests selectRequest showRequestDetails getRequestDetails getRequestDetails alt v alid request [true] acceptRequest(request) processRequest(request) processRequest(request) deleteRequest(request) [false] rejectRequest(request) deleteRequest(request) ARCH-2: UML 101 - From Design to Implementation using UML 33 © 2006 Progress Software Corporation Agenda Introduction UML 2.0 Diagrams Requirements Logical View Dynamic View Implementation View Demonstration Q&A ARCH-2: UML 101 - From Design to Implementation using UML 34 © 2006 Progress Software Corporation AutoPark - Implementation View id Manage Customers Name: Package: Version: Author: Manage Customers Manage Customers 1.0 Frank Beusenberg «realize» Manage Customers::CustomerMaintenanceView CustomerMaintenanceView .w «realize» CustomerMaintenanceControl CustomerMaintenanceModel «include» ttContext.i CustomerMaintenanceControl.p «includes» + + + + + + + + «realize» onValueChangedBrwsCustomer() : void onChooseBtnAdd() : void onChooseBtnModify() : void onChooseBtnDelete() : void onChooseButtonOK() : void onChooseBtnCancel() : void onChooseBtnHelp() : void onChooseBtnDone() : void + + + + + «Include» dsPerson.i - «includes» CustomerMaintenanceModel.p addCustomer() : void deleteCustomer() : void modifyCustomer() : void commitCustomer() : void getCustomer() : void «includes» «includes» DEFINE DATASET Person: «Include» proSIproxyStart.i includes - NEW GLOBAL SHARED VARIABLE ghProxySIproc: «realize PERSISTENT» «Include» etPerson.i «Program» ARCH-2: UML 101 - From Design to Implementation using UML proSIproxy.p 35 © 2006 Progress Software Corporation Agenda Introduction UML 2.0 Diagrams Requirements Logical View Dynamic View Implementation View Demonstration Q&A ARCH-2: UML 101 - From Design to Implementation using UML 36 © 2006 Progress Software Corporation Demonstration ARCH-2: UML 101 - From Design to Implementation using UML 37 © 2006 Progress Software Corporation In Summary Model & Design • Manage complexity • Minimize risk • Facilitate communication Use UML • De facto standard • Unambiguous • Documentation ARCH-2: UML 101 - From Design to Implementation using UML 38 © 2006 Progress Software Corporation For More Information, go to… Relevant Exchange Sessions ARCH-6: UML Modeling with Enterprise Architect ARCH-2: UML 101 - From Design to Implementation using UML 39 © 2006 Progress Software Corporation For More Information, go to… Relevant Web Resources Object Management Group • http://www.omg.org Hillside.net Patterns Library • http://hillside.net/patterns ARCH-2: UML 101 - From Design to Implementation using UML 40 © 2006 Progress Software Corporation For More Information, go to… Relevant Literature Addison-Wesley Object Technology Series UML Distilled Third Edition • Martin Fowler – ISBN 0-321-19368-7 Use Case Driven Object Modeling with UML • Doug Rosenberg – ISBN 0-201-43289-7 Developing Software with UML • Bernd Oestereich – ISBN 0-201-75603-X ARCH-2: UML 101 - From Design to Implementation using UML 41 © 2006 Progress Software Corporation Questions? ARCH-2: UML 101 - From Design to Implementation using UML 42 © 2006 Progress Software Corporation Thank you for your time ARCH-2: UML 101 - From Design to Implementation using UML 43 © 2006 Progress Software Corporation ARCH-2: UML 101 - From Design to Implementation using UML 44 © 2006 Progress Software Corporation