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

Feature Toggles! - Ruby

Feature Toggles! - Ruby

Feature toggles são uma técnica muito versátil para ajudar o trabalho de disponibilizar novas funcionalidades em produção sem quebrar a experiência de clientes e fazer entregas graduais, mas acabamos aprendendo sobre toggles de uma forma superficial no dia a dia.

Vamos ver um pouco do passado e presente do uso de features toggles, a sua facilidade de uso graças a gem flipper e considerações a serem feitas sobre como e quando usar toggles na sua aplicação

Lucas Mazza

August 18, 2018
Tweet

More Decks by Lucas Mazza

Other Decks in Technology

Transcript

  1. http://code.flickr.net/2009/12/02/flipping-out/ “Flickr is somewhat unique in that it uses a

    code repository with no branches; everything is checked into head, and head is pushed to production several times a day. ”
  2. “Flags allow us to restrict features to certain environments, while

    still using the same code base on all servers.” http://code.flickr.net/2009/12/02/flipping-out/
  3. “How do you use Continuous Integration to keep everyone working

    on the mainline without revealing a half- implemented feature on your releases? ” https://martinfowler.com/bliki/FeatureToggle.html
  4. “Feature Toggles are a powerful technique, allowing teams to modify

    system behavior without changing code.” https://martinfowler.com/articles/feature-toggles.html
  5. class DashboardsController < ApplicationController def show if Flipper.enabled?(:new_dashboard, current_user) render

    'dashboards/new_dashboard' else render 'dashboards/current_dashboard' end end end
  6. aCTOR gate class User def flipper_id "User:#{to_param}" end end Flipper.enabled?(:feature_just_for_you,

    current_user) Flipper.enable_actor(:feature_just_for_you, User.find(1))
  7. GROUP gate Flipper.register(:staff_users) do |actor| actor.respond_to?(:staff?) && actor.staff? end Flipper.register(:premium_clients)

    do |actor| actor.respond_to?(:subscription) && actor.subscription.plan_name == :premium end
  8. % gates Flipper.enable_percentage_of_actors(:new_search, 33) Flipper.enabled?(:new_search, User.find(1)) # => false Flipper.enabled?(:new_search,

    User.find(2)) # => false Flipper.enabled?(:new_search, User.find(3)) # => true Flipper.enable_percentage_of_time(:v2_header, 50) Flipper.enabled?(:v2_header) # => false Flipper.enabled?(:v2_header) # => true
  9. UI

  10. “Release toggles are a useful technique and lots of teams

    use them. However they should be your last choice when you're dealing with putting features into production.” https://martinfowler.com/bliki/FeatureToggle.html
  11. configurações da app não são toggles toggle ou regra de

    negócio? qual a diferença entre manter vs remover?
  12. configurações da app não são toggles toggle ou regra de

    negócio? qual a diferença entre manter vs remover? será que não é só trauma de deploys ruins?