Better Programmer

Becoming a Better Programmer, Pete Goodliffe

New programmers will benefit from reading this book, and applying its recommended development practices. It is important enough that I will claim that your career will taken to a new level. My experience working with many programmers is that at least half of them needed to adopt the practices covered by this book (not you of course!).

Experienced programmers will get a queasy feeling, knowing they have cut some corners to get code delivered a day or so earlier, and that it will come back to bite them soon.

This is not an Extreme Programming (XP) book, though the author seems in favour of XP. It is more about how to program, design, and test well. I particularly liked the explanation of Technical Debt, which other books and blogs mention without explaining.

Read the e-book on the bus to work!

PHP Design Patterns

Learning PHP Design Patterns, William Sanders, O’Reilly 2013

Web programmers will want to read this book, in particular users of PHP.

PHP’s success as a web app language comes largely from its freedom from structure: you can hack code together and do almost anything. But what if your app is large, you don’t want errors, and you want to understand it? Think of Vtiger, which combines (yikes) code from SugarCRM, Smarty, ckeditor, antlr, PearDatabase, adodb, freetag, nusoap, phpmailer, tcpdf, PDFMaker, htmlpurifier, php_writeexcel, kcfinder, log4php, AjaxUpload, HTMLSax3, iCal, qCal, PHPMailer, and Image_Graph projects, not to mention several Javascript libraries. The many subprojects are structured using Object Oriented (OO) concepts, which gives you a hope of understanding it.

To succeed in larger projects you need some structure, and PHP Design Patterns proposes that you use the same high level structures that have been useful to C++ and Java programmers for many years. The author read the ‘Gang of 4’ book (Gamma, Helm, Johnson and Vlissides), and has interpreted it in the PHP context. He starts with a refresher on Object Oriented programming, which will be easy reading for anyone with knowledge of OO. Then he shows how to make best use of the OO features in PHP since version 5, referencing the most useful design patterns. Inheritance, polymorphism, encapsulation are all discussed with example code in php.

Returning to the Vtiger example, when the code uses some OO structure, it is often not clear what pattern is in use. A file should start with comments on what design pattern is being used, and if not, then a discussion of how the objects are used. If the designers had started with the common design patterns from this book, then it would all be more clear.

I want you to read this well written book in the hopes that the next php projects I need to enhance will be well structured and easier to work with. This means you! Why would you not just Google The Fine Thing (GTFT)? Because then you get snowed with poorly edited info. Read the book for a well organized presentation of the few important, common patterns.

Disclaimer: I read the electronic version of the book, on a smartphone. The reading experience is quite different from bound, paper books with pros and cons. Disclaimer 2: I got the book through the O’Reilly blogger program.

If this book interests you, then you might also want to read Javascript patterns By Stoyan Stefanov for a complementary treatment of the client side language.

Unfortunately, the OPL does not have PHP Design Patterns yet. 350 pages.