- Democrats and the Reality of the Political Mind
- Open Source and the Argument for Opening the Debates
- Social Networks VS Social Networking
- Jon Stewart at his best
- The Palin Surprise
- What Is Google Hiding With Chrome?
- IE6 DeathMarch
- Web Apps as Desktop Apps; Prism, Web-Runner & Fluid.app
- Comparison of Virtual Machines for Mac OS X; VMware, VirtualBox, Parallels, Q
- Drupal 7 - The New Database Layer
Guarded Conditionals and dgries
I was responding to a Drupal issue this morning, that involved using a = or a >= when I flashed back to my college professor teaching about guarded loops.
A quick google, and I found reference to his 1981 book, "The Science of Programming" whose synopsis says "This is the very first book to discuss the theory and principles of
computer programming on the basis of the idea that a proof of
correctness and a program should be developed hand in hand."
Why do I write about this?
First to say, that conditional expressions, especially ones that guard loops, should be made as expansive as possible, the reason being, we don't want infinite loops. For example, if you can check for = 1 or != 0, it's better to check for != 0. Even if you think your data only stores 0 or 1, If the data type can technically hold something other than 0 or 1 (i.e., any php variable or any mysql int column), it's better to use the second conditional, just in case (a) a bug stores a different value, or (b) you don't undererstand the code well enough.
Second, I couldn't remember my professor's name. For a moment, I though it was "Dr. Dries". Dries Buytaert is the Founder of the Drupal project. He goes by "dries". He's a quiet, well thought, well spoken leader of the project.
My professor's name is "David Gries", and when I searched for him, I found "dgries". Two different people. Two different names. But the names are similar. "dries" and "dgries".
Here's David Gries's bio. Here's Dries Buytaert's resume, no bio yet, but I have no doubt that one will be written some day. They both have wikipedia articles here and here.
Sadly, there's no wikipedia article on me, sigh... Anyone care to start one!?
- doug's blog
- Login or register to post comments
- Delicious
- Digg
- Technorati





