Here’s a thought on how to code to spec:
Write a clear, concise design document for your application that can be understood by users and domain experts. Use brief, simple language as much as possible with some preferred constructs.
Then write code that makes the design document run.
Seriously – why not? It seems to me code should be more about language constructs, building powerful syntax for expressing functionality. So why not build up the syntax that makes a design document into a program?
I was thinking about the old LOGO functional language from Seymour Papert, the one with turtles that you could teach to do things ‘to square: forward 10, turn 90, forward 10…’ then ’square, forward 10, square, …’ etc. The logical conclusion seems like it should bring us closer to bridging the gap between language and code, or at least lead to more libraries of syntactical constructs. OO is fine for nouns but it doesn’t lend itself well to creating new verbs, let alone sentence structures.
Ah well – back to implementing my HLD manually…