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.

Slides:



Advertisements
Similar presentations
Chapter 4 - Object-Oriented Analysis and Design in a Nutshell1 Chapter 4 Object-Oriented Analysis and Design in a Nutshell.
Advertisements

Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
Information System Engineering
Object-Oriented Analysis
Ch 12: Object-Oriented Analysis
Chapter 15: System Modeling with UML
Introduction To System Analysis and Design
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 5: Restaurant.
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.
Slide 1 Systems Analysis & Design CS183 Spring Semester 2008 Dr. Jonathan Y. Clark Course Website:
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.
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.
© Copyright Eliyahu Brutman Programming Techniques Course.
Software Engineering Case Study Slide 1 Introductory case study.
Domain Modeling (with Objects). Motivation Programming classes teach – What an object is – How to create objects What is missing – Finding/determining.
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.
UML - Development Process 1 Software Development Process Using UML (2)
Analysis Modeling (cont’d) CpSc 372: Introduction to Software Engineering Jason O. Hallstrom Authorship Disclaimer. These slides.
Slide 12.1 © The McGraw-Hill Companies, CS 4310: Software Engineering Lecture 7 Systems Analysis Object-Oriented Design.
Object Oriented Analysis By: Don Villanueva CS 524 Software Engineering I Fall I 2007 – Sheldon X. Liang, Ph. D.
CS2110: SW Development Methods Design of methods (functions) Class design – CRC cards – UML class and sequence diagrams Software Design.
SOFTWARE ENGINEERING BIT-8 APRIL, 16,2008 Introduction to UML.
1 CMPT 275 Phase: Design. Janice Regan, Map of design phase DESIGN HIGH LEVEL DESIGN Modularization User Interface Module Interfaces Data Persistance.
Presented by: CHAN LAI SAN ( ) REBAH DAW SARREB ( ) FIDA AL-OBAISI ( ) 08 April 2008 (Tuesday 6pm – 7:30pm)
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
11 Partnership for Performance How to hear this lecture Click on the icon: to hear the narration for each slide.
Coming up: Motivation1 Object-Oriented Analysis Using CRC Cards and Scenarios to Get Started on a Good Object- Oriented Design Slides from Jochen Rick.
1 CMPT 275 Software Engineering Requirements Gathering Activity Janice Regan,
CSC 395 – Software Engineering Lecture 13: Object-Oriented Analysis –or– Let the Pain Begin (At Least I’m Honest!)
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.
Lecture 3 Uses Cases Topics UML Use Cases pop quiz Readings: Chapter 3 January 24, 2008 CSCE 492 Software Engineering.
Systems Analysis and Design in a Changing World, 3rd Edition
CS3773 Software Engineering Lecture 04 UML Class Diagram.
CS Overview of CRC CS 4311 B. Beck and W. Cunningham, A Laboratory for Teaching Object-Oriented Thinking, OOPSLA ’89, October 1-6, R. Wirfs-Brock,
©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.
CS 4850: Senior Project Fall 2014 Object-Oriented Design.
Slide 1 Systems Analysis and Design with UML Version 2.0, Second Edition Alan Dennis, Barbara Haley Wixom, and David Tegarden Chapter 7: Structural Modeling.
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.
Design Model Lecture p6 T120B pavasario sem.
CS 5150 Software Engineering Lecture 7 Requirements 1.
Analysis Modeling CpSc 372: Introduction to Software Engineering
Chapter 17 – Object- Oriented Design. Chapter Goals To learn about the software life cycle To learn about the software life cycle To learn how to discover.
ITEC324 Principle of CS III Chapter 2 (Horstmann’s Book) – Part 1 The Object-Oriented Design Process Hwajung Lee.
Evaluating Requirements
CSIS 4850: CS Senior Project – Spring 2009 CSIS 4850: Senior Project Spring 2009 Object-Oriented Design.
Slide 1 Systems Analysis and Design with UML Version 2.0, Second Edition Alan Dennis, Barbara Haley Wixom, and David Tegarden Chapter 7: Structural Modeling.
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.
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
Week 10: Object Modeling (1)Use Case Model
Object-Oriented Design
Object-Oriented Design
Object-Oriented Analysis
Object oriented analysis and design
Algorithms and Problem Solving
Applying Use Cases (Chapters 25,26)
Chapter 22 Object-Oriented Systems Analysis and Design and UML
Presentation transcript:

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 by Dan Fleck

Coming up: Good Object-Oriented Style2 Motivation Programming classes teach –What an object is –How to create objects What is missing –Design – 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

Coming up: Design is a Process, not a Waterfall 3 Good Object-Oriented Style You can hack in any language, but how do you get reusable, maintainable code? Just using Objects doesn’t ensure a good design –Many C++ programs have only have a single class –That’s not good object-oriented style No process can guarantee good results –A good process just makes them more likely

Coming up: OOA vs. OOD4 Design is a Process, not a Waterfall Design 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.

Coming up: Object-Oriented Analysis5 OOA vs. OOD Understand the problem: In analysis, we are mostly concerned with the DOMAIN MODEL. What are the objects in the domain and how do they collaborate. Understand the solution: 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?

