Chapter 5, Object Modeling

Slides:



Advertisements
Similar presentations
Surgery Sessions (Weeks 6-10)
Advertisements

Database Systems: Design, Implementation, and Management Tenth Edition
Page 1W5D1 Models. Help us: Understand the system Verify the system Communicate with / coordinate development teams.
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 5, Analysis: Object Modeling.
Using UML, Patterns, and Java Object-Oriented Software Engineering Requirements Analysis (Part 1 – Object Modeling)
Use Case Diagram © copyright 2001 SNU OOPSLA Lab..
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 5: Analysis, Object Modeling.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 5, Analysis: Dynamic Modeling.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 8 Slide 1 System models.
Requirements Elicitation Chapter 4. Establishing Requirements Two questions –What is the purpose of the system –What is inside and what is outside the.
Use Cases Chapter 4. After Scenarios Find all the use cases in the scenario that specifies all possible instances of how to report a fire –Ex: “Report.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 5, Object Modeling.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 8 Slide 1 System models.
CS350/550 Software Engineering Lecture 1. Class Work The main part of the class is a practical software engineering project, in teams of 3-5 people There.
Requirements Elicitation. Requirement: a feature or constraint that the system must satisfy Requirements Elicitation: specification of the system that.
INTROSE Introduction to Software Engineering Raymund Sison, PhD College of Computer Studies De La Salle University Analysis Modeling.
COP 3331 OBJECT-ORIENTED ANALYSIS AND DESIGN Bob Myers Department of Computer Science Week 6 Lecture.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 1 Course slides Slightly modified from Uğur Doğrusöz’s.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 5, Object Modeling.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 4, Requirements Elicitation.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 1 Object Modeling.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 5: Analysis, Object Modeling.
Sommerville 2004,Mejia-Alvarez 2009Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
1 Introduction to Software Engineering Lecture 1.
Requirements as Usecases Capturing the REQUIREMENT ANALYSIS DESIGN IMPLEMENTATION TEST.
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 4, Requirements Elicitation: Functional Modeling.
Software Engineering Prof. Ing. Ivo Vondrak, CSc. Dept. of Computer Science Technical University of Ostrava
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 4, Requirements Elicitation: Functional Modeling.
1 Software Requirements l Specifying system functionality and constraints l Chapters 5 and 6 ++
Design Model Lecture p6 T120B pavasario sem.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 1 Software Engineering September 26, 2001 Analysis.
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 5, Analysis: Object Modeling.
OO DomainModeling With UML Class Diagrams and CRC Cards Chapter 6 Princess Nourah bint Abdulrahman University College of Computer and Information Sciences.
Object Oriented Analysis System modeling = Functional modeling + Object modeling + Dynamic modeling Functional modeling = Use cases Object modeling =class.
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 5, Analysis: Object Modeling.
Engineering, 7th edition. Chapter 8 Slide 1 System models.
5 Systems Analysis and Design in a Changing World, Fourth Edition.
Review of last class Software Engineering Modeling Problem Solving
CHAPTER
An Overview of Requirements Engineering Tools and Methodologies*
Software Engineering Lecture 4 System Modeling The Analysis Stage.
Requirements Engineering Process
Course Outcomes of Object Oriented Modeling Design (17630,C604)
Chapter 5: Analysis Object Modeling.
Software Lifecycle Activities
Systems Analysis and Design With UML 2
Unified Modeling Language
Chapter 5: Analysis Object Modeling.
Chapter 2, Modeling with UML
Chapter 5: Analysis, Object Modeling
OO Domain Modeling With UML Class Diagrams and CRC Cards
System Modeling Chapter 4
Abstract descriptions of systems whose requirements are being analysed
CSCE 606: Design Some material from B. Meyer, M. Oriol, B. Schoeller at ETH Zürich.
Chapter 5, Object Modeling
OO Domain Modeling With UML Class Diagrams and CRC Cards
Object-Oriented Analysis
Understand and Use Object Oriented Methods
Chapter 4, Requirements Elicitation: Functional Modeling
Analysis models and design models
Software Design Lecture : 15.
Copyright 2007 Oxford Consulting, Ltd
Chapter 4, Requirements Elicitation: Functional Modeling
Chapter 5, Analysis: Object Modeling
Software Analysis.
Design Yaodong Bi.
Chapter 4 System Modeling.
Software Development Process Using UML Recap
Presentation transcript:

Chapter 5, Object Modeling

Where we are, where we are going problem statement Requirements elicitation Requirements Specification nonfunctional requirements functional model Analysis Analysis Model dynamic model analysis object model

