SlideShare a Scribd company logo
THE 80’S – RESPONSIBILITY DRIVEN DESIGN
THE 90’S – DESIGN PATTERNS
THE 2000’S – DOMAIN DRIVEN DESIGN
WHAT WILL BE COVERED
•  Business Domain Modeling
•  The Ubiquitous Language
•  Model Driven Design
•  Example Business Domain
•  Demonstrative Rails Application
WHAT WON’T BE COVERED
•  Refactoring Toward Deeper Insight
•  Supple Design
•  Large Scale Structure
•  Bounded Contexts
•  Distillation
MUSIC SCHOOL BUSINESS
•  Offers classes for playing music, singing, and dancing
•  Has a music instrument store that sells products
•  Hosts music events with famous musicians
•  Available in multiple locations
EXAMPLE WEBSITE
© Old Town School of Folk Music
BUSINESS DOMAIN MODELING
•  Knowledge Crunching
•  Continuous Learning
•  Deeper Models
KNOWLEDGE CRUNCHING
•  What types of classes do you offer?
•  Do you offer the same classes in all locations?
•  Do you sell anything other than music instruments?
•  Are events paid for or free?
•  How many classes does each instructor teach?
•  How many lessons is a class?
•  Do classes vary from session to session?
CONTINUOUS LEARNING AND DEEPER MODELS
•  Instructors perform regularly at events
•  Instructors provide series of classes
•  Certain events recur regularly
•  Music store offers location pick up service
THE UBIQUITOUS LANGUAGE
•  Model Out Loud
•  One Team, One Language
•  Documents and Diagrams
•  Executable Bedrock
•  Explanatory Models
MODEL OUT LOUD
•  Students register in a class with an instructor
•  Students attend events
•  Customers buy music products
•  Instructors teach classes
•  Locations offer classes
ONE TEAM, ONE LANGUAGE
•  Course vs Class
•  Student vs Customer
•  Teacher vs Instructor
•  Event vs Concert
•  Location vs Branch
DOCUMENTS
•  Top level goals
•  Top level requirements
•  Top level use cases
DIAGRAMS             Product

                                              Class Series
     Customer
                        Class



 Session
                                           Location
                    Event



       Instructor
                               Performer
EXECUTABLE BEDROCK AND
EXPLANATORY MODELS
•  Domain knowledge is apparent in code
•  Method names describe behavior
•  Class names map to actual business models
MODEL DRIVEN DESIGN
•  Object Oriented Paradigm and Mixing Paradigms
•  Layered Architecture
•  Associations
•  Entities
•  Value Objects
MODEL DRIVEN DESIGN
•  Services
•  Modules
•  Aggregates
•  Factories
•  Repositories
OBJECT ORIENTED PARADIGM
AND MIXING PARADIGMS
•  Objects can generally embody any domain
•  Certain domains can benefit from mixing paradigms:
•  Functional
•  Logic
•  Rule Engine
LAYERED ARCHITECTURE
ASSOCIATIONS
•  Unidirectional
•  Emphasizes natural bias for operation and domain logic
•  Communicates association better
•  Bidirectional
•  Multiple entry points for operation
ASSOCIATIONS
•  Buying
•  Enrollment
•  Performing
•  Location
•  Timing
ENTITIES
•  Have an identity independent of attributes
•  Mutable
•  Have a life cycle
•  In Rails, typically handled with ActiveRecord
•  When outgrowing ActiveRecord split into a separate
   Ruby stateful class
ENTITIES
•  Examples:
•  Customer
•  Instructor
•  Class
VALUE OBJECTS
•  Identified by their attribute values
•  Immutable and unique
•  In Rails, typically handled by pure Ruby objects
•  Examples:
•  City
•  State
•  Class Name
•  Session Date Range
AGGREGATES
•  Aggregate roots are entities aggregating other entities
•  Manage the life cycle events of other entities
•  Non-aggregates are discouraged from being accessed
   directly to simply reasoning about the domain code
