F5.03 · part 1 of 3
Tracer bullets vs prototypes
Both techniques start the same way — build something small and fast — but they have opposite fates, and confusing them is expensive. A tracer bullet is thin but real production code that travels the whole system; you fire it, watch where it lands, and adjust, then keep it and build the next path on top. A prototype is throwaway code written to answer one question — will this library do the job, is this shape right — and once the question is answered it is deleted. The mistake to avoid is shipping a prototype, or lavishing polish on what should have been thrown away.
Same fast start, opposite ending. Select one to see what it is for and what becomes of the code.
Same start, opposite fate
The question to ask before writing either is: am I building part of the system, or learning something about it? If the code will carry real traffic and be extended, it is a tracer bullet and it must be real, however thin. If it exists only to teach you and will not survive, it is a prototype and polishing it is waste. Select each to compare.
Two techniques · select one
technique: Tracer bullet
the code is: kept & built upon
Decide the fate before you write the code. A tracer bullet earns its keep by being real; a prototype earns its keep by being deleted.
In code
The enroll route is a tracer bullet: thin, but it really calls the context and really responds, and it stays. A prototype answering “what does the incoming payload look like” is a few lines run once and then removed — it never ships.
# tracer bullet — real, thin, KEPT: the actual enroll path through the system post "/enroll" do {:ok, enrollment} = Portal.Learning.enroll(conn.params["user"], conn.params["course"]) send_resp(conn, 201, enrollment.id) end # prototype — throwaway: answers "what shape is the payload?", then DELETED "sample.json" |> File.read!() |> Jason.decode!() |> IO.inspect()
am I building or learning?
Building the system → tracer bullet, real. Learning something → prototype, throwaway.
the enroll path
Thin but real, and kept — the first tracer bullet, which the skeleton is built from.
Next: the walking skeleton — the tracer bullet, driven end to end through every layer.
References
Primary sources for this lesson, and where it connects in the course.
Sources
- Hunt and Thomas — The Pragmatic Programmer — tracer bullets: build end-to-end before exhaustive.
- Elixir — Introduction to Mix — scaffold the thin, running skeleton app.