SlideShare a Scribd company logo
Responsibility Driven
 Design for Rubyists
     An Outside-In OO Design Approach
      Software Design Trilogy – Part I

        Prepared and Presented by:
  Andy Maleh / Software Engineer / Groupon
Outline
Pop Quiz

Responsibility Driven Design

Responsibility Based Modeling

GRASP

Consolidated OO Design Process

Exercise
Pop Quiz
 What was the first object oriented language?

Simula 67 - developed in the
1960s at the Norwegian
Computing Center in Oslo
Pop Quiz
What are the key features/traits of Object Oriented
Programming?

Data Abstraction
Encapsulation
Messaging
Modularity
Inheritance
Polymorphism
Responsibility Driven
      Design
Object oriented design technique that came from
Rebecca Wirfs-Brock

Reaction to Data-Driven Design’s lack of
encapsulation for object data

Focuses on object responsibilities and collaborations

Object interaction follows a client/server model
Responsibility Driven
       Design Process
1.   Identify actions that must be taken to accomplish user
     goals in a software system

2. Identify responsibilities needed to perform these actions
   including information sharing responsibilities

3. Identify objects most suitable for responsibilities

4. Identify object collaborations needed to fulfill
   responsibilities, discovering new objects in the process

5. Iterate
Responsibility Driven
  Design Example
Action: Add new address for user, validating address,
and filling in zip code automatically.

Responsibilities:
   User information storage
   Address information storage
   Validate address
   Retrieve zip code for address
Responsibility Driven
  Design Example
Objects:
   User (stores user info)
   Address (stores address info, validates address)
   AddressFactory (creates new address, validates
   address, fills in zip code)
   ZipCodeService (retrieves zip code for address)
Responsibility Based
     Modeling
Responsibility Driven Design inspired technique by Alistair
Cockburn that helps developers start design from the
business domain model and use cases
Often begins with higher-level component design and
then delves down into object design
Use case scenario steps act as the actions for which
responsibilities must be identified (alternatively
Given/When/Then scenarios in Rubyland)
Objects can be identified using CRC cards or object
interaction diagramming
CRC Cards
CRC stands for Class Responsibilities Collaborations

Interactive paper exercise for discovering objects
and collaborations

Can be done collaboratively by multiple developers
CRC Cards
CRC stands for Class Responsibilities Collaborations

Interactive paper technique for discovering object
and collaborations based on identified high level
responsibilities




http://www.madsen.us/uop/BSA375/handouts.htm
CRD Cards




http://www.item.ntnu.no/people/personalpages/others/kraemer/phd/background
Object Interaction
     Diagramming
Documents collaborations needed between objects
to accomplish a user goal

Helps developers discover objects and
responsibilities

The two most commonly used object interaction
diagrams are:
  UML 2 Sequence Diagram
  UML 2 Communication Diagram
Sequence Diagram
Communication
   Diagram
GRASP
GRASP: General Responsibility Assignment Software
Patterns

They help developers figure out how to assign object
responsibilities and evaluate design decisions

Contemplated collectively instead of one at a time

Provide the underpinnings for object oriented design

Help explain how design patterns are arrived to
GRASP
1. Creator: isolates object creation responsibilities
2. Information Expert: the object that holds the data
   performs the modification on the data
3. Controller: orchestrates multiple objects in
   accomplishing an action
4. Low Coupling: minimize coupling to other objects
5. High Cohesion: increase focus of object
   responsibilities
GRASP
6.   Polymorphism: assign responsibilities based on types to objects
     of these types
7.   Pure Fabrication: fabricate an object to take on a responsibility
     that needs to be offloaded of another object to improve
     coupling/cohesion
8.   Indirection: decouple two objects by introducing an
     intermediary to decrease coupling and increase reuse and
     interchangeability
9.   Protected Variations: protect an object from variations of
     interactions with other objects by substituting the variations
     with one interaction with a super interface for the other
     objects and relying on polymorhpism
Consolidated OO Design
        Process
1. Write functional requirements as use cases

2. Pick one use case and identify use case scenarios (or
   Given/When/Then)

3. Pick one use case scenario and identify actions

4. For each action, identify responsibilities needed to
   perform it
Consolidated OO Design
        Process