Coming up: How things fit in CS4216 Object-Oriented Analysis CRC Cards by Ward Cunningham Goal: Understand the Domain as Objects –Object-Oriented Analysis is Language Independent –Force Developers to “think” in objects Steps 1.Brainstorm Candidate Classes 2.Create Initial Class-Responsibility-Collaboration Cards 3.Come up with scenarios of use in the domain 4.Use scenarios and role playing to refine CRC Cards When do we do it? –Before we begin coding (to get a good start) –To add new functionality (update CRC cards and scenarios regularly)

How things fit and follow Coming up: How things fit in CS4217 Problem Statement Use casesCRC CardsClass Diagram (high level) Analysis Phase (understanding the problem) UML diagrams at any time for clarity : sequence, activity, swimlane, DFD, ERD, etc…

How things fit and follow Coming up: OOA Step 1 Brainstorming Candidate Classes 8 Design Phase (solving the problem in software). Versions of class diagram and ERD with implementation details Detailed versions of any UML diagram needed for clarity Implementation Testing Deployment Maintenance

Coming up: Brainstorming Tips9 OOA Step 1 Brainstorming 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 (Not part of the domain, that’s the application model) –Are some candidates attributes of others? –Are some subclasses of others? –Are some instances of others?

Coming up: Candidate Class Review10 Brainstorming Tips Two’s only company, Ten’s a crowd Don’t forget the user All ideas are potentially good Analyze – make connections Think fast – ponder later Every voice gets a turn Relax – humor is OK.

Coming up: Filter Candidate Classes11 Candidate Class Review Has clear unambiguous name, recognized by domain experts Has name that fits in with other systems developed by your organization Uses singular noun for name Begins with Uppercase Letter Has responsibilities (what NOT how) Remembers (knowledge) Is needed (collaborates) Actively participates from CRC Card Book

Coming up: OOA Step 2 CRC Cards 12 Filter Candidate Classes Core Classes (pretty sure these are in Analysis model) Undecided Classes (probably not classes – might be attributes) Eliminated Classes – (outside scope of system, Application model classes like UI components tied to implementation)

Coming up: CRC Cards: What Goes Where?13 OOA Step 2 CRC Cards For each core candidate class, create one CRC card What’s a CRC Card? –Class-Responsibility- Collaboration –It’s just a 4x6in index card

Coming up: CRC Card Format (Front)14 CRC Cards: What Goes Where? Note: these are lined up, Foo is needed for BOTH responsibilities, so it is written twice!!

Coming up: CRC Card Format (Back)15 CRC Card Format (Front) Class Name (OOA) Purpose/Role (OOA): Patterns (OOD): Stereotypes(OOA/OOD): Pattern and stereotype not needed for the project

Coming up: CRC Card Sample Front16 CRC Card Format (Back) Class Name Superclass: Subclasses: ResponsibilitiesCollaborators

Coming up: CRC Card Sample Back17 CRC Card Sample Front Document Purpose: A Document acts as a container for graphics and text. Patterns: Composite-Component Stereotypes: Structurer Pattern and stereotype not needed for the project

Coming up: Stereotypes18 CRC Card Sample Back Document Superclass: Subclasses: ResponsibilitiesCollaborators Know Contents Know Storage Location Insert and Removes text, graphics and other elements

Coming up: OOA Step 3 Scenarios with CRC Cards 19 Stereotypes Information Holder –knows and provides information Structurer –Maintains relationships between objects and information about those relationships Service Provider –Performs work for other objects Coordinator –Reacts to events by delegating tasks to others Controller –Makes decisions and closely directs others’ actions Interfacer –Transforms information and requests between different parts of our system

Coming up: Scenario Guidelines20 OOA Step 3 Scenarios with CRC Cards 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 –Team members hold up cards as they participate

Coming up: Scenario Guidelines21 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

Coming up: OOA for a Clock22 Scenario Guidelines Keep a record of scenarios played out Explore exception conditions last Separate role-play from analysis

Coming up: OOA for a Clock23 OOA for a Clock We want to make a clock. The clock should: –Have a way to set the current time –Display the time in hours, minutes, and seconds in different formats –Update the time to keep it current

Coming up: OOA for a Clock24 OOA for a Clock Brainstorm (Step 1 – Candidate Classes) –Candidate classes

Coming up: OOA for a Clock25 OOA for a Clock Brainstorm –Face for the clock, internal ticker, hours, minutes, seconds, knob for setting the clock Filter for Core Objects

Coming up: OOA for a Clock26 OOA for a Clock Brainstorm Filter Define the Clock class –Attributes: hours, mins, secs, timezone, state (low bat, etc…), –Services: update, setTime, alarm, setAlarm, display/time, displayDate, setAmPm, getAmPm

Coming up: ALERT!!!!27 OOA for a Clock Brainstorm –Face for the clock, internal ticker, hours, minutes, seconds, knob for setting the clock Filter –Ticker, hours, minutes, seconds Define the Clock class –Attributes: seconds, minutes, hours, displayFormat –Services: get/set, nextSecond, display, setFormat

