My domain is mine and I don't share it

My domain is mine and I don't share it

What's business logic exactly? What's a domain model? Which truths hide behind "patterns" like fat model - skinny controller? How does the use of a framework like Rails influence how we build a domain model?

This talk will approach the problems that we have to face when we put a tool in the core of our system and we will discuss whether the price we pay for the rails is too high.

This talk was given on Madrid.rb users group.

607891bd2cfbfa3a75ada8e110992d47?s=128

Javier Acero

May 30, 2013
Tweet

Transcript

  1. 13.
  2. 14.
  3. 15.
  4. 20.
  5. 21.

    1

  6. 22.

    3

  7. 23.

    2

  8. 25.

    ARE THESE 3 LAYERS YOUR APP? ARE THEY EQUALLY IMPORTANT?

    DO THEY OBEY THE SAME RULES? DO THEY CHANGE AT THE SAME PACE?
  9. 26.

    ARE THESE 3 LAYERS YOUR APP? ARE THEY EQUALLY IMPORTANT?

    DO THEY OBEY THE SAME RULES? DO THEY CHANGE AT THE SAME PACE?
  10. 27.

    ARE THESE 3 LAYERS YOUR APP? ARE THEY EQUALLY IMPORTANT?

    DO WE BUILD THEM THE SAME WAY? DO THEY CHANGE AT THE SAME PACE?
  11. 28.

    ARE THESE 3 LAYERS YOUR APP? ARE THEY EQUALLY IMPORTANT?

    DO WE BUILD THEM THE SAME WAY? DO THEY CHANGE AT THE SAME PACE?
  12. 36.

    Business logic is a non-technical term used to describe the

    functional algorithms that handle information exchange between a database and a user interface - WIKIPEDIA
  13. 37.

    Business logic is a non-technical term used to describe the

    functional algorithms that handle information exchange between a database and a user interface - WIKIPEDIA
  14. 40.
  15. 41.
  16. 42.
  17. 43.

    Business logic is the work the application needs to do

    for the domain it’s working with - Martin Fowler - Patterns of Enterprise Application Architecture
  18. 46.
  19. 50.

    simple easy to understand works great with simple datasources makes

    transaction boundaries visible 00 {ADVANTAGES
  20. 51.

    DIS 00 {duplicated code procedural code duplicated code procedural code

    duplicated code procedural code duplicated code procedural code ADVANTAGES
  21. 57.

    00 {modeling limited by and tied to the data model

    mechanisms basic to oop like polymorphism are not available DISADVANTAGES
  22. 59.

    A software model based specifically in the domain of the

    business you are working with. - Vaughn Vernon - Implementing Domain Driven Design
  23. 60.

    It’s usually built as an object model, where objects have

    both data and behaviour with accurate business meaning. - Vaughn Vernon - Implementing Domain Driven Design
  24. 63.

    The Object Oriented way of implementing business logic. - Martin

    Fowler - Patterns of Enterprise Application Architecture
  25. 64.

    - Martin Fowler - Patterns of Enterprise Application Architecture Using

    a Domain Model as opposed to a Transaction Script is the essence of the paradigm shift to Object Oriented programming.
  26. 66.

    the hardest to comprehend data sources get more complex overhead

    for simple business logic DISADVANTAGES 00 {
  27. 69.
  28. 81.
  29. 93.
  30. 94.
  31. 95.
  32. 97.
  33. 98.

    SAME COMPLEXITY SAME L O C COUNT or even bigger!

    . . . http://www.slideshare.net/pcalcado/from-a-monolithic-ruby-on-rails-app-to-the-jvm
  34. 108.

    Another argument against ActiveRecord is the fact that it couples

    the object design to the database design. This makes difficult to refactor either design as the project goes forward. - Martin Fowler - Patterns of Enterprise Application Architecture
  35. 111.
  36. 116.

    Active Record is a good choice for business logic that

    is not too complex, such as creates, reads updates and deletes - Martin Fowler - Patterns of Enterprise Application Architecture
  37. 130.
  38. 133.
  39. 134.

    http://michaelfeathers.typepad.com/michael_feathers_blog/2013/01/the-framework-superclass-anti-pattern.html When you inherit code from a framework, it is

    mixed with your logic. Often you are obliged to run that inherited code with the code that you really want to test, along with all of its dependencies, start up time... - Michael Feathers - On his blog on January 2013
  40. 135.

    http://michaelfeathers.typepad.com/michael_feathers_blog/2013/01/the-framework-superclass-anti-pattern.html If you've written logic important to your domain, there

    is nothing preventing you from being able to use that logic with other technology - nothing except coupling. - Michael Feathers - On his blog on January 2013
  41. 145.
  42. 146.

    http://www.threeriversinstitute.org/blog/?p=338 In a connected system, elements are highly available to

    each other. Adding the first feature to a connected system is cheap. All the resources you need are available. However, the cost of all those connections is that subsequent features are very likely to interact with previous features, driving up the cost of development over time.
  43. 147.

    http://www.threeriversinstitute.org/blog/?p=338 In a modular design connections are deliberately kept to

    a minimum. The cost for the first feature is likely to be higher than in the connected system, because you need to find the necessary resources and bring them together, possibly re-modularizing in the process. Features are much less likely to interact in a modular system, though, leading to a steady stream of features at relatively constant cost.
  44. 150.
  45. 151.

    - Not about anemic domain models - Nothing to do

    with J2EE - Also on @DHH’s list (ironically) - The rails way’s antithesis (IMHO) - Not about data centric approaches - Not on @DHH’s list (but it should)
  46. 159.
  47. 160.

    Ruby Midwest 2011 Logo: http://cdn.confreaks.com/system/events/logos/49/rmw-logo-mid-original.png?1323836412 Uncle Bob picture: http://www.flickr.com/photos/koss/3250213001/ Home

    Alone Picture: http://www.multiplemayhemmamma.com/wp-content/uploads/2013/03/home-alone.jpg Terrified Adult Picture: http://sidoxia.files.wordpress.com/2011/02/scared.jpg Terrified Baby Picture: http://2.bp.blogspot.com/_0p-Jm7tsSa8/TNDUaU-HdHI/AAAAAAAAFfE/9ubR079H9UE/s1600/DSC_0425.JPG Spaghetti Picture: http://tonispilsburycom.wpengine.netdna-cdn.com/wp-content/uploads/2012/01/Mira10.jpg Dr. House Picture: http://4.bp.blogspot.com/-_EO0zOLq8YU/T8OUH5Zl5rI/AAAAAAAABLk/O_LYbtJuS1w/s1600/House+facepalm.jpg Martin Fowler Picture: http://www.flickr.com/photos/pragdave/173640462/ Vaughn Vernon Picture: https://si0.twimg.com/profile_images/1670662520/VaughnVernon_2011_2.JPG Fat & Skinny Silhouette: http://2.bp.blogspot.com/-C_B_KLHbBJ4/TiMWn5L5xUI/AAAAAAAAEDs/lqwnKydRPiQ/s1600/transition-fat_to_thin1.jpg Bear Facepalm Picture: http://blog.littlebigfund.org/wp-content/uploads/2013/04/facepalm-wallpaper.jpg Lion Facepalm Picture: http://wolfallen.w.o.pic.centerblog.net/nqgyh2l0.jpg
  48. 161.

    Table Icon: http://fortawesome.github.io/Font-Awesome/icon/table/ Robot: http://icons.iconarchive.com/icons/martin-berube/character/256/Robot-icon.png Monster: http://icons.iconarchive.com/icons/martin-berube/character/256/Monster-icon.png Database Icon: http://iconmonstr.com/database-icon/

    Buried In Paper Picture: http://everythingchangesbook.com/wp-content/uploads/2009/03/paper-pile.jpg Cave Picture: http://imagenes.viajeros.com/fotos/l/ll/lleimrlh-1259512525.jpg Globe Icon: http://iconmonstr.com/globe-4-icon/ Refresh Icon: http://iconmonstr.com/refresh-2-icon/ J.B. Rainsberger Avatar: http://www.devtraining.ee/sites/default/files/trainers/rainsberger_0.jpg Michael Feathers Avatar: http://i985.photobucket.com/albums/ae335/edepodesta/MichaelFeathersNew.jpg Kent Beck Picture: http://www.flickr.com/photos/26420411@N02/3062930943/ Tool Icon: http://fortawesome.github.io/Font-Awesome/icon/wrench/