Defensive Programming Gone Too Far, Or Respecting Your Contracts

June 30, 2015

In the last few months, I've heard this argument more than once. And whenever I have to repeat my counter-arguments, I know it is time for a blog post. So here goes, a short take on defensive programming gone too far. Suppose you have the following, extremely boring, C++ function (the language is not of any importance for this exercise): bool add_task(employee& emp, task const& t) { if (emp.task_count() > 10) return false; emp.add_task(t); return true; } And here's the argument I'm going to be fighting against until I draw my last breath: The function needs to be more...

Materials From This Year’s First SDP

June 5, 2015

Another SDP conference is behind us! It's been an incredible week of brand new technology talks, meeting customers, jogging across the Tel-Aviv beach, and also getting a pretty bad cold from the air conditioning at the conference hotel. We are already hard at work planning the next conference, but in the meantime, here are the materials from my talks this year. Elements of Modern C++ Style This talk, based on materials from our Modern C++ course, introduced four key tenets which I believe are fundamental to modern C++ code: letting the compiler help you out (with language features like auto and...
tags: ,
no comments