5. For each responsibility, identify an object most
   suitable to fulfill it using GRASP as guidance

6. Review the responsibility assignments done for the
   picked use case scenario, possibly altering your
   decisions based on GRASP

7. Repeat until done with all use cases. This is done for
   one use case at a time and one iteration’s length of
   requirements at a time in an Agile process (thin slice
   approach as per Alistair Cockburn)
Exercise
Requirement: Ability to navigate deals
   Use Case: Search for deals near my location
     Scenario:
        Given I live in Chicago at 60622
        When I sign into the system
        And I request a search for deals near my location
        And I specify keywords for finding deals
        Then I am presented with a collection of deals that match
        the specified keywords and are ordered by distance in
        ascending order
Exercise –
         Responsibilities
1. User lookup

2. User authentication

3. User information (including address)

4. User interaction request handling

5. Presentation of search input form

6. Search Form input handling
Exercise –
         Responsibilities
6. Searching for deals

7. Ordering of search results

8. Retrieval of deal information

9. Presentation of deal information
Exercise – Objects
1.   User lookup: UserRepository (High Cohesion)

2.   User authentication: AuthenticationService (Pure Fabrication,
     High Cohesion)

3.   User Information: User (Information Expert)

4.   User interaction request handling: DealSearchController
     (Controller)

5.   Presentation of search form: SearchInputForm (Information
     Expert)

6.   Search form input handling: DealSearchController (Controller)
Exercise – Objects
6. Searching for deals: DealSearchService (Pure
   Fabrication, High Cohesion)

7. Ordering of search results: DealSearchService (Pure
   Fabrication, High Cohesion)

8. Retrieval of deal information: DealRepository (High
   Cohesion)

9. Presentation of deal information: DealView (Pure
   Fabrication, High Cohesion, Indirection)
Exercise – Notes
• Objects can have methods that represent
  responsibilities they do not directly perform, yet
  delegate to collaboration objects
   •   Example: User has a sign_in method, but the work is
       performed behind the scenes with the
       AuthenticationService
Exercise – Notes on
        Ruby on Rails
• Repositories and the objects they retrieve live in the
  same object with ActiveRecord. Think of the
  repository as the “Ruby class object” and the object
  it retrieves as the “Ruby class instance object”

• Views are split into a template file (e.g. ERB or
  HAML) and a presenter object if needed to handle
  the presentation logic of the view. Rails Helpers
  often act as presenters though since they already
  have access to the view data context (Information
  Expert)
Personal Exercise
Create CRC Cards for the responsibilities we
identified

Diagram the object interaction for the
responsibilities we identified (Sequence or
Communication)
Review
Pop Quiz

Responsibility Driven Design

Responsibility Based Modeling

GRASP

Consolidated OO Design Process

Exercise
Stay Tuned for More
Stay tuned for more in the Software Design Trilogy:
   Part II: Design Patterns for Rubyists – Who Said
   Dynamic Languages Can't Have Patterns?
   Part III: Domain Driven Design in RoR Apps – When
   Controllers and ActiveRecords Won't Cut It Anymore
Contact Info
Andy Maleh / Software Engineer / Groupon

Blog: http://andymaleh.blogspot.com

Twitter: @AndyMaleh
References
Responsibility Driven Design:http://wirfs-
brock.com/PDFs/Responsibility- Driven.pdf

Responsibility Based Modeling:
http://alistair.cockburn.us/Responsibility-
based+modeling

GRASP: http://www.amazon.com/Applying-UML-
Patterns-Introduction-Object-Oriented/dp/0131489062

More Related Content

Similar to Software Design Trilogy Part I - Responsibility Driven Design for Rubyists

Oos Short Q N
Oos Short Q NOos Short Q N
Oos Short Q N
Prabha Krishnan
 
Embracing OOUX for Better Projects and Happier Teams
Embracing OOUX for Better Projects and Happier TeamsEmbracing OOUX for Better Projects and Happier Teams
Embracing OOUX for Better Projects and Happier Teams
Caroline Sober-James
 
OOAD unit1 introduction to object orientation
 OOAD unit1 introduction to object orientation OOAD unit1 introduction to object orientation
OOAD unit1 introduction to object orientation
Dr Chetan Shelke
 
principle of oop’s in cpp
principle of oop’s in cppprinciple of oop’s in cpp
principle of oop’s in cpp
gourav kottawar
 
Chapter1
Chapter1Chapter1
Chapter1
jammiashok123
 
The Art and Science of Requirements Gathering
The Art and Science of Requirements GatheringThe Art and Science of Requirements Gathering
The Art and Science of Requirements Gathering
Vanessa Turke
 
Se chapter 1,2,3 2 mark qa
Se chapter 1,2,3   2 mark  qaSe chapter 1,2,3   2 mark  qa
Se chapter 1,2,3 2 mark qa
Aruna M
 
Ooad notes
Ooad notesOoad notes
Ooad notes
NancyJP
 
CORE: Cognitive Organization for Requirements Elicitation
CORE: Cognitive Organization for Requirements ElicitationCORE: Cognitive Organization for Requirements Elicitation
CORE: Cognitive Organization for Requirements Elicitation
Scott M. Confer
 
Understanding-Objects-in-Javascript.pptx
Understanding-Objects-in-Javascript.pptxUnderstanding-Objects-in-Javascript.pptx
Understanding-Objects-in-Javascript.pptx
MariaTrinidadTumanga
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptx
IndraKhatri
 
Bca 2nd sem u-1 iintroduction
Bca 2nd sem u-1 iintroductionBca 2nd sem u-1 iintroduction
Bca 2nd sem u-1 iintroduction
Rai University
 
12266422.ppt
12266422.ppt12266422.ppt
12266422.ppt
CSEC5
 
Best android classes in mumbai
Best android classes in mumbaiBest android classes in mumbai
Best android classes in mumbai
Vibrant Technologies & Computers
 
Search Solutions 2011: Successful Enterprise Search By Design
Search Solutions 2011: Successful Enterprise Search By DesignSearch Solutions 2011: Successful Enterprise Search By Design
Search Solutions 2011: Successful Enterprise Search By Design
Marianne Sweeny
 
L5 m256 block2_unit5
L5 m256 block2_unit5L5 m256 block2_unit5
L5 m256 block2_unit5
Dr Omar M.S Hamed
 
C++ & VISUAL C++
C++ & VISUAL C++ C++ & VISUAL C++
C++ & VISUAL C++
Makaha Rutendo
 
Cultivating Your Design Heuristics
Cultivating Your Design HeuristicsCultivating Your Design Heuristics
Cultivating Your Design Heuristics
Rebecca Wirfs-Brock
 
InSPECT Significant Properties Framework (SPs part 2), by Stephen Grace and G...
InSPECT Significant Properties Framework (SPs part 2), by Stephen Grace and G...InSPECT Significant Properties Framework (SPs part 2), by Stephen Grace and G...
InSPECT Significant Properties Framework (SPs part 2), by Stephen Grace and G...
JISC KeepIt project
 
Ooad (object oriented analysis design)
Ooad (object oriented analysis design)Ooad (object oriented analysis design)
Ooad (object oriented analysis design)
Gagandeep Nanda
 

Similar to Software Design Trilogy Part I - Responsibility Driven Design for Rubyists (20)

Oos Short Q N
Oos Short Q NOos Short Q N
Oos Short Q N
 
Embracing OOUX for Better Projects and Happier Teams
Embracing OOUX for Better Projects and Happier TeamsEmbracing OOUX for Better Projects and Happier Teams
Embracing OOUX for Better Projects and Happier Teams
 
OOAD unit1 introduction to object orientation
 OOAD unit1 introduction to object orientation OOAD unit1 introduction to object orientation
OOAD unit1 introduction to object orientation
 
principle of oop’s in cpp
principle of oop’s in cppprinciple of oop’s in cpp
principle of oop’s in cpp
 
Chapter1
Chapter1Chapter1
Chapter1
 
The Art and Science of Requirements Gathering
The Art and Science of Requirements GatheringThe Art and Science of Requirements Gathering
The Art and Science of Requirements Gathering
 
Se chapter 1,2,3 2 mark qa
Se chapter 1,2,3   2 mark  qaSe chapter 1,2,3   2 mark  qa
Se chapter 1,2,3 2 mark qa
 
Ooad notes
Ooad notesOoad notes
Ooad notes
 
