a work on process

Viewing posts tagged: ruby on rails

Practical Rails Projects is a weighty tome, coming in just shy of 600 pages, which led to this review taking a little longer than it otherwise might: not just because the book took a while to get through, but also because it wasn’t quite so practical to lug it on the bus as some of the others I’ve recently covered. A result of that heft is a fairly comprehensive volume, but one that doesn’t feel quite so consistent as it perhaps should.

Eldon Alameda has written the book for people who have some previous Rails experience or may have cracked open one of the introductory books on offer, but who want to learn the framework by observing a number of working projects. In some ways that leads to overlap with a book like Practical Rails Social Networking Sites, but whereas that built up one example this book covers seven ranging from a system to track progress through an exercise programme, to an appointment scheduler that interfaces with 37signals’ Highrise using ActiveResource.

The first few projects proceed at an even pace and are likely to be helpful to a newcomer to Rails, there’s a fair bit of overlap with examples available in other volumes, but they work well together. While the author discusses the decision to skip over the writing of tests and/or specs, it did seem that in a volume of this size that topic should have been given a little space, even if that involved sacrificing one of the sample projects.

Unfortunately the book loses pace a little later on, particularly with the introduction of the Ext JS library which is used to build user interfaces but ends up occupying far more space than the actual Rails code in the later chapters. Obviously Javascript frameworks are an important part of building many modern web applications and Ext JS is a worthy entrant, but the way it was used seemed quite inappropriate. The admin interfaces built with it would not gracefully degrade for users without javascript; there was no discussion of progressive enhancement or even of why the decision had been taken to build such an inaccessible system. When careful use of respond_to blocks can make progressive enhancement so straightforward in Rails, this seems a missed opportunity. At the very least the decision making process should have been documented, and ideally a better solution would have been offered.

I was similarly surprised to find a number of occasions where design decisions were made that conflicted with the RESTful approach that is now Rails convention. Early on that might have been one thing, but coming after a chapter extolling the virtues of resource-centric design that was quite a surprise and seemed an indication that the book had begun to sprawl a bit. In many ways it’s a shame that this book wasn’t broken up into a couple of volumes. Packaging the first few projects together as an introduction, then offering the last few as smaller supplements more tightly focussed on specific areas such as Ext JS usage, ActiveResource, etc. That way the material could have been tightened up and some of the repetition would have made more sense, and perhaps there would have been space to cover a few obvious missing pieces such as atom/rss feeds.

With a number of volumes now available that use specific projects to illustrate Rails techniques, this book isn’t so distinctive as it might have been a few months ago, and many developers will probably want to go for a more focussed, more succinct option. If your learning style benefits from taking things slowly and you don’t mind some repetition then this may be a good option, but don’t forget to read up on accessible web development while exploring later chapters.

Disclaimer: I was sent a copy of this book for review by the publisher. You can find it at apress, amazon US, amazon UK and all sorts of other places.

Recommend this post:

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

 

As I’ve indicated here a few times, when announcing site launches and offering a few hints and tips, I fairly frequently find myself working with Drupal but have long had reservations about doing so. What I’ve so far avoided doing is going into much detail about why that would be, what those reservations are, and so on. But now I’m working on a review of a Drupal book and so it seems appropriate to lay those cards on the table and look at the details on them. It seems easiest to do that by comparing with the framework I do most of my development in: Ruby on Rails.

As ever with technology comparisons, just like any other sort of comparison, a lot of my preference for rails boils down to a combination of taste and experience. I’m also well aware that I’m comparing unlike things. Rails and Drupal set out to solve different problems, and so obviously take quite different approaches. That doesn’t mean, however, that developers aren’t often left choosing between them as the boundaries are blurred and there is significant overlap between their respective domains.

I’ve seen plenty of bad ruby code, but proportionately I’ve seen a lot more bad PHP, and as a PHP-based solution Drupal inherits some of that baggage. Drupal has pretty good support for a wide range of cutting-edge ideas and tools, but by and large the Rails community has seemed much more clued-in to what’s happening at the forefront of web development. That may of course change as the Rails community continues to transition from being chiefly early adopters to a much more mainstream crowd, but it marked my early impressions of the framework.

