class: middle, center, title-slide
.author[Adrien Di Pasquale - paris.rb 05/07/2016]
class: middle, center, invert, bigsm
# Gemfile
gem 'state_machine'
# or gem 'state_machines-activerecord'
class Movie
state_machine :state, :initial => :in_production do
event :finish_shooting do
transition :in_production => :in_theaters
end
end
end
$ rake state_machine:draw ...
name: intro
- startup context
???
- I will not speak of SM theory & research nor about integrated circuits.
- in a startup, SMs give structure to the code and to the whole team dynamic.
name: intro2 template: intro
- very structuring
???
- goals are :
- simple so it's easy to grasp for everyone, not only tech. it helps a lot when languages align.
- rational for developers to work with
- easy to update with product evolutions
template: intro2
- ∞ valid choices
???
the hard thing is that is no magic method to reach these goals. there is an infinity of possible and valid choices. you can make the product work with any of these designs
class: middle, center
class: center
.header[how to fail : tip n°1]
???
- corrolary : don't let your CTO or anyone else decide on his own
- listen to many people so you understand point of views. look how they interact with the data.
- ~imagine upcoming usecases.
- it takes time
- try and look for a consensus
- listening to your gut can help though
class: center, invert, twostates
class: center
.header[how to fail : tip n°2]
???
- do not think you can reach the truth. there are multiple truthes, each team (and maybe even each team member) can view the data differently.
- the truth will evolve as the product evolves
- sub objects may appear
- compromise for things you're not sure of, make the least engaging choice
class: center
.header[how to fail : tip n°3]
???
- you can orient it a little bit in the direction you want it to take for later
- usually, the least states, the easier it will later be to migrate the data.
class: center
.header[how to fail : tip n°4]
???
- store all transitions, up to the last one.
- will help migrating, and investigating what happened.
class: middle, center, full