CORE: Cognitive Organization for Requirements Elicitation
CORE: Cognitive Organization for Requirements ElicitationCORE: Cognitive Organization for Requirements Elicitation
CORE: Cognitive Organization for Requirements Elicitation
 
Understanding-Objects-in-Javascript.pptx
Understanding-Objects-in-Javascript.pptxUnderstanding-Objects-in-Javascript.pptx
Understanding-Objects-in-Javascript.pptx
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptx
 
Bca 2nd sem u-1 iintroduction
Bca 2nd sem u-1 iintroductionBca 2nd sem u-1 iintroduction
Bca 2nd sem u-1 iintroduction
 
12266422.ppt
12266422.ppt12266422.ppt
12266422.ppt
 
Best android classes in mumbai
Best android classes in mumbaiBest android classes in mumbai
Best android classes in mumbai
 
Search Solutions 2011: Successful Enterprise Search By Design
Search Solutions 2011: Successful Enterprise Search By DesignSearch Solutions 2011: Successful Enterprise Search By Design
Search Solutions 2011: Successful Enterprise Search By Design
 
L5 m256 block2_unit5
L5 m256 block2_unit5L5 m256 block2_unit5
L5 m256 block2_unit5
 
C++ & VISUAL C++
C++ & VISUAL C++ C++ & VISUAL C++
C++ & VISUAL C++
 
Cultivating Your Design Heuristics
Cultivating Your Design HeuristicsCultivating Your Design Heuristics
Cultivating Your Design Heuristics
 
InSPECT Significant Properties Framework (SPs part 2), by Stephen Grace and G...
InSPECT Significant Properties Framework (SPs part 2), by Stephen Grace and G...InSPECT Significant Properties Framework (SPs part 2), by Stephen Grace and G...
InSPECT Significant Properties Framework (SPs part 2), by Stephen Grace and G...
 
Ooad (object oriented analysis design)
Ooad (object oriented analysis design)Ooad (object oriented analysis design)
Ooad (object oriented analysis design)
 

More from Andy Maleh

Fukuoka Ruby Award 2023 - Opal
Fukuoka Ruby Award 2023 - OpalFukuoka Ruby Award 2023 - Opal
Fukuoka Ruby Award 2023 - Opal
Andy Maleh
 
Becoming a SOC2 Ruby Shop - Montreal.rb November, 5, 2022 Ruby Meetup
Becoming a SOC2 Ruby Shop - Montreal.rb November, 5, 2022 Ruby MeetupBecoming a SOC2 Ruby Shop - Montreal.rb November, 5, 2022 Ruby Meetup
Becoming a SOC2 Ruby Shop - Montreal.rb November, 5, 2022 Ruby Meetup
Andy Maleh
 
Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
 Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ... Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
Andy Maleh
 
How I Built My Code Editor in Ruby
How I Built My Code Editor in RubyHow I Built My Code Editor in Ruby
How I Built My Code Editor in Ruby
Andy Maleh
 
Ultra Light and Maintainable Rails Wizards at RailsConf 2014
Ultra Light and Maintainable Rails Wizards at RailsConf 2014Ultra Light and Maintainable Rails Wizards at RailsConf 2014
Ultra Light and Maintainable Rails Wizards at RailsConf 2014
Andy Maleh
 
RailsConf 2014 Recap at Montreal.rb by Andy Maleh
RailsConf 2014 Recap at Montreal.rb by Andy MalehRailsConf 2014 Recap at Montreal.rb by Andy Maleh
RailsConf 2014 Recap at Montreal.rb by Andy Maleh
Andy Maleh
 
Ultra Light and Maintainable Wizards in Rails at Montreal.rb
Ultra Light and Maintainable Wizards in Rails at Montreal.rbUltra Light and Maintainable Wizards in Rails at Montreal.rb
Ultra Light and Maintainable Wizards in Rails at Montreal.rb
Andy Maleh
 
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
Andy Maleh
 
Software Craftsmanship VS Software Engineering
Software Craftsmanship VS Software EngineeringSoftware Craftsmanship VS Software Engineering
Software Craftsmanship VS Software Engineering
Andy Maleh
 
Rails Engine Patterns
Rails Engine PatternsRails Engine Patterns
Rails Engine Patterns
Andy Maleh
 
