I 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.