Readme Driven Development (2010)
tom.preston-werner.com
tom.preston-werner.com
[1] https://github.com/toml-lang/toml/blob/master/README.md#L8
This feels like a good way to combine both things!
I had a nickname for this: whishful thinking design
I find this especially useful when I'm building complete solutions from lots of other technologies -- it's easy to fall into the trap of "well my API will behave like API X because that's what I'm using under the hood". Readme driven development really encourages thinking harder and producing something that's greater than the sum of its parts.
https://rome.ro/news/2018/12/10/reflections-on-dooms-develop...
I always think of that anecdote before starting a new project.
Whoever came up with it, it's great.
Basically create a readme with example of how to use the lib with explanation.
Then I design the library to match my design.
I see lots of libraries (especially in .net) that are missing that extra something as if they weren’t designed first.
I recently was adding a couple features to an existing utility, where I made some new options (--opt3 --opt4) following the style of what was there. As I was trying to write the help I realized there were several combinations that were totally invalid, and describing the situations where each could be used was really hard. It really boiled down to only about 3 unique situations, so I replaced all those options with a single --mode switch, making it way simpler to code, document and use. Without docs first that wouldn't have been obvious until I either was partway through coding (or maybe writing validation code), or worse, got bug reports about someone trying an invalid combination and it breaking in some strange way.
It has been clarifying in some big ways, but I also feel like I wouldn't have been able to do this without an initial implementation that I and one or two others have been putting through the paces.
It's taken some time to use it in enough real-world cases that I feel like we've actually discovered a significant fraction of the features it needs.
It takes reflecting on each feature for long enough to understand if it is global or situational, to decide if it's just a change to the program, a new default you can disable, or a new optional feature you must enable. Or is it really a fellow traveller with a number of related features that signal the need for a new mode?
Finding an interface that doesn't annoy me has taken collecting the entire current feature list, the next several planned features, and some "I suspect someone will ask for this some day" sorts of things--and then stepping far enough back from them to distill a smaller number of verbs they can be grouped under.
Particularly liked this part.This nuance of not going too far in either direction is what makes the idea effective, I would think. Will keep it in mind for every future project.
And hey, writing the readme first will very likely make tdd easier, as the first few tests to write would be essentially transcripts of the readme into code.
edit: I see similar examples on the og hn thread https://news.ycombinator.com/item?id=1627342
[1] https://github.com/redwoodjs/redwood/commit/e2ceb0dcdffe4c28...
I'd been writing my project for over a year and hoping to get help, buy-in, and collaboration. Then I realized that I hadn't updated my Readme since starting out, and it was out of date, and, frankly sucked. It was not convincing, and it was the first thing that devs saw when assessing my project!
Kudos to the author.
This is probably it's own Goldilocks or yin/yang sort of thing? Sometimes I quixotically wander into implementing a project, hook myself with sunk-cost fallacy a fraction of the way to the finish line, and would have ultimately considered it a blessing to scratch the itch without touching implementation.
2018 https://news.ycombinator.com/item?id=17427593
2011 (a bit) https://news.ycombinator.com/item?id=2498868
Discussed at the time: https://news.ycombinator.com/item?id=1627246
So more specifically, I know that one strategy is to just make time to keep it up to date, but I do think there is more to it than that. One aspect was out of date code examples - referring to old line numbers or old patterns that we reconsidered. I think some of that could be automated, and it made me wish for or wonder something better.
Did the API change from the spec of the readme?
Shouldn't the readme change first, so its always the code that's out of date? :)
You also have a developer readme, right? ;-)
https://www.npmjs.com/package/spdx-expression-parse
I've released free scripts for Node.js that do the job of parsing the Markdown, extracting fenced code blocks, and filtering by infostring. That leaves just lines of code, which you can pipe straight to the Node interpreter:
You maintain a file README.jl, with a mixture of Markdown text, example code in Julia, and hidden code in Julia. Inspired by Knuth's literate programming idea, there are several things you can do with that file:
* Weave it to get README.md, with the text, the example code, and the output from running the example code.
* #include it in your tests, to run the example code, then run the hidden code to verify the results.
* Super-weave it to generate a web notebook, where people can modify the example code and see what happens.
This isn't perfect. When the examples generate graphical output, you have to write some boilerplate code to capture it as a GIF and link it in README.md. That gets annoying in a numerical language like Julia. But it's pretty good.
https://github.com/hitchdev/hitchstory
Project with README that is partially generated from the code samples in the tests:
https://github.com/crdoconnor/strictyaml
with the README template:
https://github.com/crdoconnor/strictyaml/blob/master/docs/in...
that grabs code snippets and their expected outputs from the story:
https://github.com/crdoconnor/strictyaml/blob/master/hitch/s...
Great for every other activity as well.