•  In Rails, typically handled by ActiveRecord
•  When outgrowing ActiveRecord, split off into a stateful
   Ruby class and handle life-cycle hooks in an observer
AGGREGATES
•  Examples:
•  ClassSeries aggregates Classes
•  Customer aggregates Address
•  Location aggregates Address
FACTORIES
•  Handle creation of complex aggregate roots
•  In Rails, typically handled by ActiveRecord
•  When outgrowing ActiveRecord, split into a separete
   Ruby stateless class
FACTORIES
•  Examples:
•  ClassFactory handles creation of class with:
  •  Session association
  •  ClassCategory association
  •  Instructor association
REPOSITORIES
•  Handle storage and retrieval of aggregate roots
•  Manage lifecycle events
•  In Rails, typically handled by ActiveRecord
•  When outgrowing ActiveRecord, split into a separate
   stateless Ruby class that delegates work to ActiveRecord
REPOSITORIES
•  Examples:
 •  StudentRepository
 •  InstructorRepository
 •  SessionRepository
SERVICES
•  Model stateless business processes without a lifecycle
•  Useful for operations that span multiple entities
•  Often represent use cases
•  In Rails, typically represented in controllers that mix
   view concerns
•  When outgrowing Rails controllers, split into stateless
   Ruby service objects
SERVICES
•  Examples:
•  ClassEnrollmentService
•  MusicStoreService
•  EventTicketingService
MODULES
•  Package cohesive units of business behavior
•  Cut across software layers
•  In Rails, handled with Modules and Rails Engines
•  Examples:
•  MusicStore
•  ClassesEnrollment
•  EventTicketing
RUBY ON RAILS APPLICATION
RUBY ON RAILS APPLICATION
RUBY ON RAILS APPLICATION
RUBY ON RAILS APPLICATION
RUBY ON RAILS APPLICATION
RUBY ON RAILS APPLICATION
WHAT WAS COVERED
•  Business Domain Modeling
•  The Ubiquitous Language
•  Model Driven Design
•  Example Business Domain
•  Demonstrative Rails Application
QUESTIONS
   ???
2010’S - ???
REFERENCES
•  Domain-Driven Design by Eric Evans
CONTACT INFO
•  Andy Maleh / Software Engineer / Groupon
•  Blog: http://andymaleh.blogspot.com
•  Twitter: @AndyMaleh

More Related Content

What's hot

Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
Johan Andrén
 
Whitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to ReactiveWhitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to Reactive
Dragos Manolescu
 
Scala Jump Start
Scala Jump StartScala Jump Start
Scala Jump Start
Haim Michael
 
Scala Native: Ahead of Time
Scala Native: Ahead of TimeScala Native: Ahead of Time
Scala Native: Ahead of Time
Nadav Wiener
 
UPenn on Rails intro
UPenn on Rails introUPenn on Rails intro
UPenn on Rails intro
Mat Schaffer
 
Akkurate Akka
Akkurate AkkaAkkurate Akka
Akkurate Akka
Yurii Ostapchuk
 
Agile North East Agile + DevOps by Craig Pearson of CAP Project Services
Agile North East Agile + DevOps by Craig Pearson of CAP Project ServicesAgile North East Agile + DevOps by Craig Pearson of CAP Project Services
Agile North East Agile + DevOps by Craig Pearson of CAP Project Services
Craig Pearson
 
A Swift introduction a.k.a Fun with Minions!
A Swift introduction a.k.a Fun with Minions!A Swift introduction a.k.a Fun with Minions!
A Swift introduction a.k.a Fun with Minions!
Natasha Murashev
 
Staging and Deployment
Staging and DeploymentStaging and Deployment
Staging and Deployment
heyrocker
 
Serverless: when functions and GitOps collide
Serverless: when functions and GitOps collideServerless: when functions and GitOps collide
Serverless: when functions and GitOps collide
Edward Wilde
 
