modeling with uml chapter 2 lecture 1 overview modeling
play

Modeling with UML Chapter 2, lecture 1, Overview: modeling with UML - PDF document

Object-Oriented Software Engineering Using UML, Patterns, and Java Modeling with UML Chapter 2, lecture 1, Overview: modeling with UML What is modeling? What is UML? Use case diagrams Class diagrams Sequence diagrams Bernd


  1. Object-Oriented Software Engineering Using UML, Patterns, and Java Modeling with UML Chapter 2, lecture 1,

  2. Overview: modeling with UML ♦ What is modeling? ♦ What is UML? ♦ Use case diagrams ♦ Class diagrams ♦ Sequence diagrams Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 2

  3. What is modeling? ♦ Modeling consists of building an abstraction of reality. ♦ Abstractions are simplifications because: ! They ignore irrelevant details and ! They only represent the relevant details. ♦ What is relevant or irrelevant depends on the purpose of the model. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 3

  4. Example: street map Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 4

  5. Why model software? Why model software? ♦ Software is getting increasingly more complex ! Windows XP > 40 mio lines of code ! A single programmer cannot manage this amount of code in its entirety. ♦ Code is not easily understandable by developers who did not write it ♦ We need simpler representations for complex systems ! Modeling is a mean for dealing with complexity Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 5

  6. Systems, Models and Views ♦ A model is an abstraction describing a subset of a system ♦ A view depicts selected aspects of a model ♦ A notation is a set of graphical or textual rules for depicting views ♦ Views and models of a single system may overlap each other Examples: ♦ System: Aircraft ♦ Models: Flight simulator, scale model ♦ Views: All blueprints, electrical wiring, fuel system Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 6

  7. Systems, Models and Views Flightsimulator Blueprints Aircraft Model 2 View 2 View 1 System View 3 Model 1 Electrical Wiring Scale Model Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 7

  8. Models, Views and Systems (UML) * * System Mode l View Depic t ed by Descr i bed by Ai rp lane: Sys tem Sca le Mode l : Mode l F l igh t Simulato r : Mode l Bluepri n ts : V i ew Fue l Sys tem: V iew Elec t r i ca l Wi r i ng : V i ew Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 8

  9. Concepts and Phenomena Phenomenon ! An object in the world of a domain as you perceive it ! Example: The lecture you are attending ! Example: My black watch Concept ! Describes the properties of phenomena that are common. ! Example: Lectures on software engineering ! Example: Black watches Concept is a 3-tuple: ! Name (To distinguish it from other concepts) ! Purpose (Properties that determine if a phenomenon is a member of a concept) ! Members (The set of phenomena which are part of the concept) Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 9

  10. Concepts and phenomena Name Purpose Members Clock A dev i ce that measures t i me. ♦ Abstraction ! Classification of phenomena into concepts ♦ Modeling ! Development of abstractions to answer specific questions about a set of phenomena while ignoring irrelevant details. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 10

  11. Concepts in software: Type and Instance ♦ Type: ! An abstraction in the context of programming languages ! Name: int, Purpose: integral number, Members: 0 , - 1 , 1 , 2 , - 2 , . . . ♦ Instance: ! Member of a specific type ♦ The type of a variable represents all possible instances the variable can take The following relationships are similar: ! “type” <–> “instance” ! “concept” <–> “phenomenon” Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 11

  12. Abstract Data Types & Classes ♦ Abstract data type ! Special type whose implementation is hidden Watch from the rest of the system. ♦ Class: time date ! An abstraction in the context of object- oriented languages SetDate(d) ♦ Like an abstract data type, a class encapsulates both state (variables) and behavior (methods) ! Class Vector CalculatorWatch ♦ Unlike abstract data types, classes can be calculatorState defined in terms of other classes using inheritance EnterCalcMode() InputNumber(n) Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 12

  13. Application and Solution Domain ♦ Application Domain (Requirements Analysis): ! The environment in which the system is operating ♦ Solution Domain (System Design, Object Design): ! The available technologies to build the system Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 13

  14. Object-oriented modeling Application Domain Solution Domain Application Domain Model System Model UML Package MapDispl ay Tra f f i cCont ro l Su m maryDisp lay F l igh tP lanDatabase Tra f f i cCont ro l l e r Ai rc ra f t Ai rpor t Tra f f i cCont ro l F l igh tP lan Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 14

  15. What is UML? ♦ UML (Unified Modeling Language) ! An emerging standard for modeling object-oriented software. ! Resulted from the convergence of notations from three leading object-oriented methods: " OMT (James Rumbaugh) " OOSE (Ivar Jacobson) " Booch (Grady Booch) ♦ Reference: “The Unified Modeling Language User Guide”, Addison Wesley, 1999. ♦ Supported by several CASE tools ! Rational ROSE ! TogetherJ Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 15

  16. UML: First Pass ♦ You can model 80% of most problems by using about 20 % UML ♦ We teach you those 20% Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 16

  17. UML First Pass ♦ Use case Diagrams ! Describe the functional behavior of the system as seen by the user. ♦ Class diagrams ! Describe the static structure of the system: Objects, Attributes, Associations ♦ Sequence diagrams ! Describe the dynamic behavior between actors and the system and between objects of the system ♦ Statechart diagrams ! Describe the dynamic behavior of an individual object (essentially a finite state automaton) ♦ Activity Diagrams ! Model the dynamic behavior of a system, in particular the workflow (essentially a flowchart) Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 17

  18. UML first pass: Use case diagrams Use case Package Watch Actor ReadT i me SetT ime WatchUser WatchRepa i rPerson ChangeBat te ry Use case diagrams represent the functionality of the system from user’s point of view Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 18

  19. UML first pass: Class diagrams Class diagrams represent the structure of the system Association Class Multiplicity Watch 1 1 1 1 2 1 2 1 PushBut t on LCDDisp l ay Bat te ry T ime l oad now s ta te b l ink Idx b l inkSeconds( ) push( ) b l inkMinut es ( ) re lease ( ) b l inkHours ( ) s topBl inki ng ( ) re fe resh( ) Attribute Operations Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 19

  20. UML first pass: Sequence diagram Actor Object :Watch :LCDDisp lay :T ime :WatchUser pressButton1 ( ) b l inkHours ( ) pressButton1 ( ) b l inkMinutes ( ) Message pressButton2 ( ) i nc rementMinu tes ( ) re f resh ( ) pressButtons1And2 ( ) com mi tNewTime( ) s topBl ink ing ( ) Activation Lifeline Sequence diagrams represent the behavior as interactions Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 20

  21. UML first pass: Statechart diagrams for objects with interesting dynamic behavior State Event Initial state [button2Pressed] [button1&2Pressed] BlinkHours IncrementHrs [button1Pressed] Transition [button2Pressed] [button1&2Pressed] BlinkMinutes IncrementMin. [button1Pressed] [button2Pressed] [button1&2Pressed] BlinkSeconds IncrementSec. Final state StopBlinking Represent behavior as states and transitions Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 21

  22. UML Summary ♦ UML provides a wide variety of notations for representing many aspects of software development ! Powerful, but complex language ! Can be misused to generate unreadable models ! Can be misunderstood when using too many exotic features ♦ For now we concentrate on a few notations: ! Functional model: Use case diagram ! Object model: class diagram ! Dynamic model: sequence diagrams, statechart and activity diagrams Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 22

Recommend


More recommend