Software Craftsmanship vs Software Engineering (Lightning Talk)
Software Craftsmanship vs Software Engineering (Lightning Talk)Software Craftsmanship vs Software Engineering (Lightning Talk)
Software Craftsmanship vs Software Engineering (Lightning Talk)
Andy Maleh
 
Software Design Trilogy Part III - Domain Driven Design for Ruby on Rails App...
Software Design Trilogy Part III - Domain Driven Design for Ruby on Rails App...Software Design Trilogy Part III - Domain Driven Design for Ruby on Rails App...
Software Design Trilogy Part III - Domain Driven Design for Ruby on Rails App...
Andy Maleh
 
Software Design Trilogy Part II - Design Patterns for Rubyists
Software Design Trilogy Part II - Design Patterns for RubyistsSoftware Design Trilogy Part II - Design Patterns for Rubyists
Software Design Trilogy Part II - Design Patterns for Rubyists
Andy Maleh
 
The Rails Engine That Could - In Motion
The Rails Engine That Could - In MotionThe Rails Engine That Could - In Motion
The Rails Engine That Could - In Motion
Andy Maleh
 
The Rails Engine That Could
The Rails Engine That CouldThe Rails Engine That Could
The Rails Engine That Could
Andy Maleh
 
How I Learned To Apply Design Patterns
How I Learned To Apply Design PatternsHow I Learned To Apply Design Patterns
How I Learned To Apply Design Patterns
Andy Maleh
 
Simplifying Desktop Development With Glimmer
Simplifying Desktop Development With GlimmerSimplifying Desktop Development With Glimmer
Simplifying Desktop Development With Glimmer
Andy Maleh
 

More from Andy Maleh (17)

Fukuoka Ruby Award 2023 - Opal
Fukuoka Ruby Award 2023 - OpalFukuoka Ruby Award 2023 - Opal
Fukuoka Ruby Award 2023 - Opal
 
Becoming a SOC2 Ruby Shop - Montreal.rb November, 5, 2022 Ruby Meetup
Becoming a SOC2 Ruby Shop - Montreal.rb November, 5, 2022 Ruby MeetupBecoming a SOC2 Ruby Shop - Montreal.rb November, 5, 2022 Ruby Meetup
Becoming a SOC2 Ruby Shop - Montreal.rb November, 5, 2022 Ruby Meetup
 
Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
 Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ... Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
 
How I Built My Code Editor in Ruby
How I Built My Code Editor in RubyHow I Built My Code Editor in Ruby
How I Built My Code Editor in Ruby
 
Ultra Light and Maintainable Rails Wizards at RailsConf 2014
Ultra Light and Maintainable Rails Wizards at RailsConf 2014Ultra Light and Maintainable Rails Wizards at RailsConf 2014
Ultra Light and Maintainable Rails Wizards at RailsConf 2014
 
RailsConf 2014 Recap at Montreal.rb by Andy Maleh
RailsConf 2014 Recap at Montreal.rb by Andy MalehRailsConf 2014 Recap at Montreal.rb by Andy Maleh
RailsConf 2014 Recap at Montreal.rb by Andy Maleh
 
Ultra Light and Maintainable Wizards in Rails at Montreal.rb
Ultra Light and Maintainable Wizards in Rails at Montreal.rbUltra Light and Maintainable Wizards in Rails at Montreal.rb
Ultra Light and Maintainable Wizards in Rails at Montreal.rb
 
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
 
Software Craftsmanship VS Software Engineering
Software Craftsmanship VS Software EngineeringSoftware Craftsmanship VS Software Engineering
Software Craftsmanship VS Software Engineering
 
Rails Engine Patterns
Rails Engine PatternsRails Engine Patterns
Rails Engine Patterns
 
Software Craftsmanship vs Software Engineering (Lightning Talk)
Software Craftsmanship vs Software Engineering (Lightning Talk)Software Craftsmanship vs Software Engineering (Lightning Talk)
Software Craftsmanship vs Software Engineering (Lightning Talk)
 
Software Design Trilogy Part III - Domain Driven Design for Ruby on Rails App...
Software Design Trilogy Part III - Domain Driven Design for Ruby on Rails App...Software Design Trilogy Part III - Domain Driven Design for Ruby on Rails App...
Software Design Trilogy Part III - Domain Driven Design for Ruby on Rails App...
 
Software Design Trilogy Part II - Design Patterns for Rubyists
Software Design Trilogy Part II - Design Patterns for RubyistsSoftware Design Trilogy Part II - Design Patterns for Rubyists
Software Design Trilogy Part II - Design Patterns for Rubyists
 
The Rails Engine That Could - In Motion
The Rails Engine That Could - In MotionThe Rails Engine That Could - In Motion
The Rails Engine That Could - In Motion
 
The Rails Engine That Could
The Rails Engine That CouldThe Rails Engine That Could
The Rails Engine That Could
 
How I Learned To Apply Design Patterns
How I Learned To Apply Design PatternsHow I Learned To Apply Design Patterns
How I Learned To Apply Design Patterns
 
Simplifying Desktop Development With Glimmer
Simplifying Desktop Development With GlimmerSimplifying Desktop Development With Glimmer
Simplifying Desktop Development With Glimmer
 

Recently uploaded

leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
alexjohnson7307
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Tatiana Kojar
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 

Recently uploaded (20)

leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 

Software Design Trilogy Part I - Responsibility Driven Design for Rubyists

  • 1. Responsibility Driven Design for Rubyists An Outside-In OO Design Approach Software Design Trilogy – Part I Prepared and Presented by: Andy Maleh / Software Engineer / Groupon
  • 2. Outline Pop Quiz Responsibility Driven Design Responsibility Based Modeling GRASP Consolidated OO Design Process Exercise
  • 3. Pop Quiz What was the first object oriented language? Simula 67 - developed in the 1960s at the Norwegian Computing Center in Oslo
  • 4. Pop Quiz What are the key features/traits of Object Oriented Programming? Data Abstraction Encapsulation Messaging Modularity Inheritance Polymorphism
  • 5. Responsibility Driven Design Object oriented design technique that came from Rebecca Wirfs-Brock Reaction to Data-Driven Design’s lack of encapsulation for object data Focuses on object responsibilities and collaborations Object interaction follows a client/server model
  • 6. Responsibility Driven Design Process 1. Identify actions that must be taken to accomplish user goals in a software system 2. Identify responsibilities needed to perform these actions including information sharing responsibilities 3. Identify objects most suitable for responsibilities 4. Identify object collaborations needed to fulfill responsibilities, discovering new objects in the process 5. Iterate
  • 7. Responsibility Driven Design Example Action: Add new address for user, validating address, and filling in zip code automatically. Responsibilities: User information storage Address information storage Validate address Retrieve zip code for address
  • 8. Responsibility Driven Design Example Objects: User (stores user info) Address (stores address info, validates address) AddressFactory (creates new address, validates address, fills in zip code) ZipCodeService (retrieves zip code for address)
  • 9. Responsibility Based Modeling Responsibility Driven Design inspired technique by Alistair Cockburn that helps developers start design from the business domain model and use cases Often begins with higher-level component design and then delves down into object design Use case scenario steps act as the actions for which responsibilities must be identified (alternatively Given/When/Then scenarios in Rubyland) Objects can be identified using CRC cards or object interaction diagramming
  • 10. CRC Cards CRC stands for Class Responsibilities Collaborations Interactive paper exercise for discovering objects and collaborations Can be done collaboratively by multiple developers
  • 11. CRC Cards CRC stands for Class Responsibilities Collaborations Interactive paper technique for discovering object and collaborations based on identified high level responsibilities http://www.madsen.us/uop/BSA375/handouts.htm
  • 13. Object Interaction Diagramming Documents collaborations needed between objects to accomplish a user goal Helps developers discover objects and responsibilities The two most commonly used object interaction diagrams are: UML 2 Sequence Diagram UML 2 Communication Diagram
  • 15. Communication Diagram
  • 16. GRASP GRASP: General Responsibility Assignment Software Patterns They help developers figure out how to assign object responsibilities and evaluate design decisions Contemplated collectively instead of one at a time Provide the underpinnings for object oriented design Help explain how design patterns are arrived to
  • 17. GRASP 1. Creator: isolates object creation responsibilities 2. Information Expert: the object that holds the data performs the modification on the data 3. Controller: orchestrates multiple objects in accomplishing an action 4. Low Coupling: minimize coupling to other objects 5. High Cohesion: increase focus of object responsibilities
  • 18. GRASP 6. Polymorphism: assign responsibilities based on types to objects of these types 7. Pure Fabrication: fabricate an object to take on a responsibility that needs to be offloaded of another object to improve coupling/cohesion 8. Indirection: decouple two objects by introducing an intermediary to decrease coupling and increase reuse and interchangeability 9. Protected Variations: protect an object from variations of interactions with other objects by substituting the variations with one interaction with a super interface for the other objects and relying on polymorhpism
  • 19. Consolidated OO Design Process 1. Write functional requirements as use cases 2. Pick one use case and identify use case scenarios (or Given/When/Then) 3. Pick one use case scenario and identify actions 4. For each action, identify responsibilities needed to perform it
  • 20. Consolidated OO Design Process 5. For each responsibility, identify an object most suitable to fulfill it using GRASP as guidance 6. Review the responsibility assignments done for the picked use case scenario, possibly altering your decisions based on GRASP 7. Repeat until done with all use cases. This is done for one use case at a time and one iteration’s length of requirements at a time in an Agile process (thin slice approach as per Alistair Cockburn)
  • 21. Exercise Requirement: Ability to navigate deals Use Case: Search for deals near my location Scenario: Given I live in Chicago at 60622 When I sign into the system And I request a search for deals near my location And I specify keywords for finding deals Then I am presented with a collection of deals that match the specified keywords and are ordered by distance in ascending order
  • 22. Exercise – Responsibilities 1. User lookup 2. User authentication 3. User information (including address) 4. User interaction request handling 5. Presentation of search input form 6. Search Form input handling
  • 23. Exercise – Responsibilities 6. Searching for deals 7. Ordering of search results 8. Retrieval of deal information 9. Presentation of deal information
  • 24. Exercise – Objects 1. User lookup: UserRepository (High Cohesion) 2. User authentication: AuthenticationService (Pure Fabrication, High Cohesion) 3. User Information: User (Information Expert) 4. User interaction request handling: DealSearchController (Controller) 5. Presentation of search form: SearchInputForm (Information Expert) 6. Search form input handling: DealSearchController (Controller)
  • 25. Exercise – Objects 6. Searching for deals: DealSearchService (Pure Fabrication, High Cohesion) 7. Ordering of search results: DealSearchService (Pure Fabrication, High Cohesion) 8. Retrieval of deal information: DealRepository (High Cohesion) 9. Presentation of deal information: DealView (Pure Fabrication, High Cohesion, Indirection)
  • 26. Exercise – Notes • Objects can have methods that represent responsibilities they do not directly perform, yet delegate to collaboration objects • Example: User has a sign_in method, but the work is performed behind the scenes with the AuthenticationService
  • 27. Exercise – Notes on Ruby on Rails • Repositories and the objects they retrieve live in the same object with ActiveRecord. Think of the repository as the “Ruby class object” and the object it retrieves as the “Ruby class instance object” • Views are split into a template file (e.g. ERB or HAML) and a presenter object if needed to handle the presentation logic of the view. Rails Helpers often act as presenters though since they already have access to the view data context (Information Expert)
  • 28. Personal Exercise Create CRC Cards for the responsibilities we identified Diagram the object interaction for the responsibilities we identified (Sequence or Communication)
  • 29. Review Pop Quiz Responsibility Driven Design Responsibility Based Modeling GRASP Consolidated OO Design Process Exercise
  • 30. Stay Tuned for More Stay tuned for more in the Software Design Trilogy: Part II: Design Patterns for Rubyists – Who Said Dynamic Languages Can't Have Patterns? Part III: Domain Driven Design in RoR Apps – When Controllers and ActiveRecords Won't Cut It Anymore
  • 31. Contact Info Andy Maleh / Software Engineer / Groupon Blog: http://andymaleh.blogspot.com Twitter: @AndyMaleh
  • 32. References Responsibility Driven Design:http://wirfs- brock.com/PDFs/Responsibility- Driven.pdf Responsibility Based Modeling: http://alistair.cockburn.us/Responsibility- based+modeling GRASP: http://www.amazon.com/Applying-UML- Patterns-Introduction-Object-Oriented/dp/0131489062