Skip to content

Latest commit

 

History

History
26 lines (14 loc) · 2.72 KB

inspiration.md

File metadata and controls

26 lines (14 loc) · 2.72 KB

Inspiration, Philosophy & Attribution

hoare is named after Sir Tony Hoare (aka C. A. R. Hoare), and the Hoare triple, the cornerstone of Hoare's axiomatic method of testing computer programs (what we largely consider unit testing today).

After years of working on safety-critical and mission-critical software in healthcare, finance, and e-commerce, I have come to appreciate the importance of simple, readable, and maintainable unit tests and the profound effect they can have on design.

Good unit tests force programmers to break apart their code into smaller, more easily testable parts. Unfortunately, testing frameworks have become ever-complex to address deficiencies in design, instead of helping to address them.

Inside every large program, there is a small program trying to get out. — C. A. R. Hoare

A unit test should act as a specification for the behavior of the code that we're testing. The Hoare triple, written as {P}C{Q}, provides a way for us to specify this expected behavior. Each part is a logical statement that must be true for the test to pass: pre-condition, execution, and post-condition. The Hoare triple is an easy way to specify how a piece of code should behave, and a good unit test should clearly communicate this to the reader. I often use given, when, then in my unit tests.

A program is a specification of behavior. — C. A. R. Hoare

Not only are confusing tests not helpful in specification, they also lead to technical debt, test abandonment, or errors in the test itself.

Reliability in software—in tests and source code—is largely predicated on its simplicity and clarity in human understanding.

There are two ways of constructing a software design: one way is to make it so simple that there are obviously no deficiencies and the other is to make it so complicated that there are no obvious deficiencies. — C. A. R. Hoare

There is nothing a mere scientist can say that will stand against the flood of a hundred million dollars. But there is one quality that cannot be purchased in this way — and that is reliability. The price of reliability is the pursuit of the utmost simplicity. It is a price which the very rich find most hard to pay. — C. A. R. Hoare

Inspiration was also taken from the following: