Waffle: A feature switch/flag/toggle application for Django

3,595 views

Published on

Published in: Technology, Business
1 Comment
10 Likes
Statistics
Notes
No Downloads
Views
Total views
3,595
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
12
Comments
1
Likes
10
Embeds 0
No embeds

No notes for slide
  • Waffle, a Django application that provides “feature switches”, which let you deploy the code for a new feature without showing it to the user.
  • Working with RECON Dynamics, a start-up headquartered in Kirkland, which makes these asset trackers that have sensors and radio transmitters in so you can monitor stuff remotely and locate them.
  • Looking more closely at thatscreengrabSee that this generator has been running for 1 hour, and that it’s in a parking lot by the beachfront in Carillon Point
  • A lot of developers use feature branchesWho uses feature branchesEspecially as Git makes it so easy to create, delete and merge branchesEven with CI, running full suite of unit and integration tests on a branch is painful, so less likely to do itIf you’re working on a lot of features at once, things can get pretty overwhelming
  • Being able to hide changes from users lets you do things differently
  • So some feature switch solutions for Django.But wait, this is Rover.com, not Felix.com…
  • Waffle is the most popular if you look at downloads. the other main candidate is Gargoyle (David Cramer), which we started out with but moved away from as it relies on Disqus' Nexus admin replacement thing, which is a little heavy and a little buggy for us.
  • Waffle is the most popular if you look at downloads. the other main candidate is Gargoyle (David Cramer), which we started out with but moved away from as it relies on Disqus' Nexus admin replacement thing, which is a little heavy and a little buggy for us.
  • Waffle: A feature switch/flag/toggle application for Django

    1. 1. WaffleToby Championgithub.com/tobychFeature switches for Django
    2. 2. Feature branches are nasty• Must deploy a branch to try things out• Unlikely to run full tests on a branch• Many branches: painful and confusing• Branching inhibits refactoring
    3. 3. Feature SwitchesAllow you to include all new features on yourmaster branch, hiding them from users so youcan deploy all your code to production.
    4. 4. Now you can hide features!• Features are developed in masteralongside others• You have separate deploy and release steps• Your work need not impact users until ready• Leave branching just for spikes• Tests on master run on all features• Code is more often ready to deploy
    5. 5. Let’s use feature switches!
    6. 6. Let’s use feature switches!
    7. 7. Use your switches everywhere• Templates• JavaScript• Views• Models• Jinja2 templates (via Jingo)• Mustache/Handlebars templates• Management commands• Celery tasks
    8. 8. {% load waffle_tags %}{% switch switch_name %}Switch is active!{% else %}Switch is inactive!{% endswitch %}Django template
    9. 9. Views
    10. 10. Wrap an entire view
    11. 11. JavaScript
    12. 12. Examples
    13. 13. Switchesshow_replace_buttonShow icon for incomplete featureshow_custom_fieldsShow custom fields on the edit dialog (delete this switch!)no_fancy_tag_defaultsDisable broken JavaScript code until we fix itdebug_liveWrite extra live update debugging info to JavaScript consoleuse_reftag_kalman_filteringUse kalman filtering for reference tag barometer smoothing
    14. 14. Flags
    15. 15. Flags know about users and groups
    16. 16. Examples
    17. 17. Flagsshow_manage_rulesShow navigation item for new rule manager featureuse_selectionsUse new fancy check-box selection instead of drag’n’dropno_xmppDon’t try to contact XMPP (BOSH) server at page loadno_mapsDon’t try to load map tiles at page load
    18. 18. Query stringhttp://example.com/?dwft_my_flag=0 – Offhttp://example.com/?dwft_my_flag=1 – OnPersisted for the session using cookies.
    19. 19. Also use Waffle for• A/B testing (Waffle chooses randomly)• Canary releasing (roll out to % of users)
    20. 20. Be careful!• Even inactive code can break your product• Unit tests must cover both cases• Integration tests should cover combinations• Remove unused switches!• Harder to follow code wrapped in switches
    21. 21. Pain
    22. 22. Persistence• memcached• Redis
    23. 23. Waffle• http://coffeeonthekeyboard.com/introducing-waffle-for-django-541/• https://github.com/jsocol/django-waffle• http://waffle.readthedocs.org/Feature Switches/Flags/Bits/Toggles• http://martinfowler.com/bliki/FeatureToggle.html• http://www.pgrs.net/2011/08/29/why-i-dont-like-feature-branches/• http://blog.disqus.com/post/789540337/partial-deployment-with-feature-switches• http://arialdomartini.wordpress.com/2011/11/02/help-me-because-i-think-martin-fowler-has-a-merge-paranoia/• http://www.youtube.com/watch?v=xzstASOvqNc• http://codeascraft.com/2011/02/04/how-does-etsy-manage-development-and-operations/• http://www.infoq.com/presentations/Feature-Bits
    24. 24. Toby Champion@tobychlinkedin.com/in/tobychampiongithub.com/tobych/toby@tobychampion.com
    25. 25. Seattle Python Day 2013• Seattle Python Interest Group (SeaPIG)• Late September?• One day (Saturday)• Free or at least very cheap• Sprints on the Sunday?

    ×