TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Documentation Driven Development (2022)

73 pointsby yarapavan11 months ago

21 comments

diffxx11 months ago
Writing documentation up front is a good idea, but only if one treats it as the first iteration of the program with the expectation that the initial documentation may well be thrown out. The process of writing the documentation no doubt will help you organize the plan for writing the code. But there will also be things that the documentation does not capture or problems it does not foresee that emerge as the program is being written.<p>The danger is that either you fail to update the documentation to account for the changes in the system that emerge in development or you only update parts of the documentation as you go which causes the documentation to become inconsistent and unreliable.<p>A middle ground is write the documentation up front and then rewrite it after the system is done. The initial draft helps guide the design and the final version captures the full and complete essence of the finished program, which is nearly impossible to do up front.
评论 #40804617 未加载
评论 #40803918 未加载
评论 #40805411 未加载
评论 #40804190 未加载
评论 #40804981 未加载
dimal11 months ago
I think that the usefulness of any “X driven development” methodology is so highly variable based on the particular problem being solved and the particular brain solving it, that it’s impossible to make any general recommendation for anything. Like everything else in programming, it depends. Documentation driven development might be great for one person, but for another person it could be a tedious waste of time. Everyone should feel free to find their own way. If it works for you, good. If not, let other people do what works for them.
评论 #40808350 未加载
liampulles11 months ago
I think a lot of XYZ Driven Development advice can basically be boiled down to: write down some kind of plan before you start coding.<p>Certainly one should think about the design before implementing, but I think writing acts to force active reflection on the design - be it a plan, or documentation, or a test.<p>At this point my approach is to plan out my current ticket into TODOs before I make a branch. I do this in phases until I get down to the level of what functions need to be modified&#x2F;made. If I know there is a function that is going to be doing a bunch of branching or is otherwise complex, then I know it will need a good bit of unit testing, and I might opt for TDD - though its rare. I&#x27;m used enough to planning my tickets now that it is usually sufficient to get to a good design.<p>I would recommend trying to do some sort of planning of your work. It can be hard and time consuming it first but it can be a superpower if you get into the habit of it.
评论 #40804263 未加载
kaycebasques11 months ago
We are trying out some DDD for an upcoming pigweed.dev tutorial. I&#x27;m docs lead for the site and I&#x27;m working with 5 or so engineers. It&#x27;s going decently. As a technical writer, it&#x27;s hard to flesh out exact content until the features are built out. Especially in a tutorial, where each section builds off the ones that came before it. So we have a lot of placeholders in the tutorial. All-in-all I think it&#x27;s been fairly helpful for me to repeatedly say: &quot;This will be our main artifact. This is where people will learn of your features. Please make sure your work and features are captured in this document, otherwise they kinda don&#x27;t exist (because this doc is where people will most likely learn of the new features).&quot; I don&#x27;t ask them to fully flesh out docs themselves; I&#x27;m just asking them to dump notes into the draft doc and insert commands&#x2F;code as things become fleshed out. I think it&#x27;s also a useful focusing exercise for the team - there&#x27;s so much we could work on but if it&#x27;s not going into our primary documentation artifact and it&#x27;s not foundational work that is prerequisite to what we want to show in the tutorial then that sometimes makes it easier to decide that the thing is lower priority. There was also an interesting feedback cycle where the team worked on some really important stuff that is usually kinda &quot;behind-the-scenes&quot; and low-level, and we asked ourselves &quot;we have to work this into the doc and make people aware of it... how do we do that?&quot;
bunderbunder11 months ago
For designing APIs, my favorite approach is a hybrid of the two. I&#x27;m not sure if there&#x27;s an official name, but I&#x27;ve taken to calling them walking skeleton tests.<p>The gist is that you start by writing example client code demonstrating small but useful interactions with the API, including explanatory comments. They won&#x27;t work yet, because the API hasn&#x27;t been implemented. But you&#x27;re already in a position to talk them over with your team and start thinking about user experience issues. And they give you a nucleus around which you can start building high-quality user documentation.<p><i>And</i> they&#x27;re your automated end-to-end acceptance tests.<p>Once things look good (not perfect), then you can start implementing the API. For this portion I don&#x27;t necessarily do TDD, because I remain unconvinced that writing unit tests first is inherently better than writing unit tests afterward. But I might. Depends on my mood. But I do keep running the walking skeleton tests, which serve as my primary feedback mechanism for evaluating implementation progress and success.<p>The more important thing is that I can start stepping through those walking scenario tests and seeing how well the interaction actually works in practice. And I can use those observations to help inform an ongoing conversation about the API&#x27;s design and functionality. I can also get quick feedback on whether some aspect of the high-level design isn&#x27;t going to work as well as we had hoped. Ongoing updates to the design are memorialized and communicated by updating the walking skeleton tests.
评论 #40803480 未加载
评论 #40802777 未加载
alganet11 months ago
This discussion reminds me of literate programming. An old idea for a more civilized age.<p>It also reminds me of clitest[1] (very similar name to the author&#x27;s lib, but it is another thing).<p>You can write examples with prose in markdown, then let clitest verify them for you as if they were tests. Best of both worlds.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;aureliojargas&#x2F;clitest">https:&#x2F;&#x2F;github.com&#x2F;aureliojargas&#x2F;clitest</a>
CharlieDigital11 months ago
This is actually how software and systems engineering works in life sciences.<p>There are a set of artifacts which are designated the validation artifacts which includes a user requirements specification, functional design specification, technical design specification, and configuration specification.<p>Before any release, the team will start by identifying which of these documents need to be updated and which sections need to be updated. This is codified in a formal, signed document.<p>Then work starts and an updated version of each of the document is created. Prior to releasing the software, the validation process kicks in and basically verifies the correctness of each of those documents in reverse order: the configuration specification -&gt; installation qualification, the functional design specification -&gt; operational qualification, the user requirements specification -&gt; performance qualification (there is no explicit qualification of the technical design). The qualification phase has a mountain of evidence of testing.<p>The result of this rigor is: 1) the products tend to have very low defect rates because every change is accounted for, 2) the release cycle can be as long as the build cycle, 3) it&#x27;s very hard to fix bugs &quot;on the fly&quot; as these then need to be documented as a deviation and accounted for, 4) anything that breaks is easily accounted for, 5) it&#x27;s very, very hard for startups to succeed in this space because of how much rigor is required.<p>I initially hated it because I wanted to move fast. But after leading a few release cycles, I could see a lot of the benefits as we rarely &quot;built the wrong thing&quot;, we rarely had major defects, and work-life balance was generally pretty good because every release cycle was <i>meticulously scoped</i> since we had to start by describing the planned changes starting from the documentation. There is less scope creep once work on the release starts since the start of the release has already identified what will change and adding scope means adding more paperwork after the fact.
adolph11 months ago
The author seems to conflate several different types of documentation, like requirements, code comments, and api explanations. Additionally TDD isn’t intended to work in the absence of any documentation, the concept is that a test models the requirements.<p>Maybe a paradigm to consider more is:<p><i>Literate programming (LP) tools are used to obtain two representations from a source file: one understandable by a compiler or interpreter, the &quot;tangled&quot; code, and another for viewing as formatted documentation, which is said to be &quot;woven&quot; from the literate source.</i><p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Literate_programming" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Literate_programming</a>
onel11 months ago
I honestly believe documentation is more important than tests in some cases. The time spent by a dev every time to understand why a method was created that way adds up quickly. The what is more evident from the code.<p>The idea of writing documentation before the code is interesting, it&#x27;s thinking out loud
评论 #40802118 未加载
评论 #40801660 未加载
评论 #40801851 未加载
p-o11 months ago
I really love this idea in theory, and I believe that for some system, specially mature ones, it may work well. I see good documentation as a super power; it empowers readers and motivate people to understand more about the system without being caught in the weeds of reading the source.<p>The source has baggages, and the intent of every single function calls is not always evident. Writing documentation up-front can help direct the source, but this is a tug-of-war environment. Each affect the other in its own ways.<p>And for that reason, documentation driven development can be a real drag. You start writing documentation with the best intentions, everything works great for this first release. But 2 months down the road you need to modify something and it has a ripple effect on many of the things you documented. It&#x27;s a non-negligible cost.<p>I&#x27;ve been working on this open-source tool(<a href="https:&#x2F;&#x2F;github.com&#x2F;pier-oliviert&#x2F;sequencer">https:&#x2F;&#x2F;github.com&#x2F;pier-oliviert&#x2F;sequencer</a>) and I&#x27;ve spent a lot of time on the documentation. And what I described above happened. I wanted to make a not-too-big change, and it required me to rewrite 30% of the documentation. I still love the documentation aspect of it, but it definitively has a higher cost than tests, in my experience.
评论 #40802358 未加载
评论 #40802681 未加载
javier_e0611 months ago
I have lived through all:<p>Rational Rose UML RequistePro. Doors. Just plain prototype something through many iterations until is good then document. Doxygen<p>All of the above except the prototyping a waste of resources more or less.<p>If I had my software shop (which I don&#x27;t) I would expect a software module to come with a README.md Which a brief explanation of what is is and no more than 3 step instruction for a reader to see the software module running and doing something useful.
评论 #40802794 未加载
评论 #40803328 未加载
bordercases11 months ago
Many of these arguements are moot – because for any top-down function definition technique, the How to Design Programs recipe covers virtually all the bases.<p>- <a href="https:&#x2F;&#x2F;course.ccs.neu.edu&#x2F;cs2500f18&#x2F;design_recipe.html" rel="nofollow">https:&#x2F;&#x2F;course.ccs.neu.edu&#x2F;cs2500f18&#x2F;design_recipe.html</a> - <a href="https:&#x2F;&#x2F;cs110.students.cs.ubc.ca&#x2F;reference&#x2F;design-recipes.html#HtDF" rel="nofollow">https:&#x2F;&#x2F;cs110.students.cs.ubc.ca&#x2F;reference&#x2F;design-recipes.ht...</a> - <a href="https:&#x2F;&#x2F;docs.racket-lang.org&#x2F;htdf&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;docs.racket-lang.org&#x2F;htdf&#x2F;index.html</a><p>Between a signature, purpose statement and examples, you&#x27;ve declared most of what documentation provides short of a longer contextual statement of the functions role in a codebase.<p>For larger modules there is How to Design Worlds.<p>- <a href="https:&#x2F;&#x2F;world.cs.brown.edu&#x2F;1&#x2F;htdw-v1.pdf" rel="nofollow">https:&#x2F;&#x2F;world.cs.brown.edu&#x2F;1&#x2F;htdw-v1.pdf</a>
评论 #40801927 未加载
gxt11 months ago
Few can afford not to follow the basic (DO --&gt; SECURE --&gt; DOCUMENT --&gt; ANNOUNCE) workflow. Working in any other order and you end up having to redo some if not most of the previous steps for whatever you where enterprising.
euroderf11 months ago
So why can&#x27;t I use documentation as a requirements spec and just feed it to a LLM for implementation ? With lots of examples in the documentation that can serve as test cases for the generated code.
评论 #40804215 未加载
评论 #40804804 未加载
fungiblecog11 months ago
Except for trivial examples, all real development needs to be undertaken iteratively. Design a bit, build a bit, rework both based on what you found out. Unfortunately most people - and definitely most organisations - don&#x27;t want to rework anything as it sounds like a waste of time&#x2F;money rather than an essential step to take working code and turn it into production code. So instead they look for silver bullets. &quot;If you just do the steps in this order...&quot;
smokel11 months ago
Writing out a design before starting to code is often helpful, especially when working in teams.<p>A high-level design is best not written in code, but in a separate document. Writing documentation in tickets is just plain silly, IMNSHO.<p>Writing design documentation used to be commonplace. If it helps to put a name on this, then that&#x27;s great.
gmd6311 months ago
Everything is already natural language driven development, but management&#x2F;execs often like to avoid accountability by prompting their human LLMs verbally off record.
haolez11 months ago
That&#x27;s mostly how Knuth codes (with a flavor twist in the form of literate programming). It&#x27;s a huge endorsement of the idea presented in the article :)
lowkey11 months ago
I might be missing something, but in my experience as a product manager, we would refer to these as requirements.
wesselbindt11 months ago
&gt; Making sure tests pass can be challenging to handle with the unknowns of implementation detail. After all, if you expect parseInt to act one way and it behaves another, you will likely have to rewrite all tests that worked off that assumption.<p>Isn&#x27;t this kind of the point of TDD? TDD makes it harder to write tests based on assumptions about implementation details, making it less likely that you&#x27;ll make such assumptions. You end up with less <i>unnecessary</i> coupling between your tests and the implementation details of the code they test, which means fewer false failures (tests that fail because the structure changes, rather than the behavior), and a more robust test suite.
siddhantx011 months ago
bullshit