In the humorous lexicon The computer contradictionary, we find this definition:
Interface: An arbitrary line of demarcation set up in order to apportion the blame for malfunctions. | ||
-- Stan Kelly-Bootle, The Computer Contradictionary, MIT Press, 2nd Ed., 1995, ISBN 978-0262611121. |
Interfaces occur at two levels in a software design.
The user interface is the external surface of the product. It defines how the product interacts with the rest of the world.
Assuming the kind of modular design that has been standard practice in the software world for many decades, every connection between two parts of a program is also an interface.
Every interface is, in effect, a contract that divides responsibility between the provider of a service and the user of that service.
In effect, this contract says:
If the user agrees to certain requirements, the service guarantees to function correctly.
To apply this approach to software construction, for each interface, we must describe the interface, and the semantics of the provided service, in a sufficiently rigorous way that both are unambiguously defined.
Our ideal here is scrutable connectivity to first principles.
By scrutable, we mean that the design must be clearly presented. A design that is not well-documented, or one that contains more complexity than is necessary, becomes inscrutable.
Scrutability is especially important in critical applications, such as railroad signaling and the administration of medical radiation. Where lives are involved, the code must stand up under external scrutiny. The lone wolf programmer, the one person who knows how the code works, is unacceptable.
...programs must be written for people to read, and only incidentally for machines to execute. | ||
-- Harold Abelson and Gerald Sussman, Structure and interpretation of computer programs, MIT Press, 1996, p. xvii, ISBN 0-262-01153-0. |
The first principles to which we connect a program must be mathematical: we must be able to reason about program correctness in a mathematical way.
This method isn't for novice programmers. Novices are inclined to treat the formal methods as “unnecessary extra work.” It is necessary to have a certain minimal amount of experience with real-world software, tools that must survive ignorant or malicious users, to understand that getting the design right in the first place really is the shortest path to a robust solution.
The methods require a reasonable familiarity with discrete math. Here's the catalog description of Math 221 at New Mexico Tech, Formal Logic and Discrete Mathematics, which is a prerequisite for the Zero-defect Software Design course:
Analytical reasoning and critical thinking skills. Induction and recursion. Mathematical proofs. Propositional calculus and predicate calculus. Discrete and combinatorial mathematics: sets, functions, relations, trees, graphs, permutations, and combinations.
Clear, concise writing is central to the design process. The author starts each new design by writing a draft specification. However, the coding process is no less a writing task, and requires careful work in naming and describing algorithms and data structures at every step of the way.
Besides a mathematical inclination, an exceptionally good mastery of one's native tongue is the most vital asset of a competent programmer. | ||
-- Edsger J. Dijkstra, Selected writings on computing: a personal perspective, Springer-Verlag, 1982, pp. 129-131, ISBN 0-387-90652-5. |