Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Domain-Driven JavaScript Development

Domain-Driven JavaScript Development

Domain Driven Design (DDD) is an architectural pattern that focuses on building an accurate model of the business logic of an application. While remaining separate from the other layers of the architecture, this conceptual model is closely tied to the software implementation of that model. The benefits of this approach include flexibility, maintainability, and an easing of communication between the technical and domain experts.

DDD is somewhat established on the server side, but has seen very little use in client-side applications. We will introduce Keel.js: a very light framework on top of Backbone.js, which allows us to easily build domain-driven applications. We will discuss both the benefits and challenges of this approach.

Avatar for Bob Holt

Bob Holt

March 27, 2013

Other Decks in Programming

Transcript

  1. Bob  Holt   Specialist,  InteracFve  Development   Sapient  Global  Markets

      VisualizaFon  PracFce               @bobholt   github.com/bobholt  
  2. •  Asset  Management   •  Design  Pa3erns   •  ModularizaFon

      •  LinFng   •  TesFng   •  Build  Process  
  3. Domain   The  subject  of  the  program     Examples:

        •  Airline  booking  program:  People  ge]ng  on  aircra^   •  Stock  Trading  program:  SecuriFes  and  exchanges  
  4. Domain-­‐Driven  Design   Manage  complex  so^ware  by  placing  primary  

    focus  on  the  domain.     •  Principles   •  Techniques   •  PracFces  
  5. What  if  my  so^ware  isn’t  complex?   “Put  all  the

     business  logic  into  the  user  interface.   […]  Use  the  most  automated  UI  building  and  visual   programming  tools  available.”   -­‐Eric  Evans  
  6. Domain-­‐Driven  Design   Manage  complex  so^ware  by  placing  primary  

    focus  on  the  domain.     •  Principles   •  Techniques   •  PracFces  
  7. Domain  Model   •  AbstracFon  of  the  knowledge  in  a

     domain   expert’s  head   •  InFmately  linked  with  the  so^ware   implementaFon   •  If  a  domain  model  cannot  be  understood  by   sophisFcated  domain  experts,  then  there  is   something  wrong  with  the  model.  
  8. Backbone.js   In  an  ecosystem  where  overarching,  decides-­‐ everything-­‐for-­‐you  frameworks

     are   commonplace,  and  many  libraries  require  your   site  to  be  restructured  to  suit  their  look,  feel,   and  default  behavior  —  Backbone  should   conFnue  to  be  a  tool  that  gives  you  the  freedom   to  design  the  full  experience  of  your  web   applicaFon.   -­‐  Jeremy  Ashkenas    
  9. Keel   •  Lightweight  framework  around  Backbone.js   •  About

     pa3erns  and  pracFces,  not  fancy  code   •  5  Files:  BaseView,  ExcepFonUFl,  Message,   MessageBus,  Router   h3ps://github.com/archfirst/keel  
  10. Ubiquitous  Language   •  Concept  shared  with  Behavior-­‐Driven   Development

      •  Defined  terminology  that  is  shared  between   all  members  of  the  team   •  Used  in  all  code  and  wri3en  and  verbal   communicaFon  
  11. Express  the  Model  in  So^ware   •  DisFnguish  EnFFes,  Value

     Objects,  and   Services   •  Set  Aggregate  Boundaries   •  Implement  Repositories  and  Factories  
  12. Repositories   •  Global  interface   •  Provides  illusion  of

     in-­‐memory  collecFon  of  all   objects   •  Deals  with  the  data  store   •  Caches  as  necessary  
  13. Factories   •  Take  on  the  responsibility  of  creaFng  new

      objects   •  Tying  to  domain  or  applicaFon  can  be  ungainly   •  However,  Backbone  has  CollecFon.add  and   Model.validate  methods  that  can  take  care  of   this  for  us  
  14. Resources   •  Domain-­‐Driven  Design   – Domain-­‐Driven  Design:  Tackling  Complexity

     in  the   Heart  of  So^ware  –  Eric  Evans   – Domain  Driven  Design  Quickly  –  InfoQ   – Domain-­‐Driven  Design  –  Ne3uts+   •  Keel.js   – Keel  –  GitHub   – Bullsfirst  –  GitHub   – Archfirst  Project