Scala Introduction - Meetup Scaladores RJ
Scala Introduction - Meetup Scaladores RJScala Introduction - Meetup Scaladores RJ
Scala Introduction - Meetup Scaladores RJ
Rodrigo Lima
 
Webservices: The RESTful Approach
Webservices: The RESTful ApproachWebservices: The RESTful Approach
Webservices: The RESTful Approach
Mushfekur Rahman
 
Lessons Learned: Scala and its Ecosystem
Lessons Learned: Scala and its EcosystemLessons Learned: Scala and its Ecosystem
Lessons Learned: Scala and its Ecosystem
Petr Hošek
 
The Apache Way
The Apache WayThe Apache Way
The Apache Way
Evans Ye
 
20171108 PDN HOL React Basics
20171108 PDN HOL React Basics20171108 PDN HOL React Basics
20171108 PDN HOL React Basics
Rich Ross
 
Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®
Hannes Lowette
 
Application Deployment at UC Riverside
Application Deployment at UC RiversideApplication Deployment at UC Riverside
Application Deployment at UC Riverside
Michael Kennedy
 
Bridging the Gap - Laracon 2013
Bridging the Gap - Laracon 2013Bridging the Gap - Laracon 2013
Bridging the Gap - Laracon 2013
Ben Corlett
 
GitHub as a Landing Page
GitHub as a Landing Page GitHub as a Landing Page
GitHub as a Landing Page
Pronovix
 

What's hot (19)

Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Whitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to ReactiveWhitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to Reactive
 
Scala Jump Start
Scala Jump StartScala Jump Start
Scala Jump Start
 
Scala Native: Ahead of Time
Scala Native: Ahead of TimeScala Native: Ahead of Time
Scala Native: Ahead of Time
 
UPenn on Rails intro
UPenn on Rails introUPenn on Rails intro
UPenn on Rails intro
 
Akkurate Akka
Akkurate AkkaAkkurate Akka
Akkurate Akka
 
Agile North East Agile + DevOps by Craig Pearson of CAP Project Services
Agile North East Agile + DevOps by Craig Pearson of CAP Project ServicesAgile North East Agile + DevOps by Craig Pearson of CAP Project Services
Agile North East Agile + DevOps by Craig Pearson of CAP Project Services
 
A Swift introduction a.k.a Fun with Minions!
A Swift introduction a.k.a Fun with Minions!A Swift introduction a.k.a Fun with Minions!
A Swift introduction a.k.a Fun with Minions!
 
Staging and Deployment
Staging and DeploymentStaging and Deployment
Staging and Deployment
 
Serverless: when functions and GitOps collide
Serverless: when functions and GitOps collideServerless: when functions and GitOps collide
Serverless: when functions and GitOps collide
 
Scala Introduction - Meetup Scaladores RJ
Scala Introduction - Meetup Scaladores RJScala Introduction - Meetup Scaladores RJ
Scala Introduction - Meetup Scaladores RJ
 
Webservices: The RESTful Approach
Webservices: The RESTful ApproachWebservices: The RESTful Approach
Webservices: The RESTful Approach
 
Lessons Learned: Scala and its Ecosystem
Lessons Learned: Scala and its EcosystemLessons Learned: Scala and its Ecosystem
Lessons Learned: Scala and its Ecosystem
 
The Apache Way
The Apache WayThe Apache Way
The Apache Way
 
20171108 PDN HOL React Basics
20171108 PDN HOL React Basics20171108 PDN HOL React Basics
20171108 PDN HOL React Basics
 
Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®
 
Application Deployment at UC Riverside
Application Deployment at UC RiversideApplication Deployment at UC Riverside
Application Deployment at UC Riverside
 
Bridging the Gap - Laracon 2013
Bridging the Gap - Laracon 2013Bridging the Gap - Laracon 2013
Bridging the Gap - Laracon 2013
 
GitHub as a Landing Page
GitHub as a Landing Page GitHub as a Landing Page
GitHub as a Landing Page
 

Similar to Software Design Trilogy Part III - Domain Driven Design for Ruby on Rails Applications

