Domain Modeling (with Objects). Motivation Programming classes teach – What an object is – How to create objects What is missing – Finding/determining.

Slides:



Advertisements
Similar presentations
Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
Advertisements

6-1 Chapter Goals Determine whether a problem is suitable for a computer solution Describe the computer problem-solving process and relate it to Polya’s.
Problem Solving and Algorithm Design
Chapter 6 Problem Solving and Algorithm Design. 6-2 Chapter Goals Determine whether a problem is suitable for a computer solution Describe the computer.
OBJECT ORIENTED PROGRAMMING M Taimoor Khan
Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
Coming up: Motivation1 Object-Oriented Analysis Using CRC Cards and Scenarios to Get Started on a Good Object-Oriented Design Slides from Jochen Rick adapted.
Object-Oriented Analysis
OOAD Using the UML - Use-Case Analysis, v 4.2 Copyright  Rational Software, all rights reserved 1/18 Use Case Analysis – continued Control Classes.
Problem Solving #1 ICS Outline Review of Key Topics Review of Key Topics Example Program Example Program –Problem 7.1 Problem Solving Tips Problem.
Chapter 1 Object-Oriented System Development
Introduction To System Analysis and Design
Algorithms and Problem Solving-1 Algorithms and Problem Solving Mainly based on Chapter 6: “Problem Solving and Algorithm Design” from the Book: “Computer.
Algorithms and Problem Solving-1 Algorithms and Problem Solving.
Object Oriented System Development with VB .NET
Algorithms and Problem Solving
Slide 1 Chapter 7 Structural Modeling. Slide 2 Key Ideas A structural or conceptual model describes the structure of the data that supports the business.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
Lecture 4 Class Responsibility Collaboration Cards
Chapter 6 Problem Solving and Algorithm Design Nell Dale John Lewis.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
The chapter will address the following questions:
Chapter 3 Object-Oriented Analysis of Library Management System(LMS)
Introduction To System Analysis and design
OO Analysis and Design CMPS OOA/OOD Cursory explanation of OOP emphasizes ▫ Syntax  classes, inheritance, message passing, virtual, static Most.
OBJECT-ORIENTED ANALYSIS PHASE
1 Object-Oriented Testing CIS 375 Bruce R. Maxim UM-Dearborn.
Computer Science II 810:062 Section 01 Session 2 - Objects and Responsibilities.
1 Object orientation. 2 What benefits does OO give? Primarily –Encapsulation (Associates data & operations) –Types & specialisation –Software re-use.
Introduction To System Analysis and Design
1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of.
Coming up: Motivation1 Object-Oriented Analysis Using CRC Cards and Scenarios to Get Started on a Good Object- Oriented Design Slides from Jochen Rick.
SWE © Solomon Seifu ELABORATION. SWE © Solomon Seifu Lesson 10 Use Case Design.
1 Analysis Extracting from Use Cases to Create Diagrams.
CSC 395 – Software Engineering Lecture 13: Object-Oriented Analysis –or– Let the Pain Begin (At Least I’m Honest!)
CSC 213 – Large Scale Programming. Today’s Goal  Improve design skills to make usable designs  Noun extraction & UML class diagram reviewed  Connections.
Slide 1 Structural Modeling Chapter 7. Slide 2 Key Ideas A structural or conceptual model describes the structure of the data that supports the business.
Object-Oriented Analysis1 Using CRC Cards and Scenarios to Get Started on a Good Object- Oriented Design Slides from Jochen Rick adapted by Dan Fleck.
Systems Analysis and Design in a Changing World, 3rd Edition
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
1 COMP 350: Object Oriented Analysis and Design Lecture 1Introduction References: Craig Larman Chapter 1.
Slide 12A.1 © The McGraw-Hill Companies, 2005 Object-Oriented and Classical Software Engineering Sixth Edition, WCB/McGraw-Hill, 2005 Stephen R. Schach.
1 What is OO Design? OO Design is a process of invention, where developers create the abstractions necessary to meet the system’s requirements OO Design.
Structural Modeling Chapter 7. Key Ideas A structural or conceptual model describes the structure of the data that supports the business processes in.
1 Structural Modeling Chapter 7. 2 Key Ideas A structural or conceptual model describes the structure of the data that supports the business processes.
© 2010 Bennett, McRobb and Farmer1 Requirements Analysis 2: Realizing Use Cases Based on Chapter 7 of Bennett, McRobb and Farmer: Object Oriented Systems.
Design Model Lecture p6 T120B pavasario sem.
ITEC324 Principle of CS III Chapter 2 (Horstmann’s Book) – Part 1 The Object-Oriented Design Process Hwajung Lee.
Use Case Textual Analysis
Software Engineering Zhang Shuang
SWE 4743 Responsibility Driven Design with CRC cards Richard Gesick.
Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
CSIS 4850: CS Senior Project – Spring 2009 CSIS 4850: Senior Project Spring 2009 Object-Oriented Design.
High Level Design Use Case Textual Analysis SE-2030 Dr. Mark L. Hornick 1.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
Chapter 2 (Horstmann’s Book) – Part 1 The Object-Oriented Design Process Hwajung Lee.
Adapted from (Zenebe & Miao, 2001) CRC Cards A tool and method for systems analysis and design Part of the OO development paradigm Highly interactive and.
Coming up: Motivation1 Object-Oriented Analysis Using CRC Cards and Scenarios to Get Started on a Good Object-Oriented Design Slides from Jochen Rick adapted.
An informal, team oriented, OO design system
GRASP – Designing Objects with Responsibilities
Algorithms and Problem Solving
Chapter 8 Analysis & Modeling
Object-Oriented Analysis
Object-Oriented Design
Object-Oriented Analysis
CRC Card Design A CRC Model is a collection of cards (usually standard index cards or larger) that are divided into three sections. 1. Class 2. Responsibility.
Algorithms and Problem Solving
Chapter 22 Object-Oriented Systems Analysis and Design and UML
Presentation transcript:

Domain Modeling (with Objects)

Motivation Programming classes teach – What an object is – How to create objects What is missing – Finding/determining which objects should you create? “Indeed given a set of requirements for an application and a development system like Smalltalk, ‘finding the objects’ is easily the most difficult task an experienced OO developer has to face. —Simon Lewis, The Art and Science of Smalltalk

How Hard Could this Be? You work for Otis Build a general purpose elevator system to control the movement of elevators in a building

Discussion – Elevator System

Without a Domain Model You start writing code without figuring out what needs to be expressed You would not understand the solution space clearly enough Would not understand the problem space clearly enough

The Process Software Development is an iterative activity – Start with Object-Oriented Analysis and Design – Move on to OO Programming – Return to OOA/OOD when necessary When creating new functionality To solve problems with the code OO Analysis is just another perspective – Good designers (in any field) shift perspective frequently to create a better design – The boundary between OOA and OOD is fuzzy.

Analysis vs. Design Analysis is mostly concerned with the DOMAIN MODEL. What are the objects in the domain and how do they collaborate. I want the iPod to play music (MusicPlayer class) In design, we need to integrate an APPLICATION MODEL What objects do I need to add to get this thing to run on a computer and to be realized in some programming language? The iPod should have a play button, rewind/ffwd done with the wheel (MusicPlayer needs to interact with PlayButton and Wheel classes)

Understanding Objects

What are Objects? What we came up with just now – Building – Elevator – Floor – Control Panel – … Things! Entities in the system Abstraction of a concept in the solution space

Objects have State Elevator – Direction of movement – Current Floor – Moving or at Rest? – Floors to visit

Objects have Behavior

Objects Collaborate

Key Ideas

Abstraction

Encapsulation

Composition

Inheritance

Modeling Technique – CRC Cards

Class-Responsibility-Collaboration Help understand the Domain as Objects – Language Independent – Force Developers to “think” in objects Steps 1.Brainstorm Candidate Classes 2.Create Initial CRC Cards 3.Come up with scenarios of use in the domain 4.Use scenarios to refine CRC Cards

Sample CRC Card Class Name (Base-class): Purpose: ResponsibilitiesCollaborators

Sample CRC Card Class: Document Purpose: Acts as a container for graphics and text ResponsibilitiesCollaborators Knows content Knows Storage location Insert and Remove Text, Graphics and other Elements

Library Automation

Step 1 - Candidate Classes Write down all the objects that relate – Domain Analysis – Focus on the nouns (objects are nouns) – Good objects will have attributes and services Now, filter and refine the candidates – Deal with the interface later (if it helps create a GUI class that is user interface) – Are some candidates attributes of others? – Are some subclasses of others? – Are some instances of others?

Candidate Class Has clear unambiguous name (from the domain) Has responsibilities (what NOT how) Remembers (knowledge) Is needed (collaborates) Actively participates

Tips Don’t forget the user All ideas are potentially good Analyze – make connections Think fast – ponder later

Exercise – Come up with Candidate Classes

Filter Candidate Classes Core Classes – Pretty sure these are in domain model Undecided Classes – Probably not classes – may be attributes Eliminated Classes – Outside scope of system – Application model classes like UI components tied to implementation

Exercise – Filter Classes

Step 1 - Result Candidate Classes Filtered Classes

Step 2 – Responsibilities and Collaborators Class Name (Base-class): Purpose: ResponsibilitiesCollaborators

Things that the class has knowledge about Things that the class can do with the knowledge it has Tips – Verb extractions in the problem or use case – What does the class know? – What is the class expected to do? – What information must be stored about the class to make it unique? Responsibilities

To fulfill a responsibility, a class may need to collaborate with another class This happens when the class needs – information that it does not have, or – to modify information that it does not have Tips – What does the class not know and need to know? – Who can provide that? Collaborators

Sample CRC Card Class: Document Purpose: Acts as a container for graphics and text ResponsibilitiesCollaborators Knows content Knows Storage location Insert and Remove Text, Graphics and other Elements

Exercise – Come up with CRC Cards

Step 3 - Scenarios Invent Scenarios – What should these objects do? – What if…? Play the Cards – Assign Roles – Go Through Scenario – Write down new responsibility – Add collaborator objects to help with that responsibility

Scenario Guidelines Concrete: – Bob tries to Login to the system with an incorrect password. – Sally creates a new Sorceress character and chooses auto-configuration. Focus on “must do” items first Start easy and move to complex

Exercise – Come up with Scenarios

What have we got

Major Questions Shouldn't there be collaborations in the opposite direction? – Collaborations in CRC cards are one-way relationships from the client to the server Who should do the checking out of the Book? – Librarian or Book itself? Who should tell Borrower to update its knowledge about outstanding Book? – Librarian or Book?

Do we need a collaboration between Book and Borrower for the know set of books responsibility? – Collaborations are not usually needed for responsibilities that simply hold information. – Collaboration is needed only for situations where an object actually sends a message to a Collaborator. – Borrower does not need Book's help to put a Book in a set More Questions

When to Stop Stable Model No new class discovery No C / R being added

Modeling Workshop