The Definitive Guide to Symfony

The Definitive Guide to Symfony (which we’ll call “the symfony book” from here on out) is an Open Source book written as a companion to the symfony PHP framework. Written by two of the most prominent names in the symfony community, Francois Zaninotto and Fabien Potencier, the symfony book is serves as not only a wealth of information for symfony developers, but also the de facto symfony manual.

The symfony book is published in print by Apress, and licensed under the GNU Free Documentation License. The book can be freely read online at http://www.symfony-project.com/book/1_0/.

Now lets get to the good stuff.

After a short introduction and description of basic terms (PHP5, OOP, ORM, PEAR, YAML, RAD, etc) the symfony book dives straight into symfony’s backend code. Using the symfony architecture as an example, this chapter is a great way to learn about and refresh your knowledge of the MVC design pattern. We are provided with the regular MVC flow charts, as well as examples of “flat” PHP code which is then compared to symfony’s layered approach. The third chapter focuses on getting symfony installed on your webserver - since symfony comes with a fully functional sandbox the installation is fairly painless. Once we have a functioning symfony installation we can move on to “Page Basics” and “Configuring Symfony” in the fourth and fifth chapters.

The sixth through ninth chapters are the “Core Architecture” section of the book. In these chapters the Model, View and Controller layers are analysed in detail. Through each chapter we learn more about YAML and symfony configuration. The model chapter describes Creole and Propel (the database backend) for the first time. More details about both YAML and Propel are in the final section of the book.

Chapter nine starts the “Special Features” section with a description of the routing system which is provided with symfony and is followed by the chapter on forms and validation. Chapter 11 describes the symfony AJAX integration which uses both simple javascript as well as usage of the bundled Prototype library. The Special Features section closes with chapters on caching and localization.

Part four “Development Tools” begins with a chapter on Generators. This chapter promises to the be most read (and most frequently referred to) chapter in the book, as it describes in detail the configuration and commands needed to automatically build the scaffolding for your application. Using the symfony generators is RAD at its finest and mastering this chapter is one of the crucial parts of using symfony to its fullest.

The Unit and Functional Testing and Application Management Tools chapters cover the essential unseen components in every project, unit testing, logging, debugging, and benchmarking. Other deployment tools provided with symfony, as well as symfony deployment best practices are also covered. The fourth part of the book ends with an extensive look at Extending Symfony.

Up until now, the symfony book has covered all the aspects of creating and deploying a site using symfony. To effectively maintain a production quality symfony site, you’re going to have to read up on “Becoming a Symfony Expert” which is the final section of the book.

Becoming a Symfony Expert starts with a chapter on Performance. Due to the architecture of symfony, and frameworks in general, there is a substantial overhead which is caused by all the various components. This section focuses on teaching you how to minimize the overhead by speeding up code, caching and turning off unneeded functionality. The book ends with a chapter on YAML and “Mastering Symfony’s configuration files.

In general I found this book very informative both on a symfony and PHP level. Like always, I had a few minor issues - due to the fact that the chapters are grouped in general functionality rather than in traditional development phases reading from cover to cover may be a bit awkward. Having said that, each chapter builds well on the preceding chapters, and the result is a very well rounded description of not just symfony, but also the surrounding technologies. The intended “user level” is stated as “Beginner-Intermediate” this is in reference to experience with symfony, not experience with PHP. To fully appreciate symfony, and MVC/ORM/RAD concepts in general, you will need to have at least some experience in developing and deploying web based applications.

To conclude, this book was a great read and I am looking forward to playing with symfony in upcoming projects.

This review was contributed by Aaron Wormus, the technical lead and managing director of HedgeCoWebsites, based in West Palm Beach, FL.

Tags: framework, Apress, PHP

Practial Rails Social Networking Sites

