3 ms·
We would still need code because the "specification" and "code" have become synonymous by virtue of the specification becoming executable. It isn't possible to
by kazinator 5y ago
We would still need code because the "specification" and "code" have become synonymous by virtue of the specification becoming executable. It isn't possible to need the specification, but not need the code, when they are the same thing.
The problem is that producing a complete and correct specification is almost of the same difficulty as producing complete and correct code. And the almost part disappears when we require the specification to be executable.
Writers of non-executable specifications rely on being rescued by the code: that someone will "read between the lines" here and there when they produce the code.
There is also a very good reason for needing two specifications: the specification proper and some code written to the specification (even if the specification is executable). Because producing specifications is difficult, the redundancy helps: whenever your specification and code have a discrepancy, that could be a defect.
If specifications are executable, the implementations are severely constrained; they have to do exactly what the specification does. If the executable specification for a programming language is an interpreter for that language, then a compiled version of the language doesn't conform to the spec. It's a different spec.
- Mikhail_Edoshin 5y agoI'd argue that a specification must be a homomorphic version of the real code. A specification has fewer parts, but the relationships between the parts are same as in the code. I.e. it would be interesting to write a general specification for, say, a math typesetting algorithm and then add concrete specs that describe how that algorithm materializes in, say, different instruction sets. (I wish there were such specifications, because right now when you want to understand the general principle you have to rely on texts or dig that knowledge from the idiosyncrasies of different programming languages and individual styles.) I.e. a specification that can be shared between different programming environments. Something that captures the fundamental programming principles, not the "modern" features.