Analysis What shall we do? OOA/OOD Design How shall we do it? Implementation Do it! Testing Did we get it right? Deployment Start it! Maintenance Keep it running! (fix bugs, add functionality, etc )
Documentation UML UML is a standard notation, not a programming language! Shows the system s structure and function (static and dynamic aspects) Helps us see the forest in spite of all the trees We use: Use cases / Use case diagrams Class diagrams Interaction diagrams
Use cases Used for: communication with customer understanding the system Especially useful during early planning Describe typical interactions between user and system Input from customer and domain experts
Use cases Short textual descriptions Can be shown in diagram form Note: Use cases describe dynamic features of a system, not static (classes) They are primarily useful when constructing interaction diagrams, not class diagrams
Use case Köp vara : Use case, snabbköp Aktör = kunden (K) System = expediten (E) 1. K visar varan för E 2. E ger K prisuppgift 3. K ger pengar till E 4. E registrerar köpet 5. E lämnar växel och kvitto till K alternative scenarios (other paths) Alt. I: 3. K har inte nog med pengar Alt. II: 1. K gömmer varan för E (snatteri!)
Use case diagram - snabbköp Use cases actor Köp vara Returnera vara System boundary kund Erhåll prisuppgift
Use case diagram - bank kassör Avsluta konto Betala räkning Insättning Ny kund Nytt konto <<extends>> kund nätbanken Överföring Uttag <<include>> <<include>> bankgirot <<include>> bankomat Erhåll saldo
Use case - bank Use case: Betala räkning via nätbanken: Kunden (i rollen som nätbanken) är inloggad på startsidan Systemet presenterar ett grafiskt formulär för att mata in bank- eller postgironummer Kunden matar in ett nummer Systemet verifierar att numret stämmer med användaren Systemet presenterar en meny med följande möjligheter osv
A stock trading company Functional requirements What shall the system handle? Persistent? Distributed? Non-functional requirements Fast User-friendly Extendable Object-oriented Time frame Resources DB Java Exercise - mäklare
Exercise - mäklare Construct a use case diagram for the broker application Which are the actors? (Are all humans?) What services should the system supply?
Conceptual diagram The problem subdivided into concepts Shows concepts, not software components Uses customer s terminology ( jargon ) Some concepts may become our classes Some will be thrown away Concepts identified through Use case descriptions Look for nouns ( substantivfrasidentifiering ) Diagram shows: concepts attributes associations
Attribute or concept? Concepts are composite Attributes are simple (values inside concepts) Ex: Is flight an attribute? ( SK499 ) Or is it a concept? (name= SK499, dest= ARN, aircraft= MDxx ) Is dest an attribute or a concept? (an airport)
Shows meaningful relations between concepts Associations May be given names Shows multiplicity Person name 1 1 has * TeenageChild owns 1 * Car color 1 1 drives 1 has has 4 1 Wheel Engine
Class diagram (Implementation) class diagram shows software classes Is based on the conceptual diagram Shows the static relations between types Requires software knowledge (usually the customer is no longer involved) Shows: Generalization Realization Associations (aggregation, composition) Multiplicity Navigability Attributes, and their visibility Operations, and their visibility
Exercise - mäklare Construct a class diagram for the stock trader Find: Classes Relations Multiplicity Navigability Important attributes and operations
Finding classes A dual process: class suggestion and class rejection Examining requirements documentation is not enough (also takes talent, expertise, luck, creativity, experience, intuition ) Is the concept a separate type with its own clearly identified operations? Is the concept relevant to the system? (Ex: Person has a Father and a Mother, but is this always relevant?)
Finding classes Association classes are usually not found by recognizing nouns (e.g. Employment, Transaction, Payment) Is the suggested class in fact a routine? Indications: This class does Verb as class name Class with a single public method Is the suggested class in fact a data record? (Can be appropriate in some situations e.g. CustomerInfo) Premature classification (Ex: Cow and Goat inheriting from Mammal instead of representing instances of Mammal)
Finding classes If a non-oo application exists, look for data structures, records, or files Look for useful patterns (which may introduce useful classes) [See chapter 22 in Mayer (1997): Object-oriented software construction ]
Describes how objects work together Based on use cases and contracts Typically, one diagram / use case Interaction diagrams Contract describes what happens, interaction diagrams describe how it happens Shows objects and the messages sent between them Reveals over-centralized designs Two kinds: 1. Sequence diagrams 2. Collaboration diagrams
Sequence diagram Objects are shown together with their lifelines Messages are sent between the lifelines :ClassA :ClassB ametod () anothermetod () athirdmetod () new () afourthmetod () :ClassC X
Objects are shown as icons Collaboration diagram Messages are numbered to show sequence 1:2:1 athirdmetod () :ClassA 1:1 ametod () :ClassB 1:2 anothermetod () 1:2:3 afourthmetod () 1:2:2 new () :ClassC
Package diagram Shows the big picture Shows packages and how they depend on each other Java.awt atm atm bank bank admin admin Dependency (a Dependency (a change change in core in core may require may changes require changes in the in the atm) atm) core core
How much A/D? Analysis paralysis Documents are useful for: Understanding the domain Communicating with customers and colleagues Documents have no value in themselves
Use case diagram - mäklare Köp Sälj Ny depå (portfölj) Starta system mäklare Ny kund Lämna aktiekurs Stoppa system Ny användare admin vd Ändra kunddata Lägg köp- /säljorder Totala värdet Hämta aktiekurs Veckorapport börsen sälj Bästa kunderna kalender
Note! The module about OOA/OOD (object-oriented analysis and design) contains a few OHs which are available only in paper format. Get them from Ulf N, or copy them from a fellow student!
This document was created with Win2PDF available at http://www.daneprairie.com. The unregistered version of Win2PDF is for evaluation or non-commercial use only.