designing objects with responsibilities€¦ · responsibilities curt clifton rose-hulman institute...
TRANSCRIPT
![Page 1: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/1.jpg)
Designing Objects with ResponsibilitiesCurt Clifton
Rose-Hulman Institute of Technology
![Page 2: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/2.jpg)
Our Story Thus Far
OO Analysis
Domain modeling
Identifying system operations
Clarifying critical operations
Logical architectures, layers
Q1
![Page 3: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/3.jpg)
Pre-break Course Evaluation Results
![Page 4: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/4.jpg)
Lecture Pace
0
5
10
15
Much too slow Somewhat too slow Somewhat too fast Much too fast
![Page 5: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/5.jpg)
Lecture +/!
+ In-class examples (9)
+Slides (7)
+Diagrams on quizzes (4)
+Style/enthusiasm (2)
! A bit less excited (2)
! Wrangle Raptors (2)
![Page 6: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/6.jpg)
Daily Quizzes Helpfulness
0
5
10
15
Very unhelpful Somewhat unhelpful Somewhat helpful Very helpful
![Page 7: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/7.jpg)
Daily Quizzes +/!
+ In-class examples (6)
+Reference (6)
+Help to pay attention (3)
+Sync with lecture (3)
+Diagrams (2)
! Add random, get-to-know-you questions (3)
! Longer questions (2)
![Page 8: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/8.jpg)
Reading Done
0
5
10
15
None of it Little of it Most of it All of it
![Page 9: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/9.jpg)
Homework Difficulty
0
5
10
15
Much too easy A bit too easy A bit too difficult Much too difficult
![Page 10: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/10.jpg)
Homework Helpfulness
0
5
10
15
Very unhelpful Somewhat unhelpful Somewhat helpful Very helpful
![Page 11: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/11.jpg)
Homework +/!
+Good prep for milestones (6)
+Reinforce lecture/book (4)
+Hands on learning (4)
! Too ambiguous (3)
! Provide references to diagram types in the book (2)
! Strange due time (2)
! Break up into smaller parts (2)
![Page 12: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/12.jpg)
Workload Compared to Average Rose Course
0
5
10
15
Much lower Somewhat lower Somewhat higher Much higher
![Page 13: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/13.jpg)
Other Comments
Although workload was rated lower, it seems to be picking up. Go easy. (3)
Argh, give us an “about right” option! (1)
![Page 14: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/14.jpg)
MasteringObject-Oriented Design
A large set of soft principles
It isn’t magic. We learn it with:
Patterns (named, explained, and applied)
Examples
Practice“The critical design tool for software
development is a mind well educated in design principles.”
Q2
![Page 15: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/15.jpg)
Responsibility Driven Design
![Page 16: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/16.jpg)
Responsibilities for an Object
Doing
a Sale is responsible for creating instances of SalesLineItem
Knowing
a Sale is responsible for knowing its total cost
Q3,4
![Page 17: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/17.jpg)
Responsibilities Come in All Sizes
Big: provide access to a relational database
Small: create a Sale
A responsibility is not the same thing as a method
![Page 18: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/18.jpg)
Responsibility Driven Design is a Metaphor
Think of objects as people with responsibilities
They collaborate to get things done
An OO program is a “community of collaborating … objects”
Who owns x?
![Page 19: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/19.jpg)
When Do We Assign Responsibilities?
While coding
While modeling
UML is a low-cost modeling tool
Can assign responsibilities with minimal investment
![Page 20: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/20.jpg)
GRASP
A set of patternsfor assigning responsibilities tosoftware objects
![Page 21: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/21.jpg)
Floor Tiles
The worst part is when sidewalk cracks are out-of-sync with your natural stride.
http://xkcd.com/245/
![Page 22: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/22.jpg)
Patterns
![Page 23: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/23.jpg)
A pattern is a named and well-known problem-solution pair that can be applied in a new context
![Page 24: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/24.jpg)
Example Pattern
Pattern Name
Problem
Solution
Information ExpertWhat is a basic principle by which to
assign responsibilities to objects?
Assign a responsibility to the class that has the information needed to fulfill it.
Names Matter!
“New pattern” is an oxymoron!Q5–7
![Page 25: Designing Objects with Responsibilities€¦ · Responsibilities Curt Clifton Rose-Hulman Institute of Technology. Our Story Thus Far ... Patterns (named, explained, and applied)](https://reader034.vdocuments.us/reader034/viewer/2022051607/6034ad8ff57a11207212922b/html5/thumbnails/25.jpg)
History
A Pattern Language: Towns, Buildings, ConstructionAlexander, Ishikawa, and Silverstein
Kent Beck, Ward Cunningham at Tektronik
Design Patterns: Elements of Reusable Object-Oriented Software Gamma, Helm, Johnson, Vlissides
The Gang of Four