A case in point is the integration of automated testing in Rails. There is some community support for automated testing in Drupal (primarily through the simpletest module) and there are plenty of Rails projects that lack tests, but there is a strong focus on Test-Driven and Behaviour-Driven development in the Rails community, and the combination of Rails’ object orientation, simple rake tasks and fixtures/mocks makes it very simple to write a solid test kit.

Testing is complicated by the hooks system in Drupal. Hooks are a powerful feature, allowing any module to broadcast and listen for a variety of events and respond appropriately, but it can be difficult to know what order modules will receive those events and so you end up performing a variety of contortions to make sure your responses are given the appropriate weight. Arguably Rails’ layers of filters and plugins can introduce similar complications and I’ve certainly spent quite a bit of time tracking down performance hits coming from rogue filters in plugins and engines, but so long as inheritance is properly handled it’s not all that difficult to do a little introspection to make sure everything’s in its right place.

The fact that Drupal relies heavily on web-based configuration makes it easy to put a lot of power in the hands of admin users, reducing the reliance on a developer, but it also makes upgrades and deployments a more complex business. When I add a new module to an existing Drupal project I usually find myself noting down the steps I take to configure it in my development and/or staging environments so that I can repeat that process in production. In a Rails project I’d write a migration and set up capistrano to run that migration when I push my new version live, significantly reducing duplication. The Drupal approach may be simpler for non-developers, but as a developer I frequently get frustrated at the repetition of tasks that could be so much easier.

That issue is one of the key things pushing me away from the nice-in-concept CCK. Adding new content types to a site through a web interface is an appealing idea, but it’s a pain to have to work out how that changed things in my database to produce a script, or to have to repeat a manual process. Since I know how, I’m much more likely to produce a module for my new content type, simply because I know that deploying that is a much quicker process.

One reason it’s been fascinating reading the Drupal book I’m currently reviewing is that books on Drupal are so thin on the ground. That’s a real shame as while there’s a lot of content on Drupal online, it’s not really been well organised for experienced developers wanting to build serious solutions who aren’t already intimately involved with Drupal. By contrast, while the Rails books are mixed in quality the best ones not only get you up and running fairly quickly, but provide a good entrance to exploring the internals and writing effective extensions. That’s not necessarily a reflection on the core projects themselves, but both online documentation (where, admittedly, Rails is still lacking) and books make a significant difference to the developer eco-system and quality of the solutions that are likely to be built.

I don’t mean to sound too negative, and I’d love to receive comments showing me how to address the shortcomings I perceive. I’ve built sites I’m proud of on top of Drupal, and where their focus is a good fit for Drupal’s core features or mainstream modules it’s been a very good solution, providing a suite of content management tools at very little cost. But as soon as there’s serious custom development to do, those advantages tend to dissipate pretty quickly when set alongside the advantages of Rails for agile, regularly upgraded and well tested solutions.

Recommend this post:

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

 

I am not in this book’s target audience. Whereas the book is aimed at experienced java developers who are just getting started with rails and want to take advantage of JRuby, I’ve rarely touched Java but have lots of ruby and rails experience and am interested in JRuby mainly to see where I might be able to take advantage of java libraries, or ship my ruby apps into new contexts. In that respect, the book was helpful but there’s probably space for a companion volume for people like me.

The book takes a measured pace, introducing Rails early on and then building in different components from the Java world as it works through four different projects. Use of JDBC within a rails app, calling ruby code from Java, deployment strategies, packaging a Rails app as a .jar that can be dropped into an application server, and making use of java for interfacing with SOAP web services are all covered.

Readers will probably need to spend some time experimenting with each feature to really get comfortable with them, but the book works well to get you started and point in the right direction. The introduction to Ruby and Rails is a case in point, as Ola dives right in to his examples after a brief lead-in. That may work well for experienced developers who will enjoy exploring the accompanying code, but it is worth being aware of.

It did feel like there were some missed opportunities later in the book, particularly in the final project, to introduce more of Rails’ “RESTful” features since that example really invited that style of design, and it would have been interesting to have some discussion of the pros and cons of treating the libraries built to interface with external services as models within a rails app, making the interface more transparent.

