Winning the Erlang Edit•Build•Test Cycle
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Winning the Erlang Edit•Build•Test Cycle

  • 5,056 views
Uploaded on

Having a fast, low-friction Edit/Build/Test cycle is one of the best and easiest ways to increase developer productivity across an organization....

Having a fast, low-friction Edit/Build/Test cycle is one of the best and easiest ways to increase developer productivity across an organization.

This breadth-first tour covers some of the tools we use at Basho to speed up and streamline the Edit/Build/Test cycle for our Erlang projects.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
5,056
On Slideshare
3,770
From Embeds
1,286
Number of Embeds
8

Actions

Shares
Downloads
51
Comments
1
Likes
11

Embeds 1,286

http://blog.rusty.io 1,248
http://feeds.feedburner.com 13
http://posterous.com 12
http://www.newsblur.com 4
http://a0.twimg.com 3
https://twitter.com 3
http://paper.li 2
http://feedproxy.google.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • \n
  • \n
  • Of course, this is a simplified few, doesn’t mention anything about level of focus, or whether the developer is working on the *right* things. \n\nOr, maybe we can assume that that’s covered under “Intelligence” and “Knowledge”\n
  • \n
  • \n
  • \n
  • \n
  • Waste Less Time - Don’t spend as long staring at screen, twiddling thumbs.\nShorter Iterations - Get feedback more often, make sure we are on the right track\nMaintain Focus - A byproduct of thumb twiddling is that you get distracted and start reading blogs.\n\nLeverage Points - Automation. Find ways to do a lot with a little. This leads to a feeling of traction, excitement, longer focus, and more productivity.\n\nConsistency - Repeatable process is faster than starting from scratch. Remove the temptation to fiddle with tools each time we start a new project.\nEasy Onboarding - Others can join in without having to relearn the system.\n
  • Waste Less Time - Don’t spend as long staring at screen, twiddling thumbs.\nShorter Iterations - Get feedback more often, make sure we are on the right track\nMaintain Focus - A byproduct of thumb twiddling is that you get distracted and start reading blogs.\n\nLeverage Points - Automation. Find ways to do a lot with a little. This leads to a feeling of traction, excitement, longer focus, and more productivity.\n\nConsistency - Repeatable process is faster than starting from scratch. Remove the temptation to fiddle with tools each time we start a new project.\nEasy Onboarding - Others can join in without having to relearn the system.\n
  • Waste Less Time - Don’t spend as long staring at screen, twiddling thumbs.\nShorter Iterations - Get feedback more often, make sure we are on the right track\nMaintain Focus - A byproduct of thumb twiddling is that you get distracted and start reading blogs.\n\nLeverage Points - Automation. Find ways to do a lot with a little. This leads to a feeling of traction, excitement, longer focus, and more productivity.\n\nConsistency - Repeatable process is faster than starting from scratch. Remove the temptation to fiddle with tools each time we start a new project.\nEasy Onboarding - Others can join in without having to relearn the system.\n
  • Waste Less Time - Don’t spend as long staring at screen, twiddling thumbs.\nShorter Iterations - Get feedback more often, make sure we are on the right track\nMaintain Focus - A byproduct of thumb twiddling is that you get distracted and start reading blogs.\n\nLeverage Points - Automation. Find ways to do a lot with a little. This leads to a feeling of traction, excitement, longer focus, and more productivity.\n\nConsistency - Repeatable process is faster than starting from scratch. Remove the temptation to fiddle with tools each time we start a new project.\nEasy Onboarding - Others can join in without having to relearn the system.\n
  • Waste Less Time - Don’t spend as long staring at screen, twiddling thumbs.\nShorter Iterations - Get feedback more often, make sure we are on the right track\nMaintain Focus - A byproduct of thumb twiddling is that you get distracted and start reading blogs.\n\nLeverage Points - Automation. Find ways to do a lot with a little. This leads to a feeling of traction, excitement, longer focus, and more productivity.\n\nConsistency - Repeatable process is faster than starting from scratch. Remove the temptation to fiddle with tools each time we start a new project.\nEasy Onboarding - Others can join in without having to relearn the system.\n
  • Waste Less Time - Don’t spend as long staring at screen, twiddling thumbs.\nShorter Iterations - Get feedback more often, make sure we are on the right track\nMaintain Focus - A byproduct of thumb twiddling is that you get distracted and start reading blogs.\n\nLeverage Points - Automation. Find ways to do a lot with a little. This leads to a feeling of traction, excitement, longer focus, and more productivity.\n\nConsistency - Repeatable process is faster than starting from scratch. Remove the temptation to fiddle with tools each time we start a new project.\nEasy Onboarding - Others can join in without having to relearn the system.\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Transcript

  • 1. Winning theEdit•Build•Test Cycle Rusty Klophaus • @rustyio Basho Technologies
  • 2. The Edit•Build•Test Cycle determines how quickly you can see the results of new code in your application.
  • 3. Developer Productivity How much progress can a developer make on a problem in some interval of time. Intelligence X Knowledge / Experience X Typing Speed X Edit•Build•Test Cycle = Developer Productivity (Simplified) 3
  • 4. Developer Productivity How much progress can a developer make on a problem in some interval of time. Intelligence XKnowledge / Experience X Typing Speed X Edit•Build•Test Cycle =Developer Productivity (Simplified) 4
  • 5. Developer Productivity How much progress can a developer make on a problem in some interval of time. Intelligence XKnowledge / Experience X Typing Speed X Easy to improve Edit•Build•Test Cycle =Developer Productivity (Simplified) 4
  • 6. Developer Productivity How much progress can a developer make on a problem in some interval of time. Intelligence XKnowledge / Experience X Typing Speed X Easy to improve Edit•Build•Test Cycle Transferrable to other projects =Developer Productivity (Simplified) 4
  • 7. Developer Productivity How much progress can a developer make on a problem in some interval of time. Intelligence XKnowledge / Experience X Typing Speed X Easy to improve Edit•Build•Test Cycle Transferrable to other projects =Developer Productivity Transferrable to other people (Simplified) 4
  • 8. How do we “win” it? 5
  • 9. How do we win it?SPEEDPOWERCONSISTENCY 6
  • 10. How do we win it? Waste Less TimeSPEEDPOWERCONSISTENCY 6
  • 11. How do we win it? Waste Less TimeSPEED Shorter IterationsPOWERCONSISTENCY 6
  • 12. How do we win it? Waste Less TimeSPEED Shorter Iterations Maintain FocusPOWERCONSISTENCY 6
  • 13. How do we win it? Waste Less TimeSPEED Shorter Iterations Maintain FocusPOWER Find Points of LeverageCONSISTENCY 6
  • 14. How do we win it? Waste Less TimeSPEED Shorter Iterations Maintain FocusPOWER Find Points of Leverage Avoid Re-inventionCONSISTENCY 6
  • 15. How do we win it? Waste Less TimeSPEED Shorter Iterations Maintain FocusPOWER Find Points of Leverage Avoid Re-inventionCONSISTENCY Easy Onboarding 6
  • 16. Edit•Build•Test 7
  • 17. Tip 1: Navigating a ProjectTool • PeepOpen (Mac only, not free) • Works with BBEdit, Coda, Emacs, MacVim, TextMate, XCode • http://peepcode.com/products/peepopenWhat It Does • Find and open files quickly 8
  • 18. Tip 1: Navigating a Project 9
  • 19. Tip 2: Erlang DocumentationTool • ErlDocs.comWhat It Does • Searchable Erlang documentation • Offline version 10
  • 20. Tip 2: Erlang Documentation 11
  • 21. Edit•Build•Test 12
  • 22. Tip 3: Manage Erlang VersionsTool • Kerl - Erlang Version Manager • https://github.com/spawngrid/kerlWhat It Does • Manage multiple Erlang installations • rbenv / rvm / nvm for Erlang 13
  • 23. Tip 3: Manage Erlang Versions# Install kerl utility...curl -O https://raw.github.com/spawngrid/kerl/master/kerlchmod 755 kerlsudo mv kerl /usr/local/bin# Build and install the R14B03 release...kerl build R14B03 r14b03kerl install r14b03 /opt/erlang/r14b03# Activate a release. /opt/erlang/r14b03/activate 14
  • 24. Tip 4: Simplify Your MakefileTool • Rebar - Simple-yet-sophisticated build tool • https://github.com/basho/rebarWhat It Does • Simplify our Makefile • Will build *anything* if you follow OTP conventions • Fetch project dependencies • And more... 15
  • 25. Tip 4: Simplify Your Makefile# Rebar simplifies your Makefile.# (NOTE: Include rebar in your repo.)all: deps compilecompile: ./rebar get-deps compileclean: ./rebar cleanrel: ./rebar generate 16
  • 26. Dependencies%% FILE: rebar.config{sub_dirs, ["rel", "deps/myproject"]}.{deps, [ {webmachine, "1.9.0", { git, "git://github.com/basho/webmachine", {tag, "1.9.0"} }}]}. 17
  • 27. Tip 4: Simplify Your Makefile$ make./rebar get-deps compile==> rel (get-deps)==> myproject (get-deps)==> MyProject (get-deps)Pulling webmachine from {git,"git://github.com/basho/webmachine", {tag,"1.9.0"}}Cloning into webmachine...==> webmachine (get-deps)Pulling mochiweb from {git,"git://github.com/mochi/mochiweb",{tag,"1.5.1"}}Cloning into mochiweb...==> mochiweb (get-deps)==> mochiweb (compile)Compiled src/mochiweb_sup.erl...snip...==> webmachine (compile)Compiled src/webmachine_util.erl...snip...==> rel (compile)==> MyProject (compile)Compiled src/myproject_app.erlCompiled src/myproject_sup.erl
  • 28. Tip 5: Stay in the Zone 19
  • 29. Tip 5: Stay in the Zone Doesn’t realize his code finished compiling... 19
  • 30. Tip 5: Stay in the Zone Doesn’t realize his code finished compiling... 20 minutes ago. 19
  • 31. Tip 5: Stay in the Zone# Get alerted when `make` is finished.# Drop this in your .bashrcfunction make { /usr/bin/make "$@" say "Finished make $1"} 20
  • 32. Tip 5: Stay in the Zone# Get alerted when `make` is finished.# Drop this in your .bashrcfunction make { START=$SECONDS /usr/bin/make "$@" ELAPSED=`echo $SECONDS - $START | bc` growlnotify -n "make" "Finished make $1!" -m "Took $ELAPSED seconds."} 21
  • 33. Tip 6: Avoid VM RestartsTool • Mochiweb ReloaderWhat It Does • Automatically reload new beams 22
  • 34. Tip 6: Avoid VM Restarts$ erl -pa deps/*/ebinEshell V5.8.4 (abort with ^G)1> % Start the reloader.1> reloader:start().2> % Ensure mymodule is loaded2> code:ensure_loaded(mymodule).3> % Edit and compile mymodule.erl3> % and Mochiweb reloader will reload it.Reloading myproject_sup ... ok. 23
  • 35. Tip 7: Avoid the ShellTool • Sync • https://github.com/rustyio/SyncWhat It Does • Automatically recompile new code • Automatically reload new beams • Growl (or notify) the results 24
  • 36. Tip 7: Avoid the Shell%% Pull http://github.com/rustyio/Sync into%% ERL_LIBS path and compile.%% Then, start sync within your project.%% Make sure erl is started with `-mode interactive`,%% not `-mode embedded`.sync:go().Starting Sync (Automatic Code Compiler / Reloader)Scanning source files...ok=INFO REPORT==== 10-Oct-2011::10:37:58 ===/Users/rusty/Documents/Code/MyProject/src/myproject_sup.erl:0: Recompiled.=INFO REPORT==== 10-Oct-2011::10:37:58 ===myproject_sup: Reloaded! (Beam changed.) 25Reloading myproject_sup ... ok.
  • 37. Tip 7: Avoid the ShellGrowl Notifications Success! Warning! Error! 26
  • 38. Edit•Build•Test 27
  • 39. Tip 8: Unit Testing + CoverageTool • Rebar + EUnit + CoverGoals • Run tests for all dependencies • Run tests for a specific dependency • Run tests for a specific module • Include a coverage report 28
  • 40. Tip 8: Unit Testing + Coverage./rebar eunit app=mochiweb suite=mochijson2==> mochiweb (eunit)======================== EUnit========================module mochijson2 mochijson2: decode_test...[0.001 s] ok ...snip... [done in 0.044 s]======================================================= All 14 tests passed.Cover analysis: /Users/rusty/Documents/Code/MyProject/deps/mochiweb/.eunit/index.html==> webmachine (eunit)==> rel (eunit)==> myproject (eunit) 29==> MyProject (eunit)
  • 41. Tip 8: Unit Testing + Coverage 30
  • 42. In Closing... 31
  • 43. Think about your workflow. Fix the rough edges. You’re worth it.
  • 44. Thanks!Rusty Klophaus • @rustyio Basho Technologies