In Readme Driven Development, Tom Preston-Werner advocates writing the README file before any code is written, and indeed, before any tests are written.
I couldn’t agree more. This is exactly what I did with Formtastic. I designed the DSL and how I thought programmers should build forms long before I wrote any code.
I think this has had a huge impact on the success of Formtastic so far. People may dislike the underlying mark-up choices I made, or the underlying code implementation (which definitely needs some TLC), or the lack of in-depth documentation, but for the most part, people love the DSL.
José Valim even proudly choose to replicate the Formtastic DSL in simple_form his own form builder for Plataformatec.
What Tom is really advocating is a small amount of up front design to figure out how people will use your software in order to give it vision and clarity before you start pumping out code. A README file is cheap. Code is relatively expensive.
Here’s a quote from 37 Signals’ Interface First in Getting Real:
We start with the interface so we can see how the app looks and feels from the beginning. It’s constantly being revised throughout the process. Does it make sense? Is it easy to use? Does it solve the problem at hand? These are questions you can only truly answer when you’re dealing with real screens. Designing first keeps you flexible and gets you to those answers sooner in the process rather than later.
It’s ridiculously easy to draw comparisons here. Design your library’s interface first!