Table of Contents

1 Agile Software Development    slide

  • Iterative process
  • Short feedback loop
  • Focus on project management

2 Agile Software Development    slide

  • But it applies to actual coding as well

3 Things that lengthen the loop    slide

  • Re-running the whole process to test small changes
  • Bad editing environments: browser console, sub-par text editors
  • Recompilation & server restart
  • Page refresh (http re-request): flow disruption, complex hard-to-reproduce state (e.g. a dialog after some complicated interaction)
  • Copying code between REPL and source files. Bad editing support in most REPLs doesn't help either.
  • Searching for documentation

3.1 Notes    notes

  • Small logical changes should be testable in the REPL (e.g. point calculating logic)
  • Large changes should be made faster by fast partial recompilation

4 Directions for solution    slide

  • Do USE A REPL, PLEASE. Most languages these days have them
  • Good editing environments
  • Interpreter, live code reloading, partial in-process recompilation
  • 2-way browser-server communication
  • Try to have good copy-from-file-paste-to-repl support (most languages fail though)
  • REPL-available doc, context-aware doc, source navigation

5 Erlang    slide

  • Module-level recompilation & loading from the REPL
  • With rebar, recompiling from REPL doesn't work (at least I haven't figured out how to correctly set paths & stuff)
  • To make it bearable (still slow compared to just recompiling one changed file)
./rebar compile skip_deps=true
% In the REPL

6 PHP    slide

  • Very primitive, but usable REPL
  • New interpreter (new code) each request, thus somewhat bearable
# Normal REPL
php -a
# Yii REPL, with search path set up (i.e. can use e.g. Util::myFunc)
protected/yiic shell
$user = User::model()->findByPk(25);
$user->addPoints($points, PointRecord::TYPE_SMS_ACTIVATION, "users", $user->id, 1);

7 Python    slide

  • bpython: context-aware doc, code tryout in REPL
pip install urwid bpython
# This gives REPL + running warp site
bpython-urwid --plugin=warp
from models import *
a = store.find(Auction).order_by(
  • Whitespace-siginificant semantics can screw you up

8 Python    slide

  • Weak namespace support, partial re-evaluation is not trivial, except for module level
# HACKish in-process partial recompilation (still coarse, module-grained)
# Once
import models
# Repeatedly
from models import *
# (be careful with side-effect-ful modules (i.e. not just "def" & "class"))

9 Javascript    slide

  • Browser consoles are ok for inspecting objects, testing out logic, but suck at editing code
  • swank-js: remote browser REPL (not very stable yet)
  • Inherent problem of js: weak namespace support, partial re-evaluation is not trivial (worse than Python in that even module-level reloading is hard)

9.1 Notes    notes

; Just need to eval this chunk. The evaluated code can reference
; symbols available in the namespace

(in-ns '
(defn bid [code]
  (println (str "Bidding on " code)))

; In js, you need to add custom context switching code to be able to do
; similar thing, but that is namespace-implementation-specific (until
; namespace support is standardized)

; Note that even though Python has namespace support built-in, it's
; not easy to do this (TODO: look into Python's eval, maybe it allows
; setting up evaluation context)

10 HTML    slide

  • Client-side templates have potential to be more amenable to interactive development
  • But good client-side language and tools are needed (and js is not there yet)

11 CSS    slide

  • Refreshing the page is a time killer, especially if you need to style a dialog (or something that needs several interactions to reproduce)
  • Chrome/Firebug inspectors are nice, except when you need to test the style on multiple browsers (plus you still need to write these changes back into your files)
  • Ever try styling a tooltip (no, "Toggle Element State" doesn't help)?

12 CSS    slide

  • No refresh, instant changes on multiple browsers
  • Can be put in a vagrant for designers to use
  • But still needs a bunch of config to be usable
  • Doesn't work with HTTPS

12.1 Notes    notes

  • TODO: sync changes from 1 browser back to the server)
  • Write clients for browser remote debugging tools?

13 Clojure/Clojurescript    slide

  • Full-power REPL attached to the running process
  • Easy recompilation of a file, or a chunk of code
  • Good source browsing (1-key "Go to source")
  • Somewhat context-aware doc, available from the REPL
  • No page refresh needed
  • Namespace-scoped REPL (i.e. freely copy/paste code between REPL & source files)

14 Your tools

  • Continuous tool improvement: Emacs, Conkeror. Fix the bumps as you encounter them, and feel the improvements right away.

15 Some random notes    slide

  • Trying out short functions or pieces of logic in the REPL is faster than a page refresh. This is one of the reason functional code helps reduce "brain down time"
  • Pervasive mutability doesn't fit interactive development because it increases the possibility that the behavior during interactive development and a fresh behavior are different

16 Some random notes    slide

  • Absolutely private accessibility doesn't fit interactive development very well, because the changes needed will be more coarse-grained
  • Node is good for writing dev tools, where we don't need that much reliability or performance, and quick-n-dirty hacks are sorta welcomed

16.1 Notes    notes

  • It's better to have internals accessible, but it's obvious when they are accessed (naming convention, reflection (or just separate) API, scope changing by namespace switching)

Date: 2012-09-19T17:46+0700

Author: Nguyễn Tuấn Anh

Org version 7.9.1 with Emacs version 23

Validate XHTML 1.0