Digitization revealed (2018 NLA Annual Conference)
Digitization revealed (2018 NLA Annual Conference)Digitization revealed (2018 NLA Annual Conference)
Digitization revealed (2018 NLA Annual Conference)
Marina Georgieva
 
Design Pattern Zoology
Design Pattern ZoologyDesign Pattern Zoology
Design Pattern Zoology
Josh Adell
 
Domain Driven Design Ruby Ways - JURNAL 05/10/2017
Domain Driven Design Ruby Ways -  JURNAL 05/10/2017Domain Driven Design Ruby Ways -  JURNAL 05/10/2017
Domain Driven Design Ruby Ways - JURNAL 05/10/2017
Jonathan Wylliem
 
[DevDay 2016] Design Pattern at a glance - Speaker: Tuan Do – Scrum Master a...
 [DevDay 2016] Design Pattern at a glance - Speaker: Tuan Do – Scrum Master a... [DevDay 2016] Design Pattern at a glance - Speaker: Tuan Do – Scrum Master a...
[DevDay 2016] Design Pattern at a glance - Speaker: Tuan Do – Scrum Master a...
DevDay Da Nang
 
Implementing DDD Concepts in PHP
Implementing DDD Concepts in PHPImplementing DDD Concepts in PHP
Implementing DDD Concepts in PHP
Steve Rhoades
 
MongoDB at Agilysys: A Case Study
MongoDB at Agilysys: A Case StudyMongoDB at Agilysys: A Case Study
MongoDB at Agilysys: A Case Study
MongoDB
 
Testing-Tools-Magnitia-Content.pdf
Testing-Tools-Magnitia-Content.pdfTesting-Tools-Magnitia-Content.pdf
Testing-Tools-Magnitia-Content.pdf
AnanthReddy38
 
Drupal vs WordPress
Drupal vs WordPressDrupal vs WordPress
Drupal vs WordPress
Phill Brown
 
Introduction to Test Driven Development
Introduction to Test Driven DevelopmentIntroduction to Test Driven Development
Introduction to Test Driven Development
Sarah Dutkiewicz
 
Alex Theedom Java ee revisits design patterns
Alex Theedom	Java ee revisits design patternsAlex Theedom	Java ee revisits design patterns
Alex Theedom Java ee revisits design patterns
Аліна Шепшелей
 
SE2016 Java Alex Theedom "Java EE revisits design patterns"
SE2016 Java Alex Theedom "Java EE revisits design patterns"SE2016 Java Alex Theedom "Java EE revisits design patterns"
SE2016 Java Alex Theedom "Java EE revisits design patterns"
Inhacking
 
Schibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD CourseSchibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD Course
Kevin Mas Ruiz
 
Introduction to Testing and TDD
Introduction to Testing and TDDIntroduction to Testing and TDD
Introduction to Testing and TDD
Sarah Dutkiewicz
 
Leveraging D2L’s LOR for Consistency, Scalability and Student Success in Cour...
Leveraging D2L’s LOR for Consistency, Scalability and Student Success in Cour...Leveraging D2L’s LOR for Consistency, Scalability and Student Success in Cour...
Leveraging D2L’s LOR for Consistency, Scalability and Student Success in Cour...
D2L Barry
 
Domain Driven Design Demonstrated
Domain Driven Design Demonstrated Domain Driven Design Demonstrated
Domain Driven Design Demonstrated
Alan Christensen
 
Automating Complex High-Volume Technical Paper and Journal Article Page Compo...
Automating Complex High-Volume Technical Paper and Journal Article Page Compo...Automating Complex High-Volume Technical Paper and Journal Article Page Compo...
Automating Complex High-Volume Technical Paper and Journal Article Page Compo...
dclsocialmedia
 
Cloud development professional_training_module_1603813251908
Cloud development professional_training_module_1603813251908Cloud development professional_training_module_1603813251908
Cloud development professional_training_module_1603813251908
prasennabhai
 
