Analysis and Design with UML Course Overview ObjectOriented
Analysis and Design with UML Course ÊOverview - Object-Oriented outlines Modeling ÊBenefits of Visual Modeling ÊHistory of the UML ÊVisual Modeling with UML ÊThe Rational Iterative Development Process
Object-Oriented Modeling Using UML
Object-Oriented Modeling ÊUses object-orientation as a basis of modeling ÊModels a system as a set of objects that interact with each others ÊNo semantic gap (or impedance mismatch) ÊSeamless development process Conceptual/computational world Real world Abstraction Interpretation Data-oriented Object-oriented 3
Key Ideas of O-O Modeling ÊAbstraction ÊEncapsulation ÊRelationship ÊAssociation: relationship between objects ÊInheritance: mechanism to represent similarity among objects ÊObject-oriented = object (class) + inheritance + message send 4
Objects vs. Classes Interpretation in the Real World Representation in the Model Object An object represents anything in the real world that can be distinctly identified. An object has an identity, a state, and a behavior. Class A class represents a set of objects with similar characteristics and behavior. These objects are called instances of the class. A class characterizes the structure of states and behaviors that are shared by all of its instances. 5
Object = Identity + State + Behavior ÊIdentity Distinguishes an object from all other objects. ÊState Consists of a set of attributes (or fields), which have names, types, and values. ÊBehavior ÊDefined by the set of operations (or methods) that may operate on the object. ÊEach method has a name, a type, and a value, where ÊThe type consists of the return type and the list of parameter types of the method, often called signature. ÊThe value is the implementation of the method often expressed as a sequence of statements, in languages like 6
Class ÊCharacterizes the structure of states and the behaviors shared by all instances. ÊDefines a template for creating or instantiating instances. ÊNames and types of all fields ÊNames, signatures, and implementations of all methods. 7
What is Visual Modeling? Order Item Modeling captures essential “ parts of the system. ” Dr. James Rumbaugh Ship via Business Process Computer System Visual Modeling is Modeling using standard 8
Visual Modeling Captures-Business Process Use Case Analysis is a technique to capture business process from user’s perspective 9
Visual Modeling is a Communication Tool Use visual modeling to capture business objects and logic Use visual modeling to analyze and design your application 10
Visual Modeling Defines Software Architecture User Interface (Visual Basic, Java) Business Logic (C++, Java) Database Server (C++ & SQL) Model your system independent of implementation language Copyright © 1997 by Rational Software Corporation 11
Visual Modeling - Promotes Reuse Multiple Systems Reusable Components Copyright © 1997 by Rational Software Corporation 12
What is the UML? UML stands for Unified Modeling Language ÊThe UML combines the best of the best from ÊData Modeling concepts (Entity Relationship Diagrams) ÊBusiness Modeling (work flow) ÊObject Modeling ÊComponent Modeling Ê The UML is the standard language for visualizing, specifying, constructing, and documenting the artifacts of a softwareintensive system Copyright © 1997 by Rational Software Corporation 13
History of the UML Nov ‘ 97 UML approved by the OMG 14
History of the UML 15
UML Supports : Application Development Relationships Objects Business Objects large scale system ORDBMS Oracle Classes application partitioning Components Microsoft Scenarios Use Cases Active. X/COM Microsoft CORBA OMG Business Process Copyright © 1997 by Rational Software Corporation 16
UML Concepts The UML may be used to: Display the boundary of a system & its major functions using use cases and actors Illustrate use case realizations with interaction diagrams Represent a static structure of a system using class diagrams Model the behavior of objects with state transition diagrams Reveal the physical implementation architecture with component & deployment diagrams 17
Unified Modeling Language (UML) ÊNotation for object-oriented modeling ÊStandardized by Object Management Group (OMG) ÊConsists of 12+ different diagrams ÊUse case diagram ÊClass diagram ÊStatechart diagram ÊSequence diagram ÊCollaboration diagram ÊComponent diagram Ê… 18
Static vs. Dynamic Models ÊStatic model ÊDescribes static structure of a system ÊConsists of a set of objects (classes) and their relationships èRepresented as class diagrams ÊDynamic model ÊDescribes dynamic behavior of a system, such as state transitions and interactions (message sends) èRepresented as statechart diagram, sequence diagrams, and collaboration diagrams 19
UML Diagrams In terms of the views of a model, the UML defines the following graphical use case diagrams: class diagram interaction diagrams: sequence diagram collaboration diagram implementation diagrams: component diagram deployment diagram behavior diagrams: statechart diagram activity diagram 20
Putting the UML to Work The ESU University wants to computerize their registration system: Ê The Registrar sets up the curriculum for a semester Ê One course may have multiple course offerings Ê Students select 4 primary courses and 2 alternate courses Ê Once a student registers for a semester, the billing system is notified so the student may be billed for the semester Ê Students may use the system to add/drop courses for a period of time after registration Ê Professors use the system to receive their course offering rosters Ê Users of the registration system are assigned passwords which are used at logon validation Copyright © 1997 by Rational Software Corporation 21
Actors An actor is: someone or some thing that must interact with the system under development Registrar Professor Student Billing System Copyright © 1997 by Rational Software Corporation 22
Use Cases Ê A use case is a pattern of behavior the system exhibits Ê Each use case is a sequence of related transactions performed by an actor and the system in a dialogue Ê Actors are examined to determine their needs Ê Registrar -- maintain the curriculum Ê Professor -- request roster Ê Student -- maintain schedule Ê Billing System -- receive billing information from registration Use Cases Maintain Curriculum Request Course Roster Maintain Schedule Copyright © 1997 by Rational Software Corporation 23
Documenting Use Cases Ê A flow of events document is created for each use cases Ê Written from an actor point of view Ê Details what the system must provide to the actor when the use cases is executed Ê Typical contents Ê How the use case starts and ends Ê Normal flow of events Ê Alternate flow of events Ê Exceptional flow of events Copyright © 1997 by Rational Software Corporation 24
Registrar -- Maintain Curriculum: Flow of Events Ê This use case begins when the Registrar logs onto the Registration System and enters his / her password. The system verifies that the password is valid (E-1) and prompts the Registrar to select the current semester or a future semester (E-2). The Registrar enters the desired semester. The system prompts the professor to select the desired activity: ADD, DELETE, REVIEW, or QUIT. Ê If the activity selected is ADD, the S-1: Add a Course subflow is performed. Ê If the activity selected is DELETE, the S-2: Delete a Course subflow is performed. Ê If the activity selected is REVIEW, the S-3: Review Curriculum subflow is performed. Ê If the activity selected is QUIT, the use case ends. Copyright © 1997 by Rational Software Corporation Ê. . . 25
Use Case Diagram Use case diagrams are created to visualize the relationships between actors and use cases Request Course Roster Professor Student Maintain Schedule Billing System Maintain Curriculum Registrar Copyright © 1997 by Rational Software Corporation 26
Uses and Extends Use Case Relationships As the use cases are documented, other use case relationships may be discovered ÊA uses relationship shows behavior that is common to one or more use cases <<uses>> ÊAn extends relationship shows optional Register for courses behavior <<uses>> Logon validation Maintain curriculum 27
Use Case Realizations ÊThe use case diagram presents an outside view of the system ÊInteraction diagrams describe how use cases are realized as interactions among societies of objects Two types of interaction diagrams ÊSequence diagrams ÊCollaboration diagrams Copyright © 1997 by Rational Software Corporation 28
Sequence Diagram A sequence diagram displays object interactions arranged in a time sequence registration form : Student registration manager math 101 section 1 : fill in info 1 : submit 2 : add course(joe, math 01)3 : are you open? 4 : are you open? 5 : add (joe)6 : add (joe)7 Copyright © 1997 by Rational Software Corporation 29
Collaboration Diagram A collaboration diagram displays object interactions organized around objects and their links to one another : set course info 1 : process 2 course form : Course. Form : add course 3 : Registrar the. Manager : Curriculum. Manager a. Course : new course 4 Copyright © 1997 by Rational Software Corporation 30
Class Diagrams ÊA class diagram shows the existence of classes and their relationships in the logical view of a system ÊUML modeling elements in class diagrams ÊClasses and their structure and behavior ÊAssociation, aggregation, dependency, and inheritance relationships ÊMultiplicity and navigation indicators ÊRole names Copyright © 1997 by Rational Software Corporation 31
Classes Ê A class is a collection of objects with common structure, common behavior, common relationships and common semantics Ê Classes are found by examining the objects in sequence and collaboration diagram Ê A class is drawn as a rectangle with three compartments Ê Classes should be named using the vocabulary of the domain Copyright © 1997 by Rational Software Corporation Ê Naming standards should be created 32
Classes Schedule. Algorithm Registration. Form Registration. Manager Course Student Professor Course. Offering Copyright © 1997 by Rational Software Corporation 33
Operations ÊThe behavior of a class is represented by its operations ÊOperations may be found by examining interaction diagrams registration form registration manager Registration. Manager : add course(joe, math 01)3 add. Course(Student, Course ) Copyright © 1997 by Rational Software Corporation 34
Attributes ÊThe structure of a class is represented by its attributes ÊAttributes may be found by examining class definitions, the problem requirements, and by applying domain knowledge Course. Offering Each course offering has a number, location and time number location time Copyright © 1997 by Rational Software Corporation 35
Classes Schedule. Algorithm Registration. Form Registration. Manager add. Student(Course, Student. Info) Course name number. Credits Student open() add. Student(Student. Info) name major Professor name tenure. Status Course. Offering location open() add. Student(Student. Info) Copyright © 1997 by Rational Software Corporation 36
Relationships Ê Relationships provide a pathway for communication between objects Ê Sequence and/or collaboration diagrams are examined to determine what links between objects need to exist to accomplish the behavior -- if two objects need to “talk” there must be a link between them Ê Three types of relationships are: Ê Association Ê Aggregation Ê Dependency Copyright © 1997 by Rational Software Corporation 37
Relationships Ê An association is a bi-directional connection between classes Ê An association is shown as a line connecting the related classes Ê An aggregation is a stronger form of relationship where the relationship is between a whole and its parts Ê An aggregation is shown as a line connecting the related classes with a diamond next to the class representing the whole Ê A dependency relationship is a weaker form of relationship showing a relationship between a client and a supplier where the client does not have semantic knowledge of the supplier Ê A dependency is shown as a dashed line pointing from the client to the supplier 38
Finding Relationships ÊRelationships are discovered by examining interaction diagrams ÊIf two objects must “talk” there must be a pathway for communication Registration. Manager Registration Manager Math 101: Course : add student(joe)3 Course Copyright © 1997 by Rational Software Corporation 39
Relationships Schedule. Algorithm Registration. Form Registration. Manager add. Student(Course, Student. Info) Course name number. Credits Student open() add. Student(Student. Info) name major Professor name tenure. Status Course. Offering location open() add. Student(Student. Info) Copyright © 1997 by Rational Software Corporation 40
Multiplicity and Navigation Ê Multiplicity defines how many objects participate in a relationships Ê Multiplicity is the number of instances of one class related to ONE instance of the other class Ê For each association and aggregation, there are two multiplicity decisions to make: one for each end of the relationship Ê Although associations and aggregations are bidirectional by default, it is often desirable to restrict navigation to one direction Ê If navigation is restricted, an arrowhead is added to Copyright © 1997 by Rational Corporation indicate the direction of the. Software navigation 41
Multiplicity and Navigation Schedule. Algorithm Registration. Form *. . 0 1 Registration. Manager add. Student(Course, Student. Info) Course 1 *. . 0 Student name number. Credits open() add. Student(Student. Info) major 1 10. . 3 Professor tenure. Status *. . 1 4 1 Course. Offering location 4. . 0 open() add. Student(Student. Info) Copyright © 1997 by Rational Software Corporation 42
Inheritance (IS-A) ÊInheritance is a relationships between a superclass and its subclasses ÊThere are two ways to find inheritance: ÊGeneralization ÊSpecialization ÊCommon attributes, operations, and/or relationships are shown at the highest applicable level in the hierarchy Copyright © 1997 by Rational Software Corporation 43
Inheritance Schedule. Algorithm Registration. Form Registration. Manager add. Student(Course, Student. Info) Course name number. Credits Registration. User name Student open() add. Student(Student. Info) major Professor tenure. Status Course. Offering location open() add. Student(Student. Info) Copyright © 1997 by Rational Software Corporation 44
The State of an Object ÊA state transition diagram shows ÊThe life history of a given class ÊThe events that cause a transition from one state to another ÊThe actions that result from a state change ÊState transition diagrams are created for objects with significant dynamic behavior Copyright © 1997 by Rational Software Corporation 45
State Transition Diagram Add student[ count < 10 ] Add Student / Set count = 0 Initialization Open do: Initialize course entry: Register student exit: Increment count Cancel [ count = 10 ] Canceled do: Notify registered students Cancel Closed do: Finalize course Copyright © 1997 by Rational Software Corporation 46
The Physical World ÊComponent diagrams illustrate the organizations and dependencies among software components ÊA component may be ÊA source code component ÊA run time components or ÊAn executable component Copyright © 1997 by Rational Software Corporation 47
Component Diagram Register. exe Billing System People. dll User Course. dll Course Student Course Professor Course Offering Copyright © 1997 by Rational Software Corporation 48
Deploying the System ÊThe deployment diagram shows the configuration of run-time processing elements and the software processes living on them ÊThe deployment diagram visualizes the distribution of components across the enterprise. Copyright © 1997 by Rational Software Corporation 49
Deployment Diagram Registration Database Main Building Library Dorm 50
Extending the UML ÊStereotypes can be used to extend the UML notational elements ÊStereotypes may be used to classify and extend associations, inheritance relationships, classes, and components Examples: ÊClass stereotypes: boundary, control, entity, utility, exception ÊInheritance stereotypes: uses and extends Copyright © 1997 by Rational Software Corporation ÊComponent stereotypes: subsystem 51
What the Iterative Life Cycle Is Not Ê It is not hacking Ê It is not a playpen for developers Ê It is not unpredictable Ê It is not redesigning the same thing over and over until it is perfect Ê It is not an excuse for not planning and managing a project Copyright © 1997 by Rational Software Corporation Ê It is not something that affects only the developers on 52
What the Iterative Life Cycle Is ÊIt is planned and managed ÊIt is predictable ÊIt accommodates changes to requirements with less disruption ÊIt is based on evolving executable prototypes, not documentation Copyright © 1997 by Rational Software Corporation ÊIt involves the user/customer throughout the 53
Three Important Features of the Iterative Approach ÊContinuous integration ÊNot done in one lump near the delivery date ÊFrequent, executable releases ÊSome internal; some delivered ÊAttack risks through demonstrable progress ÊProgress measured in products, not documentation or engineering estimates Copyright © 1997 by Rational Software Corporation 54
Resulting Benefits ÊReleases are a forcing function that drives the development team to closure at regular intervals ÊCannot have the “ 90% done with 90% remaining” phenomenon ÊCan incorporate problems/issues/changes into future iterations rather than disrupting ongoing production ÊThe project’s supporting elements (testers, writers, toolsmiths, CM, QA, etc. ) can better Copyright © 1997 by Rational Software Corporation 55
Risk Profile of an Iterative Development Inception Waterfall Elaboration Risk Construction Transition Preliminary Iteration Architect. Iteration Devel. Iteration Transition Iteration Postdeployment Time Copyright © 1997 by Rational Software Corporation 56
Risk Management Phase-by-Phase ÊInception ÊBracket the project’s risks by building a proof of concept ÊElaboration ÊDevelop a common understanding of the system’s scope and desired behavior by exploring scenarios with end users and domain experts ÊEstablish the system’s architecture ÊDesign common mechanisms to address systemwide issues Copyright © 1997 by Rational Software Corporation 57
Risk Management Phase-by-Phase (cont. ) ÊConstruction ÊRefine the architecture ÊRisk-driven iterations ÊContinuous integration ÊTransition ÊFacilitate user acceptance ÊMeasure user satisfaction ÊPost-deployment cycles ÊContinue evolutionary approach ÊPreserve architectural integrity Copyright © 1997 by Rational Software Corporation 58
Risk Reduction Drives Iterations Initial Project Risks Initial Project Scope Define scenarios to address highest risks Plan Iteration N Cost • Schedule • Collect cost and Iteration N Develop Iteration N • quality metrics Assess Iteration N Revise Overall Project Plan Cost • Schedule • Scope/Content • Revise Project Risks Reprioritize • Risks Eliminated Copyright © 1997 by Rational Software Corporation 59
Use Cases Drive the Iteration Process Inception Elaboration Iteration 1 Iteration 2 Construction Transition Iteration 3 “Mini-Waterfall” Process Iteration Planning Rqmts Capture Analysis & Design Implementation Test Prepare Release Copyright © 1997 by Rational Software Corporation 60
The Iteration Life Cycle: A Mini-Waterfall Results of previous iterations • Up-to-date risk assessment • Controlled libraries of models, • code, and tests Selected scenarios Iteration Planning Requirements Capture Analysis & Design Implementation Test Prepare Release description Updated risk assessment Controlled libraries Copyright © 1997 by Rational Software Corporation 61
Detailed Iteration Life Cycle Activities ÊIteration planning ÊBefore the iteration begins, the general objectives of the iteration should be established based on ÊResults of previous iterations ( if any) ÊUp-to-date risk assessment for the project ÊDetermine the evaluation criteria for this iteration ÊPrepare detailed iteration plan for inclusion in the development plan ÊInclude intermediate milestones to monitor progress ÊInclude walkthroughs and reviews Copyright © 1997 by Rational Software Corporation 62
Detailed Iteration Life Cycle Activities (cont. ) ÊRequirements Capture ÊSelect/define the use cases to be implemented in this iteration ÊUpdate the object model to reflect additional domain classes and associations discovered ÊDevelop a test plan for the iteration Copyright © 1997 by Rational Software Corporation 63
Detailed Iteration Life Cycle Activities (cont. ) ÊAnalysis & Design ÊDetermine the classes to be developed or updated in this iteration ÊUpdate the object model to reflect additional design classes and associations discovered ÊUpdate the architecture document if needed ÊBegin development of test procedures ÊImplementation ÊAutomatically generate code from the design model ÊManually generate code for operations ÊComplete test procedures by Rational Software Corporation ÊConduct unit. Copyright and© 1997 integration tests 64
Detailed Iteration Life Cycle Activities (cont. ) ÊTest ÊIntegrate and test the developed code with the rest of the system (previous releases) ÊCapture and review test results ÊEvaluate test results relative to the evaluation criteria ÊConduct an iteration assessment ÊPrepare the release description ÊSynchronize code and design models ÊPlace products of the iteration in controlled libraries Copyright © 1997 by Rational Software Corporation 65
Work Allocation Within an Iteration Ê Work to be accomplished within an iteration is determined by Ê The (new) use cases to be implemented Ê The rework to be done Ê Packages make convenient work packages for developers Ê High-level packages can be assigned to teams Ê Lower-level packages can be assigned to individual developers Ê Use Cases make convenient work packages for test and assessment teams Ê Packages are also useful in determining the granularity at which configuration management will be Copyright © 1997 by Rational Software Corporation applied 66
Iteration Assessment ÊAssess iteration results relative to the evaluation criteria established during iteration planning: ÊFunctionality ÊPerformance ÊCapacity ÊQuality measures ÊConsider external changes that have occurred during this iteration ÊFor example, changes to requirements, user needs, competitor’s plans ÊDetermine what rework, if any, is required and Copyright © 1997 by Rational Software Corporation 67
Selecting Iterations ÊHow many iterations do I need? ÊOn projects taking 18 months or less, 3 to 6 iterations are typical ÊAre all iterations on a project the same length? ÊUsually ÊIteration length may vary by phase. For example, elaboration iterations may be shorter than construction iterations Copyright © 1997 by Rational Software Corporation 68
The First Iteration ÊThe first iteration is usually the hardest ÊRequires the entire development environment and most of the development team to be in place ÊMany tool integration issues, team-building issues, staffing issues, etc. must be resolved ÊTeams new to an iterative approach are usually overly-optimistic ÊBe modest regarding the amount of functionality that can be achieved in the first iteration ÊOtherwise, completion of the first iteration will be Copyright © 1997 by Rational Software Corporation delayed, 69
There Is No Silver Bullet ÊRemember the main reason for using the iterative life cycle: ÊYou do not have all the information you need up front ÊThings will change during the development period ÊYou must expect that ÊSome risks will not be eliminated as planned ÊYou will discover new risks along the way ÊSome rework will be required; some lines of code developed for an iteration will be thrown away ÊRequirements will change along the way Copyright © 1997 by Rational Software Corporation 70
- Slides: 70