build and maintain large ruby apps 0.0.1
TRANSCRIPT
![Page 1: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/1.jpg)
build and maintain large Ruby applications
Enrico Teotti - @agenteo - http://teotti.com [email protected]
![Page 2: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/2.jpg)
build and maintain large Ruby applications
Enrico Teotti - @agenteo - http://teotti.com [email protected]
![Page 3: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/3.jpg)
![Page 4: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/4.jpg)
Ruby files in a project are ingredients in a recipe
![Page 5: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/5.jpg)
think the application you’re working on
![Page 6: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/6.jpg)
yeast honeysalt
milkflourwater
lard
sugar
arugula
squacqueroneprosciutto
![Page 7: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/7.jpg)
yeast honeysalt
milkflourwater
lard
sugar
arugula
squacqueroneprosciutto piadina
![Page 8: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/8.jpg)
3 months later
![Page 9: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/9.jpg)
yeast honeysalt
milkflourwater
lard
sugar
arugula
squacqueroneprosciutto piadina
the curse of knowledge
![Page 10: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/10.jpg)
6 months later
![Page 11: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/11.jpg)
yeast
honeysalt
milkflourwater
lard
sugar
arugula
squacqueroneprosciutto
biscuits
mozzarella
sunflower oil
carrots
eggstomato puree
basil
oregano
mascarpone
![Page 12: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/12.jpg)
yeast
honeysalt
milkflourwater
lard
sugar
arugula
squacqueroneprosciutto
biscuits
mozzarella
sunflower oil
carrots
eggstomato puree
basil
oregano
mascarpone
piadina
pizza margherita
tiramisu
carrot cake
![Page 13: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/13.jpg)
in Italy everybody groups ingredients… by colour
![Page 14: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/14.jpg)
white ingredientsgreen ingredients
red ingredients
![Page 15: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/15.jpg)
white ingredientsgreen ingredients
classes grouped by design pattern
ls -l app/ controllers helpers models presenters services serializers strategies utils views
http://teotti.com/application-directories-named-as-architectural-patterns-antipattern/
![Page 16: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/16.jpg)
piadina
pizza margherita
tiramisu
carrot cake
![Page 17: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/17.jpg)
namespaces
![Page 18: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/18.jpg)
module Promotions class NewMember private def fetch_member(id) Membership::Finder.new(id) end endend
module Blog class AfterPublish private def add_blogger_to_promotion Promotions::NewMember.new end endend
![Page 19: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/19.jpg)
main Ruby application
promotions room decoratorname finderblog membership
“If a developer must consider the implementation of a component in order to use it, the value of
encapsulation is lost.” Eric Evans
![Page 20: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/20.jpg)
piadina worktop
tiramisu worktop
shared worktop
carrot cake worktop
pizza worktop
![Page 21: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/21.jpg)
piadina worktop
shared worktop
dessert worktop
pizza worktop
![Page 22: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/22.jpg)
gemsRuby libraries
![Page 23: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/23.jpg)
A
C
D
B
E
main Ruby application
your health plan API
drug information
claims platform
product information
membership
Conway’s Law“organizations which design systems … are constrained to produce designs which are copies of the communication structures of
these organizations"
gem
gem
gem
gem
gem
dependencydependency
dependencydependency dependency
http://teotti.com/create-dependency-structures-with-local-ruby-gems/
![Page 24: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/24.jpg)
$ cd local_gems $ bundle gem claims_platform $ bundle gem membership $ bundle gem product_information $ vim claims_platform/claims_platform.gemspecGem::Specification.new do |s| s.name = 'claims_platform'
s.add_runtime_dependency 'membership' s.add_runtime_dependency 'product_information'end
$ cat local_gems/claims_platform/Gemfilesource 'https://rubygems.org'
path '..'
gemspec
directory where all local gems live$ mkdir local_gems
![Page 25: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/25.jpg)
A
C
D
B
E
main Ruby application
your health plan API
drug information
claims platform
product information
membership
Sinatra, Rails, Lotus
![Page 26: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/26.jpg)
A
C
D
B
E
main Ruby application
your health plan API
drug information
claims platform
product information
membership
unit tested
unit tested
unit testedunit tested
unit tested
![Page 27: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/27.jpg)
A
C
main Ruby application
B
using C behaviour
without requiring it
When you execute A behaviour from the main
application first, triggering B (which is
using C without depending on it) will not
trigger an error.
When you trigger B (using C without
depending on it) from the main application will
not trigger an error
loaded in memory, deamon or webserver
unit tested
unit tested
not unit tested
![Page 28: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/28.jpg)
A
C
D
B
E
main Ruby application
F
H
I L
membership payment API
payment platform
bank transaction
credit card transaction
your health plan API
drug information
claims platform
product information
membership
![Page 29: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/29.jpg)
A
C
D
B
E
main Ruby application
F
H
I L
membership payment API
payment platform
bank transaction
credit card transaction
your health plan API
drug information
claims platform
product information
membership
![Page 30: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/30.jpg)
A
C
D
B
E
main Ruby application
F
H
I L
membership payment API
payment platform
bank transaction
credit card transaction
your health plan API
drug information
claims platform
product information
membership
![Page 31: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/31.jpg)
main Ruby application
your health plan API
drug information
claims platform
product information membership
membership payment
APIpayment platform
bank transaction
credit card transaction
![Page 32: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/32.jpg)
deploy parts of a Rails app
![Page 33: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/33.jpg)
EDITORIAL UI PUBLIC UI
DOMAIN LOGIC
editorial_ui.gemspec public_ui.gemspec
domain_logic.gemspec
Rails web application
![Page 34: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/34.jpg)
deploy@publicServer $ RUNNING_MODE=public rails s
deploy@editorialServer $ RUNNING_MODE=admin rails s
http://teotti.com/deploy-parts-of-a-ruby-on-rails-application/ http://teotti.com/reduce-memory-footprint-requiring-portions-of-your-component-based-rails-applications/
Rails.application.routes.draw docase AppRunningMode.value when :admin mount AdminUi::Engine => "/admin" when :public mount PublicUi::Engine => "/" else mount AdminUi::Engine => "/admin" mount PublicUi::Engine => "/"end
![Page 35: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/35.jpg)
EDITORIAL UI LEGACY MIGRATIONPUBLIC UI
DOMAIN LOGIC
editorial_ui.gemspec public_ui.gemspec
domain_logic.gemspec
Rails web application
legacy_migration.gemspec
![Page 36: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/36.jpg)
lotus.rb
![Page 37: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/37.jpg)
legacy Ruby applications
It is not age that turns a piece of software into a legacy system, but the rate at which it has been
developed and adapted without having been reengineered.
![Page 38: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/38.jpg)
Picasso
![Page 39: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/39.jpg)
BOOKING
PAYMENT
TRIP
tentative reservation
booked reservation
completed trip
reservation charged
Picasso
![Page 40: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/40.jpg)
incremental re-engineering
• Decompose the legacy system into parts.
• Choose one part to tackle at a time.
• Put tests in place for that part and the parts that depend on it.
• Take appropriate steps to wrap, reengineer, or replace the legacy component.
• Deploy the updated component and obtain feedback.
• Iterate
![Page 41: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/41.jpg)
incremental re-engineering
• Decompose the legacy system into parts.
• Choose one part to tackle at a time.
• Put tests in place for that part and the parts that depend on it.
• Take appropriate steps to wrap, reengineer, or replace the legacy component.
• Deploy the updated component and obtain feedback.
• Iterate
![Page 42: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/42.jpg)
incremental re-engineering
• Decompose the legacy system into parts.
• Choose one part to tackle at a time.
• Put tests in place for that part and the parts that depend on it.
• Take appropriate steps to wrap, reengineer, or replace the legacy component.
• Deploy the updated component and obtain feedback.
• Iterate
http://teotti.com/reengineer-legacy-rails-applications/
![Page 43: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/43.jpg)
team mindsets
![Page 44: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/44.jpg)
fixed mindset growth mindset
team mindsets
* the person is so talented* the person is so smart* the person is a CSS ninja
* the person is experienced* the person works really hard* the person is passionate about CSS and keeping up to date
![Page 45: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/45.jpg)
–Norman Kerth
“Regardless of what we discover, we understand and truly believe that everyone did the best job they could, given what they knew at the time, their skills and abilities, the resources available, and
the situation at hand.”
![Page 46: Build and maintain large Ruby apps 0.0.1](https://reader031.vdocument.in/reader031/viewer/2022022200/58ab36ac1a28abb64d8b5ded/html5/thumbnails/46.jpg)
build and maintain large Ruby applications
Enrico Teotti - @agenteo - http://teotti.com [email protected]