Before learning how to program, one should learn how not to program – this is the idea of the book Bad Programming Practices 101, which was kindly provided to me for a review by Apress.com
The book shows some bad programming practices, thus giving you an idea how to avoid them and explaining you why they are bad. Somehow, it is written in a way, that can make a junior coder/programmer feel dizzy, because the bad ideas are presented in the book with a lot of irony around them. Thus, in order to catch the irony, one should be somehow more careful. To avoid being over careful, this is how I read the book – in every chapter I have started with the introduction and then I have read the “Thumbs Down!” sections of it. The “Thumbs Down!” of a “Bad Programming Practices 101” are actually the best practices. At the end, I have read the whole chapter. This method worked quite ok for me and I enjoyed the book! It is really written with some source of humour and it is easy to read.
What can someone learn from it? Well, seeing all these bad practices at least one makes you a better programmer. I still remember the day about 3 years ago, when I literally saw in a production code someone making an input check for a cell object in VBA, comparing it with a Null. If you have ever programmed with VBA a bit, you would be aware that an existing cell cannot ever be a Null. That guy has written more than 700 lines of code, which were not only completely useless, but harmful, because he thought that he is sanitizing the input. I remembered this story, when I was reading the book concerning defensive input, which makes sure that you do not pass a Null value to a simple message function. Well, I was having the reverse case 🙂 I was also having a thought – “Hey, I have seen this!” when I saw a boolean function, which simply returns “YES” if it is successfully executed and then handled in an “if-else” structure for error handling. Thus, I really had some kind of a nerdy fun, while reading the book!
I liked the book in a way that it was written as a comic book, which was easy to read. Some programming traps were well-described. The book is written in Java, but the code snippets are understandable for anyone, who is programming. I guess that some programming experience is needed, otherwise you would probably get bored a bit.