A sufficiently detailed design document is essentially indistinguishable from code. How do you avoid the problems you encounter when writing code while writing the design document?
I agree that sufficiently detailed design documents are indispensable from code and should be avoided. However, clearly documenting the why, what and how of your work helps align everyone clearly. It also helps an individual clarify their ideas to themselves. It is hard to write clearly & succinctly. It takes time & practice, but I find it essential.
For example, at some point I knew I wanted to set localStorage and cookies values just like this:
cookie.token = '1234';
local.token = '1234';
I know enough Javascript, and the language is flexible enough, that I know that I could achieve that, either with getter/setters or with the more flexible Proxy(). So I continued writing the other methods first; how would it look ideally to "read" a value? To "delete" a value? Etc: console.log(cookie.token);
delete cookie.token;
// ...
I wrote few examples of each, put it all in some documentation, and then wrote some tests, following those documentation examples: expect(cookie.token).toBe(null);
cookie.token = '1234';
expect(cookie.token).toBe('1234');
And finally wrote the code for it. Later I wanted to add IndexedDB, BUT! That is async! My abstraction was broken, or was it? I could just modify a single method and everything else would work as expected: db.token = '1234';
console.log(await db.token); // <= added await here
delete db.token;I think the design phase in this instance required far too much detail. Some middle ground would probably be best imo.
* Shape Up - https://basecamp.com/shapeup
Stealing this one. What a great quote!