Sap abap course content
Sap abap course contentSap abap course content
Sap abap course content
srinathvemavarm
 
Sap abap course
Sap abap course Sap abap course
Sap abap course
prettyrepeat
 
Object Oriented Analysis & Design
Object Oriented Analysis & DesignObject Oriented Analysis & Design
Object Oriented Analysis & Design
vishykn
 

Similar to Software Design Trilogy Part III - Domain Driven Design for Ruby on Rails Applications (20)

Digitization revealed (2018 NLA Annual Conference)
Digitization revealed (2018 NLA Annual Conference)Digitization revealed (2018 NLA Annual Conference)
Digitization revealed (2018 NLA Annual Conference)
 
Design Pattern Zoology
Design Pattern ZoologyDesign Pattern Zoology
Design Pattern Zoology
 
Domain Driven Design Ruby Ways - JURNAL 05/10/2017
Domain Driven Design Ruby Ways -  JURNAL 05/10/2017Domain Driven Design Ruby Ways -  JURNAL 05/10/2017
Domain Driven Design Ruby Ways - JURNAL 05/10/2017
 
[DevDay 2016] Design Pattern at a glance - Speaker: Tuan Do – Scrum Master a...
 [DevDay 2016] Design Pattern at a glance - Speaker: Tuan Do – Scrum Master a... [DevDay 2016] Design Pattern at a glance - Speaker: Tuan Do – Scrum Master a...
[DevDay 2016] Design Pattern at a glance - Speaker: Tuan Do – Scrum Master a...
 
Implementing DDD Concepts in PHP
Implementing DDD Concepts in PHPImplementing DDD Concepts in PHP
Implementing DDD Concepts in PHP
 
MongoDB at Agilysys: A Case Study
MongoDB at Agilysys: A Case StudyMongoDB at Agilysys: A Case Study
MongoDB at Agilysys: A Case Study
 
Testing-Tools-Magnitia-Content.pdf
Testing-Tools-Magnitia-Content.pdfTesting-Tools-Magnitia-Content.pdf
Testing-Tools-Magnitia-Content.pdf
 
Drupal vs WordPress
Drupal vs WordPressDrupal vs WordPress
Drupal vs WordPress
 
Introduction to Test Driven Development
Introduction to Test Driven DevelopmentIntroduction to Test Driven Development
Introduction to Test Driven Development
 
Alex Theedom Java ee revisits design patterns
Alex Theedom	Java ee revisits design patternsAlex Theedom	Java ee revisits design patterns
Alex Theedom Java ee revisits design patterns
 
SE2016 Java Alex Theedom "Java EE revisits design patterns"
SE2016 Java Alex Theedom "Java EE revisits design patterns"SE2016 Java Alex Theedom "Java EE revisits design patterns"
SE2016 Java Alex Theedom "Java EE revisits design patterns"
 
Schibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD CourseSchibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD Course
 
Introduction to Testing and TDD
Introduction to Testing and TDDIntroduction to Testing and TDD
Introduction to Testing and TDD
 
Leveraging D2L’s LOR for Consistency, Scalability and Student Success in Cour...
Leveraging D2L’s LOR for Consistency, Scalability and Student Success in Cour...Leveraging D2L’s LOR for Consistency, Scalability and Student Success in Cour...
Leveraging D2L’s LOR for Consistency, Scalability and Student Success in Cour...
 
Domain Driven Design Demonstrated
Domain Driven Design Demonstrated Domain Driven Design Demonstrated
Domain Driven Design Demonstrated
 
Automating Complex High-Volume Technical Paper and Journal Article Page Compo...
Automating Complex High-Volume Technical Paper and Journal Article Page Compo...Automating Complex High-Volume Technical Paper and Journal Article Page Compo...
Automating Complex High-Volume Technical Paper and Journal Article Page Compo...
 
Cloud development professional_training_module_1603813251908
Cloud development professional_training_module_1603813251908Cloud development professional_training_module_1603813251908
Cloud development professional_training_module_1603813251908
 