Reality and Model Reality R: Real Things, People, Processes happening during some time, Relationship between things Model M: Abstractions from (really existing or only thought of ) things, people , processes and relationships between these abstractions.

What is a “good” model? fM M M I I R R fR Relationships, which are valid in reality R, are also valid in model M. I : Mapping of real things in reality R to abstractions in the model M abbildet (Interpretation) fM: relationship between abstractions in M fR: relationship between real things inR In a good model the following diagram is commutative: fM M M I I R R fR

Models of models of models... Modeling is relative. We can think of a model as reality and can build another model from it (with additional abstractions). The development of Software-Systemes is a Transformation of Models: Analysis, Design, Implementation,Testing fM1 fR M1 R Requirements Elicitation I1 M2 Analysis I2 fM2 ….

Knowledge about Causality Knowledge about Functionality How do we model complex systems (Natural Systems, Social Systems, Artificial Systems)? Epistemology Describes our knowledge about the system Knowledge about Causality (Dynamic Model) Knowledge about Relationships (Object model) Knowledge about Functionality (Functional model) Uncertain Knowledge Fuzzy Sets (Zadeh) Inheritance Frames,SemanticNetworks (Minsky) Data Relationship (E/R Modeling, Chen) Hierarchical Database Model (IMS) State Diagrams (Harel) Sequence Diagrams (Lamport) Formal Specifications (Liskov) Scenarios/Use Cases (Jacobsen) DataFlow Diagrams (SA/SD) Neural Networks Petri Nets(Petri) Activity Diagrams (“good old Flow-charts” Class Diagrams (“E/R + Inheritance”, Rumbaugh) Fuzzy Frames (Graham) Network Database Model (CODASYL) Relational Database Model (Codd)

Activities during Object Modeling Main goal: Find the important abstractions What happens if we find the wrong abstractions? Iterate and correct the model Steps during object modeling 1. Class identification Based on the fundamental assumption that we can find abstractions 2. Find the attributes 3. Find the methods 4. Find the associations between classes Order of steps Goal: get the desired abstractions Order of steps secondary, only a heuristic Iteration is important Start with review: What is a model? What is an abstraction? They are used synonomously and mean they provide a simplified view of a complex system that we cannot understand by looking at all of its components simultaneously. Models by their definition abstract away important characteristics of a system by emphasizing other aspects. Example: Clay model concentrates on the form of the car, nobody can sit in it. Prototypes are models. Iterate and correct the model: A scientific model is always like a hypothesis. The important part of a scientific model is that it is falsifiable. This is an important aspect of prototyping. They are immediately understandable and can be falsified (that is our theory of how the application should work!). This is one of the main strengths of prototyping: End user falsifiability. Redesign (Falsification principle in science: Work with model until it is proven to be false)

Class Identification Identify the boundaries of the system Identify the important entities in the system Class identification is crucial to object-oriented modeling Basic assumption: 1. We can find the classes for a new software system (Forward Engineering) 2. We can identify the classes in an existing system (Reverse Engineering) Why can we do this? Philosophy, science, experimental evidence

Class identification is an ancient problem Objects are not just found by taking a picture of a scene or domain The application domain has to be analyzed. Depending on the purpose of the system different objects might be found How can we identify the purpose of a system? Scenarios and use cases Another important problem: Define system boundary. What object is inside, what object is outside?

Pieces of an Object Model Classes Associations (Relations) Generic associations Canonical associations Part of- Hierarchy (Aggregation) Kind of-Hierarchy (Generalization) Attributes Detection of attributes Application specific Attributes in one system can be classes in another system Turning attributes to classes Operations Detection of operations Generic operations: Get/Set, General world knowledge, design patterns Domain operations: Dynamic model, Functional model

Object vs Class Object (instance): Exactly one thing This lecture on Software Engineering on November 15 from 14:30 -16:00 A class describes a group of objects with similar properties Game, Tournament, mechanic, car, database Object diagram: A graphic notation for modeling objects, classes and their relationships ("associations"): Class diagram: Template for describing many instances of data. Useful for taxonomies, patters, schemata... Instance diagram: A particular set of objects relating to each other. Useful for discussing scenarios, test cases and examples

How do you find classes? Finding objects is the central piece in object modeling Learn about problem domain: Observe your client Apply general world knowledge and intuition Take the flow of events and find participating objects in use cases Try to establish a taxonomy Apply design knowledge: Distinguish different types of objects Apply design patterns Do a syntactic analysis of problem statement, scenario or flow of events Abbott Textual Analysis, 1983, also called noun-verb analysis Nouns are good candidates for classes Verbs are good candidates for opeations Q: What key ideas have we covered so far? A: Patterns, analysis documentation standard, inheritance and multiple inheritance. In the last part of this lecture I would like to come back to the problem of object identification and another tool that helps you infinding objects. Patterns: A way to put your knowledge about object modeling into drawers. Analysis documentation standard: The “official” way of drawing object models. The major elements are: CASE Tool Entry: Executive summary and one subsystem per sheet. 7+-2 classes per sheet. Documentation: Each subsystem has navigational text. Difference between aggregation and inheritence Object identification: Using textual analysis Multiple Inheritance: Why it cannot be avoided, how you can deal with it. Software engineering as a special case of Epistemology: Software engineering is a join class of materialism (budget and deadline influencing your modeling (They might limit what you can achieve!). Idealism: Some of the classes do not reflect reality (that is, the customer does not know about them) and dialecticism (iteration and incremental analysis with user participatory decision making capabilities).

Finding Participating Objects in Use Cases Pick a use case and look at its flow of events Find terms that developers or users need to clarify in order to understand the flow of events Look for recurring nouns (e.g., Incident), Identify real world entities that the system needs to keep track of (e.g., FieldOfficer, Dispatcher, Resource), Identify real world procedures that the system needs to keep track of (e.g., EmergencyOperationsPlan), Identify data sources or sinks (e.g., Printer) Identify interface artifacts (e.g., PoliceStation) Be prepared that some objects are still missing and need to be found: Model the flow of events with a sequence diagram Always use the user’s terms

Object Types Entity Objects Boundary Objects Control Objects: Represent the persistent information tracked by the system (Application domain objects, “Business objects”) Boundary Objects Represent the interaction between the user and the system Control Objects: Represent the control tasks performed by the system Having three types of objects leads to models that are more resilient to change. The interface of a system changes more likely than the control The control of the system change more likely than the application domain Object types originated in Smalltalk: Model, View, Controller (MVC)

Example: 2BWatch Objects Button Year ChangeDate Month LCDDisplay Day Entity Objects Control Objects Interface Objects

Naming of Object Types in UML UML provides several mechanisms to extend the language UML provides the stereotype mechanism to present new modeling elements <<Boundary>> Button <<Entity>> Year <<Control>> ChangeDate <<Entitity>> Month <<Boundary>> LCDDisplay <<Entity>> Day Entity Objects Control Objects Boundary Objects

Identifying boundary objects

Identifying control and entity objects

Recommended Naming Convention for Object Types To distinguish the different object types on a syntactical basis, we recommend suffixes: Objects ending with the “_Boundary” suffix are boundary objects Objects ending with the “_Control” suffix are control objects Entity objects do not have any suffix appended to their name. Button_Boundary Year ChangeDate_ Control Month LCDDisplay_Boundary Day

Identifying attributes and methods of a class Identifying methods Look at verbs in the problem statement Look at interactions between objects in the use case scenarios Look at interactions in the sequence diagrams Use prior knowledge of the problem domain

Identifying associations between classes Inheritance is the strongest form of association; it is based on a “kind of” relationship that is easy to identify Aggregation is the next strongest form of association; it is based on a “part of” relationship A strong form of aggregation is composition where the “part” uniquely belongs to the “whole” Other associations are more difficult to find

Example: Flow of events The customer enters a store with the intention of buying a toy for his child with the age of n. Help must be available within less than one minute. The store owner gives advice to the customer. The advice depends on the age range of the child and the attributes of the toy. The customer selects a dangerous toy which is kind of unsuitable for the child. The store owner recommends a yellow doll.

Mapping parts of speech to object model components [Abbott, 1983] Part of speech Model component Example Proper noun object Jim Smith Improper noun class Toy, doll Doing verb method Buy, recommend being verb inheritance is-a (kind-of) having verb aggregation has an modal verb constraint must be adjective attribute 3 years old transitive verb method enter intransitive verb method (event) depends on

Another Example Flow of events: The customer enters the store to buy a toy. It has to be a toy that his daughter likes and it must cost less than 50 Euro. He tries a videogame, which uses a data glove and a head-mounted display. He likes it. Is this a good use Case? An assistant helps him. The suitability of the game depends on the age of the child. His daughter is only 3 years old. The assistant recommends another type of toy, namely the boardgame “Monopoly". Not quite! “Monopoly” is probably a left over from the scenario The use case should terminate with the customer leaving the store

Textual Analysis using Abbot‘s technique Example Grammatical construct UML Component “Monopoly" Concrete Person, Thing Object “toy" noun class "3 years old" Adjective Attribute “enters" verb Operation “depends on…." Intransitive verb Operation (Event) “is a" ,“either..or", “kind of…" Classifying verb Inheritance "Has a ", “consists of" Possessive Verb Aggregation “must be", “less than…" modal Verb Constraint

Generation of a class diagram from flow of events Customer The customer enters the store to buy a toy. It has to be a toy that his daughter likes and it must cost less than 50 Euro. He tries a videogame, which uses a data glove and a head-mounted display. He likes it. customer enters store buy toy daughter store enter() ? enter() less than 50 Euro videogame daughter daughter age suitable * An assistant helps him. The suitability of the game depends on the age of the child. His daughter is only 3 years old. The assistant recommends another type of toy, namely a boardgame. The customer buy the game and leaves the store depends toy price buy() like() toy toy buy() age type of toy boardgame videogame boardgame

Order of activities in modeling Formulate a few scenarios with help from the end user and/or application domain expert. Extract the use cases from the scenarios, with the help of application domain expert. Analyse the flow of events, for example with Abbot's textual analysis. Generate the class diagrams, which includes the following steps: Class identification (textual analysis, domain experts). Identification of attributes and operations (sometimes before the classes are found!) Identification of associations between classes Identification of multiplicities Identification of roles Identification of constraints

Don’t put too many classes into the same package: Avoid Ravioli Models Customer Name CustomerId Account Amount Deposit() Withdraw() GetBalance() AccountId Bank Has * Savings Account Checking Account Mortgage Account Don’t put too many classes into the same package: 7+-2 (or even 5+-2) Withdraw() Withdraw() Withdraw()

Put Taxonomies on a separate Diagram Account Amount Deposit() Withdraw() GetBalance() CustomerId AccountId Savings Account Checking Account Mortgage Account Withdraw() Withdraw() Withdraw()

Project Management Heuristics Explicitly schedule meetings for object identification First just find objects Then try to differentiate them between entity, interface and control objects Find associations and their multiplicity Unusual multiplicities usually lead to new objects or categories Identify Inheritance: Look for a Taxonomy, Categorize Identify Aggregation Allow time for brainstorming , Iterate, iterate, iterate, …

Who uses class diagrams? Purpose of Class diagrams : The description of the static properties of a system (main purpose) Who uses class diagrams? The customer and the end user are often not interested in class diagrams. They usually focus more on the functionality of the system. The application domain expert uses class diagrams to model the application domain The developer uses class diagrams during the development of a system,that is, during analysis, system design, object design and implementation.

Class-diagrams have different types of „users“ According to the development activity, the developer plays different roles. Analyst System-Designer, DetailedDesigner Implementor. In small systems some of the roles do not exist or are played by the same person. Each of these roles has a different view about the models. Before I describe these different views, I want to distinguish the types of classes that appear in class diagrams. Application domain classes Solution domain classes

Application domain vs solution domain The problem domain (financial services, meteorology, accident management, architecture, …). Application domain class: An abstraction in the application domain. If we model business applications, these classes are also called business objects. Example: Board game, Tournament Solution domain: Domains that help in the solution of problems (tele communication, data bases, compiler construction, operting systems, ….) Solution domain class: An abstraction, that is introduced for technical reasons, because it helps in the solution of a problem. Examples: Tree, Hashtable, Scheduler

The Role of the Analyst The analyst is interested in application classes: The associations between classes are relationships between abstractions in the application domain. whether the use of inheritance in the model reflect the taxonomies in the application domain. Definition Taxonomy: A hierarchy of abstractions The analyst is not interested in the exact signature of operations. in solution classes.

Designer The designer focuses on the solution of the problem, that is the solution domain. Design consists of many tasks (subsystem decomposition, selection of the hardware platform, data management system, etc.). An important design problem is the specification of interfaces: The designer describes the interface of classes (object design) and subsystems (system design). The goal of the designer is usability and reusability of interface Design-Usability: the interfaces are usable from as many classes as possible within in the system. Design-Reusability: Definition of interfaces, such that they can also be used in other (future) software systems. => Class libraries.

Three Types of Implementors Class implementor: Implements the class. The implementor chooses appropriate data structures (for the attributes) and algorithms (for the operations), and realizes the interface of the class ina programming language. Class extender: Extends the class by a subclass, which is needed for a new problem or a new application domain. Class-user: The programmer, who wants to use an existing class (e.g. a class from a class library or a class from another subsystem). The class user is only interested in the Signatures of the class operations and the preconditions, under which they can be invoked. The class user is not so much interested in the implementation of the class.