1CS 580: Software SpecificationsCS 580: Software SpecificationsCS 580: Software SpecificationsCS 580: Software SpecificationsOCL 1: Introduction to OCL & USECopyright 2001-2002, Matt Dwyer, John Hatcliff, and Rod Howell. The syllabus and all lectures for this course are copyrighted materials and may not be used in other course settings outside of Kansas State University in their current form or modified form without the express written permission of one of the copyright holders. During this course, students are prohibited from selling notes to or being paid for taking notes by any person or commercial firm without the express written permission of one of the copyright holders. Used and modified with permission by Robert Stehwien.2OutlineOutlineOutlineOutlineOverview of UMLThe role of OCL within UMLObject model componentsdefines the states to which OCL constraints are appliedA brief look at OCLA brief look at USE3What is Software Modeling?What is Software Modeling?What is Software Modeling?What is Software Modeling?The designing of software applications before codingAn essential part of large software projects, and helpful to small and medium-sized projects as wellA model plays the analogous role in software development that blueprints and other plans (site maps, elevations, physical models) play in the building of a skyscraperModeling can help ensure that…business functionality is complete and correct end-user needs are met (requirements)program design supports scalability, robustness, security, extendibility, and other characteristicsbeforeimplementation in code renders changes difficult and expensive to make (do agile practices change the cost?)(Source: Introduction to OMG’s Unified Modeling Language)24What Do We Want To Model?What Do We Want To Model?What Do We Want To Model?What Do We Want To Model?System requirements (use cases)Basic situations in which a system is usedRoles of system usersSystem architecture (class models)Behavior of components (activity diagrams, state charts)Static and dynamic component interaction…5What is UML?What is UML?What is UML?What is UML?For the past 10+ years various proposals have been put forth about how to performobject-oriented analysis and modelingi.e., describing system designs in terms of objects and their inter-relationshipsThere have been at least 10 “methods”proposedUML is the “combination” of the most popular (Booch, Rumbaugh, Jacobson)6Design by CommitteeDesign by CommitteeDesign by CommitteeDesign by CommitteeAs a consequence UML isa collection of methodsrather than a single systematic approach to object modeling multiple methods for the same goalIt’s becoming a de-facto standardOMG oversees an ongoing a standardization effortwww.omg.org/umlIf you don’t use it already, you probably will ...37A Quick Overview of UMLA Quick Overview of UMLA Quick Overview of UMLA Quick Overview of UMLUML defines twelve types of diagrams divided into three categories…Structural DiagramsClass Diagram, Object Diagram, Component Diagram, and Deployment Diagram.Behavior DiagramsUse Case Diagram, Sequence Diagram, Activity Diagram, Collaboration Diagram, and Statechart Diagram.Model Management DiagramsPackages Diagram, Subsystems Diagram, and Models Diagram.Advanced features include the Object Constraint Language (OCL) and Action Semantics8Contrast with AlloyContrast with AlloyContrast with AlloyContrast with AlloyBoth UML and Alloy seek to describe…The (possible) state space of a systemthe transitions between statesin an implementation independent wayUML has a much broader scopeimplementation description (and synthesis) including system structure/architectureproblem domain modeling (requirements)many different ways of capturing behavior (state diagrams, activity diagrams, sequence diagrams, etc.)meant to be a bit imprecise to avoid committing to a particular platform (hard to make semantic checking/generating tools)tons of books written on UML – one on AlloyAlloy has a much more rigorous semantic foundation 9Structural Diagram ExampleStructural Diagram ExampleStructural Diagram ExampleStructural Diagram ExampleClass Diagramshows a set of classes, interfaces, and collaborations, and their relationshipsthe most common diagram found in modeling OO systemsaddress the static view of the systemwe will emphasize class diagrams with the USE tool410Class DiagramClass DiagramClass DiagramClass DiagramPersonage : Integerancestors() : Set(Person)married() : Booleansiblings() : Set(Person)Manmarried() : BooleanWomanmarried() : Booleanspousehusband wife0..1 0..1offspringparentschildren*0..2ClassAttributeOperationsAssociationRoleMultiplicity11Behavior Diagram ExampleBehavior Diagram ExampleBehavior Diagram ExampleBehavior Diagram ExampleUse Case Diagramshows a set of cases of system usesequence of actionsshows actors that participate in each use caseused to model the context of a systemdescribing which actors “outside the system”interact with itused to model the requirements of a system“what” (not “how”) the system should do as viewed from outside the system12Use Case DiagramUse Case DiagramUse Case DiagramUse Case DiagramPerform card transactionProcess customer billReconcile transactionsManage customer accountCredit CardValidation SystemCustomerIndividualCustomerCorporateCustomerRetail InstitutionSponsoringFinancial Institution(source: UML User Guide, Booch, Rumbaugh, Jacobson)513Behavior Diagram ExampleBehavior Diagram ExampleBehavior Diagram ExampleBehavior Diagram ExampleActivity Diagramshows flow from activity to activity within a systemaddresses the dynamic view of a systemglorified flow charts14Activity DiagramActivity DiagramActivity DiagramActivity Diagramproceed in parallel along outgoing arcswait here until activities on incoming arcs are complete15Module Management Diagram Module Management Diagram Module Management Diagram Module Management Diagram ExampleExampleExampleExamplePackages Diagram616UML is VisualUML is VisualUML is VisualUML is VisualA picture is worth a thousand wordspictures can be misleadingMost people can look at a UML description and get a “reasonable” idea of the parts of the system that are describedis reasonable good enough?Usually, yes!17UML ShortcomingsUML
View Full Document