Sap abap course content
Sap abap course contentSap abap course content
Sap abap course content
 
Sap abap course
Sap abap course Sap abap course
Sap abap course
 
Object Oriented Analysis & Design
Object Oriented Analysis & DesignObject Oriented Analysis & Design
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 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
 
Software Design Trilogy Part I - Responsibility Driven Design for Rubyists
Software Design Trilogy Part I - Responsibility Driven Design for RubyistsSoftware Design Trilogy Part I - Responsibility Driven Design for Rubyists
Software Design Trilogy Part I - Responsibility Driven Design 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 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
 
Software Design Trilogy Part I - Responsibility Driven Design for Rubyists
Software Design Trilogy Part I - Responsibility Driven Design for RubyistsSoftware Design Trilogy Part I - Responsibility Driven Design for Rubyists
Software Design Trilogy Part I - Responsibility Driven Design 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

SAP S/4 HANA sourcing and procurement to Public cloud
SAP S/4 HANA sourcing and procurement to Public cloudSAP S/4 HANA sourcing and procurement to Public cloud
SAP S/4 HANA sourcing and procurement to Public cloud
maazsz111
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
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
 
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
 
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
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
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
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
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
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
LucaBarbaro3
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
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
 
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
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
Intelisync
 

Recently uploaded (20)

SAP S/4 HANA sourcing and procurement to Public cloud
SAP S/4 HANA sourcing and procurement to Public cloudSAP S/4 HANA sourcing and procurement to Public cloud
SAP S/4 HANA sourcing and procurement to Public cloud
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
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
 
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
 
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
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
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
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
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 ...
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
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
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
 