I’m also not quite sure where the “Web 2.0 Projects” line in the title comes from. The final project interfaces with amazon web services, which I suppose might get thrown onto the “web 2.0″ bandwagon, but don’t go into the book expecting a series of stereotypical “web 2.0″ projects. It’s an introduction to JRuby on Rails for Java developers, whatever approach to the web they may be taking.

JRuby is a really exciting technology that promises to help developers take another step towards picking technology based on their projects, not just the platforms their organisations may have standardised on over the past decades. If you’re a java developer wanting to learn how to make use of JRuby and looking for some help to get up and running, this book is likely to give you just that.

Disclaimer: I was sent a copy of this book for review by the publisher. You can find it at apress, amazon US, amazon UK and all sorts of other places.

Recommend this post:

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

 

Available for projects

7 November 2007 (4:06 pm)

By James Stewart
Filed under: Announcements, Meta
Tagged: , , , , ,

With a few projects coming to an end it turns out I have some time on my hands that I could do with filling with some paying work. I’m an experienced web developer, having been building sites and applications for eleven or twelve years now. I prefer to work with Ruby on Rails, and have been doing so for two years, but am comfortable in a range of environments and want my tools to match the project as well as possible. I frequently find myself working with drupal, and as an eight-year PHP veteran, that’s okay.

I’m particularly passionate about helping charities, music organisations, and magazine publishers make use of the web as effectively as possible. I can help such organisations work out how what they do in other environments translates to the web, and then to build the tools to make that happen. I prefer nuance to buzzwords, but I can throw around the appropriate Web 2.0 terms if I have to.

(and if you don’t fit in that list but have a project you think I might find interesting, I’m still interested in hearing from you)

I’m used to working solo, or in a small team, and have experience of leading teams as well as being a member. I’d prefer something in or around London, but usually work from home and am quite open to remote working.

I’ve got three, or maybe four days available for the next couple of months. You can reach me at james@jystewart.net to find out more.

Recommend this post:

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

 

Taking readers step-by-step through the creation of the RailsCoders.net website, Practical Rails Social Networking Sites is a well paced guide to building web applications that tick many of the boxes of the moment.

The book starts with basics, giving simple instructions for installing Rails on a variety of platforms, and then steps through simple content management, adding users and groups, building a blogging engine, adding a discussion forum and photo gallery, integrating with Google Maps and Flickr, and deployment. Along the way the various aspects of rails’ testing framework are introduced as they’re used. The style isn’t test-driven, and it would have been nice to see that style introduced, but tests are written after each piece of functionality, demonstrating some of their use and importance.

Judicious use is made of plugins with a number of recommendations made throughout the book. restful_authentication is referred to, but its functionality is largely duplicated in the code. That’s probably a sensible move so early in the book as it’s important that developers understand what the code is doing even if they’re going to employ a plugin for the implementation. YM4R/GM is used to implement the Google Maps functionality and it’s good to see that getting some attention in print.

Readers who have already built a couple of rails apps may well find themselves skipping large chunks of content as a lot of the code will be familiar. As Stephen pointed out in his summary, it is a little curious that “The Apress Roadmap” suggests this as a more advanced title when it would probably work better for an engaged beginner than an experienced developer.

Of course, the great problem with publishing any rails title right now is that version 2.0 is just around the corner, and with its release we’ll see the end of built-in pagination and a few changes to the routes. As a consequence there are likely to be a number of readers who find that the examples in the book fail to run on the latest stable rails by the time they come to try them. Hopefully Apress will be able to offer a brief supplement with the book or online to help readers update the code for the new features.

Practical Rails Social Networking Sites is a solid introduction illustrating how simple it can be to build useful web applications with Ruby on Rails. I’d hesitate to recommend it to anyone with rails experience, but it will be high on my list of recommendations for beginners who are wanting to dive straight in.

Disclaimer: I was sent a copy of this book for review by the publisher. You can find it at apress, amazon US, amazon UK and all sorts of other places.

Recommend this post:

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

 
« Previous PageNext Page »