I was not a willing or easy convert to Ruby on Rails. My first exposure to it a few years ago left me skeptical of the claims made about Rails by it’s growing number of pundits. According to them, Ruby on Rails was far easier to develop with than Java, offered a logical and elegant framework of libraries that solutions like PHP could only dream of, and was built on top of the advanced language capabilities of Ruby such as metaprogramming and Domain Specific Languages. I remained unconvinced. It seemed like these so-called features were at best window dressing, and at worse unmanageable and brittle kludges.

I was slowly lured into the Rails world however, one screencast at a time. One huge difference between the Rails community and groups based around other development stacks is the emphasis placed on applied, easy to follow, build-it-now tutorials, over theory. In general, the community would rather walk you though the process of building a particular feature, than spend time diagramming and explaining it. Because of this, I gradually followed enough tutorials to see features that had seemed incomprehensibly “magical” and as useful, even crucial to a successful application. Finally, I turned away from other solutions, and became a full-time Rails developer.

Practical Rails Social Networking Sites, a new Ruby book by Alan Bradburne, follows in the tradition of Rails community tutorials, offering a hands-on approach to building a large, fully featured Rails application. Light on theory, but heavy on example and working code, Practical Rails rapidly propels the reader through the process of building a large, feature rich, Ruby on Rails application from the ground up.

Chapter one throws the reader straight in, dedicating a sparse twenty pages to introducing Ruby on Rails and installing the necessary pieces. Because of the chapter’s brevity, it is probably necessary to read or have on hand an introductory text before starting Practical Rails. Development techniques such as Test Driven Development, that might be unfamiliar to developers coming from PHP or Cold Fusion, are also reviewed, and to his credit, Bradburne provides unit and functional tests throughout the book. Because of this, Practical Rails offers one of the clearest introductions to test writing and TDD I have seen in a Ruby text. He also does a great job getting users comfortable with new Rails 1.2 features such as REST, and in so doing, makes sure his readers are not-obsolete before they finish the book.

The rest of the book walks the reader through building features such as photo-galleries and friendship networks. The implementation for these features is simple and functional, and critically: standards based. Bradburne takes pain to highlight emerging technologies such a microformats such as XFN and mashups, and as a result is able to pack more and better features into the application.

Later chapters cover exposing the application to the outside world via RSS feeds and APIs, which are not in my mind critical to a social organizing site, but interesting and probably useful to know. The final chapter provides adequate but hurried coverage of deploying and optimizing the application.

Practical Rails does fall down in certain regards. In being so…practical, It spends virtually no time discussing what social networks are. There is no discussion as to why someone would want to build a social network site, nor coverage of prominent social networking sites such as MySpace and Facebook. Requirements definition and design do not play any meaningful roll in the book, possibly leaving inexperienced developers shaking their heads when it comes time to add new features or remake the demo as a commercial application.

Despite this, Practical Rails does an amazing job of packing a lot of Rails knowledge into 421 pages. In short, Practical Rails  Social Networking Sites lives up to it’s name. Practical Rails gives readers a concise, hands-on approach to building a feature rich application, and provides them with a compelling introduction to developing the Rails way.

This review was contributed by Justin Wiley, a developer with Near-Time.net, based in Durham, NC.

Tags: Rails, Ruby, Apress

Getting Started with Grails

I first saw Jason Rudolph speak at our local Java user group a few months ago. He was speaking about Grails, a web development framework for built using Groovy. I went. I was impressed. I’d seen Scott Davis’ presentation on Groovy a month or two before, and had been messing around with Groovy already. Coming from a mostly PHP background, and having seen the rise of Ruby on Rails and similar frameworks, I was a bit skeptical that something could offer similar productivity in the Java world. Grails proved me wrong, and there’ve been two more development versions released since I was first introduced to Grails (0.6 was just released yesterday).

