Transcript Slide 1
Object Oriented Methodologies Week05 Jerry Kotuba SYST39409-Object Oriented Methodologies 1 Agenda Schedule Review Solution for ICE-02 Recap last class Use Cases Notation (start/end) Orthogonal Lines File type pdf or docx only Discovery Narratives Activity Diagrams Packages Class Diagrams Jerry Kotuba SYST39409-Object Oriented Methodologies 2 Events and Use Cases Use case Activity the system carries out Entry point into the modeling process Discovery Techniques Event decomposition User goal CRUD Elementary business processes (EBPs) Basic unit of analysis Initiated by event occurring at specific time and place Discrete system response that adds business value Jerry Kotuba SYST39409-Object Oriented Methodologies 3 Final Word on Use Cases Large software projects usually organized into packages. Package is a placeholder Each package contains a set of use cases for handling a certain type of business activity. E.g. Supply Chain Management System Jerry Kotuba Warehouse & Shipping Order Processing Accounting Inventory Management SYST39409-Object Oriented Methodologies 4 Jerry Kotuba SYST39409-Object Oriented Methodologies 5 Example without Package Notation Jerry Kotuba SYST39409-Object Oriented Methodologies 6 Example using Package Notation Jerry Kotuba SYST39409-Object Oriented Methodologies 7 Class Diagrams- Objectives Identify and analyze the objects and object-classes needed in a system Learn how to identify and represent relationships between object classes. Learn how to identify and create super/subclass relationships Learn how to create a Unified Modeling Language (UML) class diagram using System Architect Jerry Kotuba SYST39409-Object Oriented Methodologies 8 Problem Domain Classes Problem domain Abstraction”Real World” to “Data world” Set of work-related “things” in system component Examples: products, orders, invoices, customers OO approach to things in problem domain Things have data representation within system Objects that interact in the system Identify and understand things in problem domain Jerry Kotuba Key initial steps in defining requirements SYST39409-Object Oriented Methodologies 9 Types of Things Things can be identified with methodology Separate the tangible from the intangible Include information from all types of users Ask important questions about nature of event Jerry Kotuba “What actions upon things should be acknowledged and recorded by the system?” SYST39409-Object Oriented Methodologies 10 Jerry Kotuba SYST39409-Object Oriented Methodologies 11 Procedure for Developing an Initial List of Things Perform Textual Analysis List nouns users mention when discussing system Event table as source of potential things Use cases, external agents, triggers, response Select nouns with questions concerning relevance Further research may be needed Jerry Kotuba SYST39409-Object Oriented Methodologies 12 Pharmacy System Example Jerry Kotuba SYST39409-Object Oriented Methodologies 13 Associations among Things Analyst document entity associations ( relationships) Associations apply in two directions Customer places an order An order is placed by a customer Multiplicity: the number of associations Example: “Is placed by” and “works in” One to one or one to many The associations between types of things Jerry Kotuba Unary (recursive), binary, n-ary SYST39409-Object Oriented Methodologies 14 Associations Naturally Occur between Things Jerry Kotuba SYST39409-Object Oriented Methodologies 15 Multiplicity of Relationships Jerry Kotuba SYST39409-Object Oriented Methodologies 16 Attributes of Things Specific details of things are called attributes Analyst should identify attributes of things Identifier (key): attribute uniquely identifying thing Examples: Social Security number, vehicle ID number, or product ID number Compound attribute is a set of related attributes Jerry Kotuba Example: multiple names for the same customer SYST39409-Object Oriented Methodologies 17 Jerry Kotuba SYST39409-Object Oriented Methodologies 18 Classes and Objects Domain model class diagram as UML class OOA applies domain model class diagram to things Problem domain objects have attributes Software objects encapsulate attributes and behaviors Behavior: action that the object processes itself Software objects communicate with messages Information system is a set of interacting objects Jerry Kotuba SYST39409-Object Oriented Methodologies 19 Jerry Kotuba SYST39409-Object Oriented Methodologies 20 Jerry Kotuba SYST39409-Object Oriented Methodologies 21 Jerry Kotuba SYST39409-Object Oriented Methodologies 22 Exercises No 1 to No 3 To be done in class for illustration and practice Jerry Kotuba SYST39409-Object Oriented Methodologies 23 Your Turn…ICE-03 See SLATE Jerry Kotuba SYST39409-Object Oriented Methodologies 24 25 Class Diagrams Document the static structure of the system They define what classes there are and how they are related The symbol on the right defines the data and behaviour encapsulated by a class. Objects “know things and know how to do things!” SYST39409 - Object Oriented Methodologies Jerry Kotuba Hierarchies in Class Diagram Notation Generalization/specialization notation Inheritance hierarchy Rank things the more general to the more special Motor vehicle class includes trucks, cars, buses Classification: means of defining classes of things Superclass: generalization of a class Subclass: specialization of a class Jerry Kotuba SYST39409-Object Oriented Methodologies 26 Jerry Kotuba SYST39409-Object Oriented Methodologies 27 Associations/Relationships relationship among object classes solid line connecting classes association is named i.e. “drives” where line connects to class is called “association role” Associations/Relationships Associations with Multiplicity shows number of objects in an association lower..upper bound bounds are inclusive 2..5 0..1 = optional one 0..* = optional many 1..* = many 1 = exactly one The complexity of the Many-to-many relationships- The “Association Class” Examples Illustration Exercises SLATE2– Lesson 4 Class Diagram Exercises No 1,2 &3 Jerry Kotuba SYST39409 - Object Oriented Methodologies 31 Subclasses Some instances of a class (subclass) may be grouped together based on features not shared by the rest of the class. Attributes Behavior Relationships Key verb is “isakinda” (and inverse, “canbea”). Jerry Kotuba SYST39409 - Object Oriented Methodologies 33 Subclasses and Inheritance A subclass is made up of selected instances from another class, the “Parent class” or “superclass.” A superclass includes all the instances of the subclass, plus possibly more as well. Jerry Kotuba SYST39409 - Object Oriented Methodologies 34 Subclasses and Inheritance Each subclass then adds attributes and behaviors that it needs but the other Inheritance is when a subclass instance, in addition to the attributes and behavior it has by virtue of being in the subclass, also has all the attributes and behavior that instances of the superclass have. one doesn’t. Subclasses and Inheritance The subclass relationship actually is a relationship in the way we have used that word. It requires a verb (one in each direction). Jerry Kotuba “isakinda” “canbea” SYST39409 - Object Oriented Methodologies 36 Object-Oriented To be considered truly O-O, a language, database, etc. must support: Objects, Classes, Inheritance, and Polymorphism Jerry Kotuba SYST39409 - Object Oriented Methodologies 37 With subclasses, we can show more detail about relationships on our diagram. For instance, in most companies, only managers can hire and fire. In other words, only certain kindsa employees can do certain tasks. (only a baker can bake) We are able to show that some relationships affect only a subclass, not every instance. Subclasses Exercise - Ilustration SLATE2- Exercise No 4 Jerry Kotuba SYST39409 - Object Oriented Methodologies 39 41 generalization path Generalization, Inheritance & Constraints solid line with hollow arrowhead pointing from subclass to superclass indicate basis of generalization name the path for the attribute being removed = called the discriminator discriminator shows which property is abstracted by a generalization relationship SYST39409 - Object Oriented Methodologies Jerry Kotuba 42 Constraints on Generalization constraints on the subclasses overlapping: descendent may be descended from more than one of the subclasses student can be both a research and teaching assistant disjoint: descendent may not be descended from more than one of the subclasses patient can not be both out and resident SYST39409 - Object Oriented Methodologies Jerry Kotuba 43 Constraints on Generalization complete: all subclasses are listed only have out and resident patients incomplete: all subclasses are not listed more subclasses are available can have casual, parttime employees SYST39409 - Object Oriented Methodologies Jerry Kotuba Your turn… SLATE2 – ICE-04 Jerry Kotuba SYST39409 - Object Oriented Methodologies 44