#12. Always keep correctness in mind


Bertrand Meyer starts the first chapter of his book Object Oriented Software Construction, 2nd Edition with the following sentence:
Engineering seeks quality; software engineering is the production of quality software.
He goes on to analyze the concept of software quality throughout the chapter. He defines it as a combination of several factors, some external (observable by the users of the software) and other internal (observable only by those who have access to its source code).

External software quality factors are correctness, robustness, extendibility, reusability, compatibility, efficiency, portability, ease of use, functionality and timeliness. All of these are important and should be balanced one against the other. But one clearly stands out among them: correctness. Quoting [Meyer 1997] again:
Correctness is the ability of software products to perform their exact tasks, as defined by their specification.
If a software is not correct, everything else matters little. Correctness should never be compromised for other quality factors.

Since correctness is defined as relative to a specification, it cannot be evaluated without it. When you use a software, you may appreciate its qualities, you may find something which doesn't work, you may consider it a good software product overall, but you cannot formally state whether it is correct.

When you work as a programmer, it is your job to guarantee that the software is correct.

Correctness must spread through your software, and apply to all of its parts. If the architecture of a software project divides it into several layers and modules, such as the user interface, a business logic... correctness must be accordingly defined for all of them, and must be the guiding light to ensure all of them are designed appropriately.

The software requirements specification is hence not enough. It serves the purpose of defining correctness for the full software product. But when this product is divided into layers and building blocks, correctness must also be established for all those layers and building blocks. A modular design affects not only the source code, but also the specifications.

Hence a correct software product is made of correct layers or clusters, these are made of correct modules (classes, in object oriented software construction), and these are made of correct procedures. And this division must include three elements:

  • The definition of correctness.
  • The software code.
  • The verification of the code against the definition of correctness.
Always keep correctness in mind. Never leave it behind.

Bibliography

[Meyer 1997]
Bertrand Meyer: Object-Oriented Software Construction, 2nd Edition, Prentice Hall, 1997.

If you want to know more about correctness, read this book.

Comments

Popular posts from this blog

#2. Make all type conversions explicit

Welcome to The Deep Blue C++

#13. Organize your code in classes