As with many new technologies, there is often a scarcity of written material. Early adopters often have to scrounge around on mailing lists and digging through source code to determine how to make the most of the technology. Grails adopters are lucky in the respect. There are two quality books out specifically about Grails - Jason Rudolph’s “Getting Started with Grails” and Graeme Rocher’s “The Definitive Guide to Grails“. Neither are brand new - Jason’s book came out in January 2007, and Graeme’s book was published in December 2006.  Even so, I can attest that the content of both books is still pretty solid, even 8 months after publication and numerous upgrades to the Grails framework.

“Getting Started with Grails” is not an in-depth book taking you through every nook and cranny of the platform, but a true “getting started” tutorial-style book. The majority of the book walks the reader through building a CRUD-style application, which the “Rails”-style ‘convention over configuration’ frameworks excel at. Jason takes us from the very beginning, starting with setting up an environment, then explaining each step with enough text and code to illustrate the idea, but without belaboring the points. By the end of the book you will have created a fairly complete CRUD application, with forays in to error handling, form submission validation, authentication, unit testing, and many other intermediate to advanced concepts.  The book reads very conversationally, which makes even the more advanced concepts easily digestable.

In a book this short (130+ pages) there’s certainly not enough space to go in to every minute detail, yet overlooking ‘basic’ details (like ‘how do I deal with legacy databases?’) can leave early adopters feeling like the technology (or the author!) doesn’t recognize reality. Jason was wise enough to bring up many of these types of issues, acknowledging their importance, and giving the reader pointers to the more detailed information on the web. While it seems common sense, some authors tend to focus just on the primary topic without recognizing the attendant needs that advanced readers will undoubtedly have.

Jason is an accomplished presenter, and is currently on the No Fluff Just Stuff tour. If you have a chance to see him present, go see him. He’s entertaining and informative, and will certainly give you quite a lot to absorb about. At least one of his Grails presentations is based on the contents of the book. When I saw him, he walked the group through Grails using the “racetrack” tutorial his book is based around. If you’re not fortunate enough to get to see him in person, get this book - it’s the next best thing.

Getting Started with Grails” is published through infoq.com, and is generously offered at either an affordable $19.95 for the print edition, or an even more generous $0 (free!) PDF version. Because of the tutorial-style nature of “Getting Started with Grails”, this is the first book I point people to whenever evangelizing Grails.  If you’re interested in learning Grails, this is the fastest way to get started!

Tags: Infoq, Java, Grails

Pro Drupal Development

Pro Drupal Development

Apress’ recent Pro Drupal Development packs quite a lot of information in its 400+ pages. Matt Westgate and John K. VanDyk have done an admirable job of shedding light on a lot of the more complex topics surrounding Drupal. Drupal is a Content Management System (CMS) built with PHP. It’s been around since early 2001, and has grown to become of one of the more mature CMS offerings in the PHP world, with a passionate and growing following.

I will state up front that I had a bias against Drupal. Earlier versions I’d used were cumbersome, complex and seemingly lacked a way to easily incorporate the visual flexibility I was looking for. In the past several years, times have changed, my expectations have changed, and Drupal itself has changed. A recent presentation at our local PHP user group had an area developer demonstrating his company’s use of Drupal, with some detailed walkthroughs of some of the tips and tricks they used to customize Drupal to their needs. I was impressed. Then I picked up “Pro Drupal Development” and have been even more impressed with the system itself, and the amount of functionality that’s available under the hood.

I still have one major beef with Drupal itself, and that’s with the reliance on global variables in many functions. I’m not talking about a ‘register_globals’ reliance, but the need to use global $foo type statements all over the place. I can understand that the project grew from a simpler time in PHP development when this wasn’t frowned on so heavily, and that rebuilding to not use that type of approach would be a major undertaking. I would urge those involved in Drupal development to try to minimize global usage nonetheless.

But enough about that - on to the book. Given that it was written by two authors, I have to say it doesn’t show. There’s a pretty consistent voice and approach taken throughout, which would only serve as a distraction if it were not so. Some of the examples and ideas are complex enough to follow without having to adjust your reading style for differing author styles.

