Monthly Archives: January 2016

The best lesson I learnt from Steve McConnell

CodeCompleteI was made aware of the book Code Complete by Steve McConnell almost by accident. I was attending an Oracle presentation back in 2001 and the presenter, Steven Feuerstein mentioned the book. I can’t remember what context it was mentioned in but I remembered I had to get a copy.

Reading the first edition of Code Complete became a series of wow moments. As a self taught programmer each chapter heralded a new revelation. I say proudly that this one book has had the biggest positive impact in my professional life as a programmer.

It is therefore very difficult to pick the best lesson I learnt from Steve McConnell. It finally came down to a choice of two; Valid Reasons to Create a Routine and the chapter on Debugging.

In the end I decided that it was Valid Reasons to Create a Routine. I won’t reveal the most important reason here but the answer will surprise you. It’s not to avoid duplicate code BTW.

If you want to know the answer I recommend you buy the book, I already know you will not regret it.

PL/SQL FizzBuzz

One of the popular exercises when learning a new language is to develop a FizzBuzz program.

This is where you print out the all the numbers from 1 to 100 except if a number is a multiple of 3 you print out Fizz and if the number is a multiple of 5 you print out Buzz. If a number is a multiple of both 3 and 5 then you print out FizzBuzz.

I came across this challenge for the first time recently as I learn C# so here is my version of FizzBuzz written in PL/SQL.


   fizz BOOLEAN := FALSE;
   buzz BOOLEAN := FALSE;


   FOR i IN 1 .. 100

      fizz := MOD(i, 3) = 0;
      buzz := MOD(i, 5) = 0;


         WHEN fizz AND buzz THEN


         WHEN fizz THEN


         WHEN buzz THEN




      END CASE;