Coming up: Errors in this Design28 ALERT!!!! Bad OO Design in Progress What did we do wrong? I’m still designing a program thinking – what’s my data and what do I have to do? I need to think about a community of cooperating objects!!!

Coming up: OOA for a Clock: Second Try29 Errors in this Design We assumed there was only one class: Clock –What’s reusable in that? We started with data and not with what the object should be responsible for We were way too focused on the programming from the start Thinking in get/set mode (be aware of your idioms!) –Java/Python does that, but typically not Smalltalk

Coming up: Scenario 1: The Ticker Ticks30 OOA for a Clock: Second Try Brainstorm objects for Clock –Display, Time, Ticker/SecondTimer, Clock, Formatter Filter: CRC Cards –Two scenarios 1.When the ticker pulses the clock, the internal representation of time must increment 2.When a display is requested, the time must be fetched and formatted

Coming up: Scenario 1: The Ticker Ticks31 Scenario 1: The Ticker Ticks The SecondsTicker pulses the Clock

Coming up: Scenario 1: The Ticker Ticks32 Scenario 1: The Ticker Ticks The SecondsTicker pulses the Clock The Clock updates Time

Coming up: Scenario 1: The Ticker Ticks33 Scenario 1: The Ticker Ticks The SecondsTicker pulses the Clock The Clock updates Time Time updates itself

Coming up: Scenario 2: Clock Responds with the Time34 Scenario 1: The Ticker Ticks The SecondsTicker pulses the Clock The Clock updates Time Time updates itself End of Scenario

Coming up: Scenario 2: Clock Responds with the Time35 Scenario 2: Clock Responds with the Time Display the time

Coming up: Scenario 2: Clock Responds with the Time36 Scenario 2: Clock Responds with the Time Display the time Return hours, minutes, & seconds

Coming up: Scenario 2: Clock Responds with the Time37 Scenario 2: Clock Responds with the Time Display the time Return hours, minutes, & seconds Translate the time into the display format

Coming up: OOA for a Clock: Second Try38 Scenario 2: Clock Responds with the Time Display the time Return hours, minutes, & seconds Translate the time into the display format End of Scenario

Coming up: Why CRC Cards?39 OOA for a Clock: Second Try

Lets try it: Class-Responsibility- Collaborator (CRC) Create a set of CRC cards for an iPod –Brainstorm – core:menus – attr:language, user controls, media - children song, movie, synchronizer, playlist, musicController, downloader, displayController, iPodInfoMgr, inputDevices, mediaLibrary Maybe: shuffler, Not class: solitaire, minesweeper –Filter Develop Scenarios Play the cards Object-Oriented Analysis40

Scenarios John searches for music by Cake, finds a song and plays it John searches for music by Cake, finds a song and deletes it John selects a playlist and adds a song to it John selects a playlist and plays it iPod battery is getting low and warns the user, no response, then shutsdown Object-Oriented Analysis41

Coming up: In-class Exercise42 Why CRC Cards? Help you identify objects and their responsibilities Help you understand how the objects interact Cards form a useful record of design activity Cards work well in group situations and are understandable by non-technical stakeholders.

Some Examples You are trying to think of classes (nouns) and what they logically need to do (responsabilities). For a game: –User: move, fire, pickup item, talk to NPC, provide information (name, address, etc…) –Item: hold and return information –Map: track players, display player locations Object-Oriented Analysis43 This is hard to get right! Practice!

Coming up: In-class Exercise: Handout44 In-class Exercise This application will support the operations of a technical library for an R&D organization. This includes the searching for and lending of technical library materials, including books, videos, and technical journals. Users will enter their company ids in order to use the system; and they will enter material ID numbers when checking out and returning items.Each borrower can be lent up to five items. Each type of library item can be lent for a different period of time (books 4 weeks, journals 2 weeks, videos 1 week). If returned after their due date, the library user's organization will be charged a fine, based on the type of item( books $1/day, journals $3/day, videos $5/day).Materials will be lent to employees with no overdue lendables, fewer than five articles out, and total fines less than $ (Design Constraints)...

End of presentation45 In-class Exercise: Handout Brainstorm Candidate Classes - Whole Class Candidate Class Review - Whole class Filter Classes - Individual Groups Create the cards - Individual Groups Information Holder - knows and provides information Structurer - Maintains relationships between objects and information about those relationships Service Provider - Performs work for other objects Coordinator - Reacts to events by delegating tasks to others Controller - Makes decisions and closely directs others’ actions Interfacer - Transforms information and requests between different parts of our system Play the cards - Individual Groups –Scenarios - What happens when Johnny Codewarrior returns the book Document, Your job depends on it two days late? He has no other item checked out and no acquired fines. What happens when Ivar Jacobson uses the search feature to look for the book Object-Oriented Software Engineering of which there are 2 copies available? What happens when Grady Booch uses the search feature to look for the book Object-Oriented Analysis and Design with Application of which there is 1 copy available and the database is down? Present Final Card Set - Individual Groups Document Purpose: … Patterns: Stereotypes: … Document Purpose: … Patterns: Stereotypes: …