Friday, April 18, 2008

Book Review - Wicked Cool PHP

Wicked Cool PHP
William Steinmetz with Brian Ward


One of the best ways to learn a new programming language is to find existing code and modify it - not only do you begin with a working product rather than from scratch, you see standards, shortcuts, and myriad different ways of doing things. The risk run is a lack of reliability - there are few guarantees offered with most code, and there's always the possibility one will learn bad habits. PHP in particular includes plenty of pitfalls for new programmers, and there are plenty of ways for a neophyte to drop the ball with serious consequences if guidelines aren't set from the beginning.

Enter the hybrid introductory lessons/cookbook. Wicked Cool PHP, from No Starch Press, is a fantastic book if you're picking up PHP from a beginning perspective. The programming tasks outlined are fairly common ones, but are solved elegantly and proper information is given along with the examples. The book contains all that a new user needs to know about securing PHP (quite a lot) without departing from its recipe-like model of task, design, and code. The authors begin with sending email and using the session and continue through input sanitation, SOAP, and templating. Implementation-neutral database use is touched on, and the projects begin to get fairly ambitious towards the end.

Again, strongly recommended for new and enthusiastic PHP coders, who might save considerable amounts of time learning by an innovative walkthrough paradigm.

Labels: ,

Monday, February 25, 2008

Update

Jeff Atwood of Coding Horror agrees with my review of Beautiful Code. You saw it here first, though.

Labels: ,

Sunday, February 10, 2008

Book Review: Best Kept Secrets of Peer Code Review

Best Kept Secrets of Peer Code Review
Jason Cohen, et al


We cannot forever hide the truth about ourselves, from ourselves.
- John McCain
This book was a freebie from Smart Bear Software, which means that if it were presented in terms of utility per dollar, it would be nothing short of infinitely worthy. If you're interested in Software Engineering, the disciplined and systematic development and maintenance of software, I can't recommend highly enough that you go on and get your free copy. It's an insightful and provacative book, and you won't regret your investment of time.
The Best Kept Secrets of Peer Code Review remain secrets because it is manifestly evident to every coder that their code is flawless. This is pretty obvious; nobody ever sits down to add bugs to their code. A bug, logical or syntactical, is largely a matter of perception.

Black box testing for code flaws is a lot like smelling an old milk carton; a tester is here not hunting for actual flaws so much as the implication of flaws, their products, offspring, and output. Code review, as defined here, is the actual human fathoming of pre-production code. This is important, no one will deny, but is it absolutely necessary for proper development? That's the argument made in this book, and it's made with lucidity and care. The reason this book is worth reading is its careful, honest, and meticulous use of statistics to prove that enforced peer code review is a numerically better case for most software teams.

It is true, you know. The books sinews, the very guts of it, the part that will remain in the reader's mind long after all thoughts of what constitutes a code flaw, what part of design is taste and what is doctrine, and what metrics of testing are more important that others, are its brilliant and decisive forays into the metrics of bugfinding. Simply put, the better and harder you look at code - any code - the more bugs you'll find. The sooner you look, the easier they'll be to fix, and the more lines reviewed, the more bugs will be found to exist. This is absolutely, universally, inarguably true of any code that exists, and if as those axioms weren't philosophically fundamental, this book absolutely proves them and more.

The authors of the book reveal these truths so systematically that it's impossible to flinch when, on putting the book down, you will realize that the more bugs that have found per line of code in a piece of software, the less buggy the software can be said to be. An excellent read for anyone who likes to ruminate on the dynamics of group software development. It's convinced me to try out their cross-platform tool, Code Collaborator; here's looking forward to it.

Labels: ,

Sunday, January 27, 2008

Book Review: Beautiful Code

Beautiful Code
Compiled by Andy Oram, Greg Wilson


A diamond is a chunk of coal that is made good under pressure. - Henry Kissinger

Beautiful Code is another non-animal O'Reilly volume, with high aspirations. As the sleeve submits: "How do the experts solve difficult problems in software development?" If this book had been able to answer that question, reading it would be a head-spinning experience indeed.

The book's chapters are each the domain of a different prominent software developer or writer, and several are elegant outlines of what is unarguably some of the best code out there - Apache Webserver, Quicksort, and the Python interpreter. Ostensibly, the authors are talented beyond measure; with a lack of a cohesive theme, a unified structure, or an overall purpose the book quickly becomes a showcase of beautiful code-essays submitted by thirty-couple completely dissonant geniuses. The fact that the book still contains not much other than what it claims is no invitation for criticism. If you want to see real kung fu code, this is your book.

The potential disparities hide in between the lines, where compilers do not tarry. Few of the essays touch on why the code is elegant, or how it got to be the way it was. Most of them wander around what problem is solved by the code, some delve deep into the minutiae of the problem, and a few contain no code at all. This last set could have been chosen to present a semblance of organization, could have pulled loose ends together and formed some conceptual continuity among a wide variety of articles, but in their current states and places even these well-intended 'theories of code beauty' ruminations are ineffectual.

If a computer scientist was so riveted by unpolished essays surrounding the world's best algorithmic hacks that they failed to notice that no new information was gained, no statements beyond the cold, functional truth were made, no concessions given to that imaginative side of the brain that, when it is given the occasional chance to influence the gnarled digits of a perl hacker, results in that big win - the one sought after in wake and sleep for a week - and doubles the maintainability and efficiency of some project, then that reader will be satisfied to the fullest extent.

For the rest of us, this book was no great failure but no revelation, and is deserving of its place on the shelf. And the geeks among geeks, the hackers who would have found a book closer to Hackers and Painters, held it and shook it until C code fell out, will no doubt appreciate this book.

Labels: ,

Sunday, January 20, 2008

Book Review: The Art of SQL

The Art of SQL
By Stéphane Faroult, Peter Robson

As we know, there are known knowns. There are things we know we know. We also know there are known unknowns. That is to say we know there are some things we do not know. But there are also unknown unknowns, the ones we don't know we don't know. - Donald Rumsfeld (Sun Tzu's second millennium CE incarnation.)
The Art of SQL is no Web Database Applications with PHP and MySQL. It's far beyond that; it is well past even Practical PostgreSQL and the SQL Cookbook. Not only is it written for the experienced user, it is for the ambitious user, the one who wakes up with a smile trying to retain the n-dimensional join from their dream.

The excellent style of writing used is above O'Reilly par. Not only is the text concise and well edited, the book is organized very well. In a graceful and creative turn, the presentational style of the book is allusive to Sun Tzu's Art of War; query diagrams, sample datasets, and business cases are rendered as plans of attack and battle formations in the Napoleonic era. The result is phenomenal, and structurally, this book is groundbreaking - no computer science book I've read prior has had so much attention paid to making its content engaging and enjoyable to consume - this is certainly not necessary, but it is a great indication of the overall quality of the book.

The book is SQL implementation agnostic and assumes the reader is interested in data integrity, extensibility, and scalability in the database. It assumes that you care, or want to care, whether you're following third normal form. In fact, the implied understanding here is that an earnest investment in normalization will pay dividends in optimization. Only if you're willing to perspire for it - it is an art, not a school of magic.

The SQL enthusiast will learn a lot from this book - perhaps a baffling amount. I absolutely cannot recommend it highly enough. It has been some time coming, the sort of thing that is an obvious boon when one considers that our 'art' has only been around for a few decades. We'll get it right eventually, inspired by those like Faroult and Robson.

Labels: ,