Rails is optimised for the first weeks of development. At the later phases it's no longer the speed of adding new views and data that matters. It's often more about the different (and changing!) ways of using the data. The business logic gets more complicated.
DDD has answers to those problems. Detecting the bounded contexts is the crucial skill. Choose which parts of the app leave as CRUD and which could go into more of the tactical DDD.
2. Agenda
• What is legacy
• Why and when Rails becomes legacy
• What is DDD
• Why it’s worth learning
• How to gradually go DDD - lessons learnt
3. Andrzej Krzywda
• 11 years with Rails
• running Arkency (Ruby agency)
• writing Ruby-related books
• RailsRefactoring.com
• blogging
• teaching Rails at University of Wroclaw (for the last 5 years)
• organising wroc_love.rb
• DRUG meetups in Wrocław
4. Andrzej Krzywda
• reviewed hundreds of Rails apps
• helped several Rails teams
• dealing with bigger Rails apps
15. • slow tests
• the test setup is long and complicated
• critical bugs more often
• slower development progress
• conflicts in the team, related to the code
• complicated codebase
• infinite API
22. • New techniques
• new tools
• Solutions to complicated business
logic
• solutions in non-Ruby worlds
• shared language with other
programmers
• microservices!
27. DDD-lite
• app service
• calls 1 or more domain services
• domain service
• takes repo as input
• load aggregate from the repo
• do sth cool
• may use some value objects
• may trigger some domain events
• save aggregate (repo)
28. • URL
• Rails action
• App service
• Domain service
• Repo
• ActiveRecord
• Database
48. Mutation testing
is the real test coverage!
http://blog.arkency.com/2015/04/why-i-want-to-introduce-mutation-testing-to-the-rails-event-store-gem/
http://blog.arkency.com/2015/06/how-good-are-your-ruby-tests-testing-your-tests-with-mutant/
51. Test units, not classes!
http://andrzejonsoftware.blogspot.com/2015/02/tdding-unit-not-class.html
http://andrzejonsoftware.blogspot.com/2014/04/tdd-and-rails-what-makes-good-unit.html
http://blog.arkency.com/2014/09/unit-tests-vs-class-tests/
52. Escape from the
framework ASAP
http://blog.arkency.com/2015/03/extract-a-service-object-in-any-framework/
Call application services from the framework
let Rails deal only with HTTP
53. Don’t just pass the
params/hash everywhere
http://andrzejonsoftware.blogspot.com/2011/12/args-opts-params.html