The book takes the reader from the basics up through fairly advanced topics, including optimization, localization exercises and caching techniques. By the basics I mean a review of all the Drupal-specific terms, what they mean, and how the pieces all fit together. I don’t mean installing everything from scratch. Indeed, there’s an assumption that you already have Drupal up and working - there is no step by step installation guide. I found this approach a bit refreshing. Countless early PHP books used to rehash the same Apache/PHP/MySQL compilation and installation procedures, and thankfully the industry seems to be getting past that level of detail. Given the commodity of shared hosting, many people probably are using Drupal as something already installed on their web account anyway, so an installation guide would be wasted pages.

After the basic overview, the reader is taken through the specifics of writing an example module, working with the menu system and database interaction. There’s a specific section on connecting to multiple databases, which only seems to have been an issue acknowledged by major PHP frameworks in the last year or so. I was glad to see it covered, though I’m not crazy about the technique used by Drupal. It apparently used a global context switching approach, which puts the burden back on the developer to switch *back* to whatever original database driver was used. Again, I’m glad the authors demonstrate how to use the approach, I just wish Drupal handled this better under the hood.

The reader is then shown details about the core user object, themes, blocks, forms and more. There’s quite a lot of technical detail here - I’m not going to reproduce each chapter’s contents in boring detail. If you’ve used other frameworks or developed your own PHP software for awhile, many of these concepts will be familiar to you. There are a few concepts in Drupal which bear closer inspection, which the book does admirably.

Drupal’s input filter system and the search and indexing component are done well, covering enough of the mechanics to get you going. The input filter system itself is a remarkable idea, but may be obsoleted by similar in-built functionality in future versions of PHP. The search and indexing portion of Drupal, however, is quite impressive. While I’m still a SOLR fan myself, knowing that a fair amount of ‘under the hood’ power is available in Drupal has already made me reconsider recommending it for a recent project. I can’t believe that it’s necessarily as fast as using an external or dedicated search engine component, there’s very detailed explanations of what Drupal is doing and what it’s capable of in this book (chapter 12 to be precise). This attention to detail is carried out in the rest of the chapters, with caching, jquery, localization, security and development “best practices” all getting great treatment.

Overall, if you’re already doing development with Drupal and have been doing so for less than a year, I recommend this book in a heartbeat. Why the time limitation on the recommendation? In my experience, anyone just getting started with a framework as complex as Drupal will see huge benefits from having a book like this. Someone who’s already been using the product for a long time has likely already gotten involved in the community for updates, ideas, exchanges and so on, and has likely explored all the topics in this book. That doesn’t mean that they wouldn’t benefit from it, but the value is going to be somewhat less. This really depends on the developer and level of commitment to the project.

Having said that, the “pro” in Pro Drupal Development is quite deserved. There’s little fluff, no installation instructions, and quite a lot of material to help intermediate developers kick their game up to the next level. If you’re using Drupal, you owe it to yourself to check out this book.

Other reviews

http://www.devchix.com/2007/08/12/book-review-pro-drupal-development/

http://books.slashdot.org/article.pl?sid=07/06/06/1352210

http://www.oreillynet.com/onlamp/blog/2007/05/the_missing_drupal_manual_pro.html

Tags: Apress, CMS, PHP

Welcome to techbookreviews.com

This is the intro post for this new blog.  I’ve been doing some interviews with tech/web book authors over at webdevradio.com for some time, and have wanted a separate place to focus more on book reviews alone.  I’ve got a number of current books I’m in the middle of working through, and will be posting reviews of those in the coming weeks.  My background has been primarily in the web world, so most of the initial books will be on web development technology and topics - PHP and Ruby/Rails, for example, are some book topics I have on my plate.  If there are particular technologies you’d like to see reviewed here, let me know (email mgkimsal@gmail.com).

Tags: General