Skip to main content

Posts

Showing posts from April, 2013

Why are you not using Design by Contract?

When learning to program I distinctly remember coming across the concept of placing asserts within your code. Assert statements are primarily used for "things that cannot happen", but in my early days I was too focused on the stuff that was supposed to happen!"Defensive programming" was also introduced. Principles such as "Never trust the user" and "80% of your code will be validation and verification" were highlighted. Despite these introductions many years ago, the concept of asserts never stuck with me. Yet I program defensively like there is no tomorrow.The use of asserts can be extended into "Design by Contract" or DBC. In DBC the developer makes use of pre-conditions, post-conditions and invariants. Some languages such as Effiel have taken DBC as a core feature while other languages leave DBC up to libraries.One of my favourite programming books is the Pragmatic Programmer. Having stood up …

3 Years at Codeweavers