Software Design Trilogy Part III - Domain Driven Design for Ruby on Rails Applications

  • 1.
  • 2. THE 80’S – RESPONSIBILITY DRIVEN DESIGN
  • 3. THE 90’S – DESIGN PATTERNS
  • 4. THE 2000’S – DOMAIN DRIVEN DESIGN
  • 5. WHAT WILL BE COVERED •  Business Domain Modeling •  The Ubiquitous Language •  Model Driven Design •  Example Business Domain •  Demonstrative Rails Application
  • 6. WHAT WON’T BE COVERED •  Refactoring Toward Deeper Insight •  Supple Design •  Large Scale Structure •  Bounded Contexts •  Distillation
  • 7. MUSIC SCHOOL BUSINESS •  Offers classes for playing music, singing, and dancing •  Has a music instrument store that sells products •  Hosts music events with famous musicians •  Available in multiple locations
  • 8. EXAMPLE WEBSITE © Old Town School of Folk Music
  • 9. BUSINESS DOMAIN MODELING •  Knowledge Crunching •  Continuous Learning •  Deeper Models
  • 10. KNOWLEDGE CRUNCHING •  What types of classes do you offer? •  Do you offer the same classes in all locations? •  Do you sell anything other than music instruments? •  Are events paid for or free? •  How many classes does each instructor teach? •  How many lessons is a class? •  Do classes vary from session to session?
  • 11. CONTINUOUS LEARNING AND DEEPER MODELS •  Instructors perform regularly at events •  Instructors provide series of classes •  Certain events recur regularly •  Music store offers location pick up service
  • 12. THE UBIQUITOUS LANGUAGE •  Model Out Loud •  One Team, One Language •  Documents and Diagrams •  Executable Bedrock •  Explanatory Models
  • 13. MODEL OUT LOUD •  Students register in a class with an instructor •  Students attend events •  Customers buy music products •  Instructors teach classes •  Locations offer classes
  • 14. ONE TEAM, ONE LANGUAGE •  Course vs Class •  Student vs Customer •  Teacher vs Instructor •  Event vs Concert •  Location vs Branch
  • 15. DOCUMENTS •  Top level goals •  Top level requirements •  Top level use cases
  • 16. DIAGRAMS Product Class Series Customer Class Session Location Event Instructor Performer
  • 17. EXECUTABLE BEDROCK AND EXPLANATORY MODELS •  Domain knowledge is apparent in code •  Method names describe behavior •  Class names map to actual business models
  • 18. MODEL DRIVEN DESIGN •  Object Oriented Paradigm and Mixing Paradigms •  Layered Architecture •  Associations •  Entities •  Value Objects
  • 19. MODEL DRIVEN DESIGN •  Services •  Modules •  Aggregates •  Factories •  Repositories
  • 20. OBJECT ORIENTED PARADIGM AND MIXING PARADIGMS •  Objects can generally embody any domain •  Certain domains can benefit from mixing paradigms: •  Functional •  Logic •  Rule Engine
  • 22. ASSOCIATIONS •  Unidirectional •  Emphasizes natural bias for operation and domain logic •  Communicates association better •  Bidirectional •  Multiple entry points for operation
  • 23. ASSOCIATIONS •  Buying •  Enrollment •  Performing •  Location •  Timing
  • 24. ENTITIES •  Have an identity independent of attributes •  Mutable •  Have a life cycle •  In Rails, typically handled with ActiveRecord •  When outgrowing ActiveRecord split into a separate Ruby stateful class
  • 26. VALUE OBJECTS •  Identified by their attribute values •  Immutable and unique •  In Rails, typically handled by pure Ruby objects •  Examples: •  City •  State •  Class Name •  Session Date Range
  • 27. AGGREGATES •  Aggregate roots are entities aggregating other entities •  Manage the life cycle events of other entities •  Non-aggregates are discouraged from being accessed directly to simply reasoning about the domain code •  In Rails, typically handled by ActiveRecord •  When outgrowing ActiveRecord, split off into a stateful Ruby class and handle life-cycle hooks in an observer
  • 28. AGGREGATES •  Examples: •  ClassSeries aggregates Classes •  Customer aggregates Address •  Location aggregates Address
  • 29. FACTORIES •  Handle creation of complex aggregate roots •  In Rails, typically handled by ActiveRecord •  When outgrowing ActiveRecord, split into a separete Ruby stateless class
  • 30. FACTORIES •  Examples: •  ClassFactory handles creation of class with: •  Session association •  ClassCategory association •  Instructor association
  • 31. REPOSITORIES •  Handle storage and retrieval of aggregate roots •  Manage lifecycle events •  In Rails, typically handled by ActiveRecord •  When outgrowing ActiveRecord, split into a separate stateless Ruby class that delegates work to ActiveRecord
  • 32. REPOSITORIES •  Examples: •  StudentRepository •  InstructorRepository •  SessionRepository
  • 33. SERVICES •  Model stateless business processes without a lifecycle •  Useful for operations that span multiple entities •  Often represent use cases •  In Rails, typically represented in controllers that mix view concerns •  When outgrowing Rails controllers, split into stateless Ruby service objects
  • 34. SERVICES •  Examples: •  ClassEnrollmentService •  MusicStoreService •  EventTicketingService
  • 35. MODULES •  Package cohesive units of business behavior •  Cut across software layers •  In Rails, handled with Modules and Rails Engines •  Examples: •  MusicStore •  ClassesEnrollment •  EventTicketing
  • 36. RUBY ON RAILS APPLICATION
  • 37. RUBY ON RAILS APPLICATION
  • 38. RUBY ON RAILS APPLICATION
  • 39. RUBY ON RAILS APPLICATION
  • 40. RUBY ON RAILS APPLICATION
  • 41. RUBY ON RAILS APPLICATION
  • 42. WHAT WAS COVERED •  Business Domain Modeling •  The Ubiquitous Language •  Model Driven Design •  Example Business Domain •  Demonstrative Rails Application
  • 43. QUESTIONS ???
  • 46. CONTACT INFO •  Andy Maleh / Software Engineer / Groupon •  Blog: http://andymaleh.blogspot.com •  Twitter: @AndyMaleh