RSS
31 Jan 2007

Beginning Ruby on Rails E-commerce: From Novice to Professional (Apress)

Author: ceefour | Filed under: Beginner, Books, E-commerce, News, Opinions, Praises, Rails, Reviews, Ruby, Tips, Web 2.0

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Apress’ Beginning Ruby on Rails E-Commerce is easily one of the few (or the first?) Rails books who is able to broadly cover most aspects of Rails web development. Christian Hellsten and Jarkko Laine, the authors, will guide you from the point of installing the necessary software (including the Ubuntu Linux operating system), preparing the Scrum development process, to the very end of deployment and performance tuning. I say this book a “full-stack” since there’s not just development in here, but lots of bits about systems administration and project management.

<br />Apress recently offered me to review this book. Still unable to leave my old style of reviewing, here’s a narrative overview of each of the 13 chapters in tis book:

Chapter 1 quickly sets your development environment. If you follow its instructions to install Ubuntu, you’ll be getting up and running in no time (provided you have a good Internet connection). You will be introduced several concepts such as agile development techniques (it uses Scrum) but before you know it, you’ll already be running your first Rails application (and actually doing something, not just plain scaffolding) before the end of this chapter. You’ll be grateful there are so much introductory + practical information on the first chapter alone. In the example you’ll create a book store e-commerce application.

In Chapter 2 you’ll be introduced to basic CRUD (Create-Read-Update-Delete) actions on author management part of your application. You’ll like this so much since the first page of this chapter already mentions Test-Driven Development, and it is rightfully so for the next few pages. This is a very good habit, I’m very glad to see this getting more advocated. You’ll be implementing the actions from scratch (not using scaffolds), which is really a good thing (especially for learning how controllers and views work). This chapter has quite rich functional (controller) testing techniques.

Chapter 3 gets more to the point, you’ll implement yet another controller for book management. You’ll be presented with migrations, validations, more tests, model associations, unit testing with fixtures, and integration tests (seriously these are cool stuff!). In this chapter you’ll already finalized the administration facet of the application (in just two chapters, wow).

In Chapter 4 you’ll build the customer-oriented part of the application. It covers more (of course) testing, designing views, and eager loading of models. You’ll get some Google-y feeling as you implement the search functionality using Ferret and the acts_as_ferret plugin, which greatly simplifies the task. You’ll also create your own RSS feed generator, so your customers will always be updated with your latest offerings.

Chapter 5 guides you to implement a shopping cart, the last important step before you actually profit from your business. After doing some basic stuff like controller filters, it’s time for you to get the first Web 2.0 feeling using Ajax effects. All neat Script.aculo.us treats without a single line of JavaScript. Yummy! (it makes your customers happy too!)

While everything is set, it won’t be complete without a little touch of community. Ah, yes, in Chapter 6 you’ll be creating your very own forum for your site’s business. No, it’s not going to be frustrating because acts_as_threaded plugin will be ready to help you develop your forum the easy way. The under-the-hood forum threads implementation using nested sets is quite tricky actually, fortunately the plugin saves most of the headaches for you.

Got more love for Web 2.0? In Chapter 7 you’ll lift your site higher than your competitors using tagging support. Don’t worry, you’ll use a plugin/gem developed just for this purpose: acts_as_taggable, so your quest should be as stressless as possible. Note that there are now alternatives like acts_as_taggable_in_steroids and has_many_polymorphs, should you want to be adventurous.

In Chapter 8 you’ll create a login/authentication system, using a reusable component (of course): acts_as_authenticated. For registration and lost passwords you’ll need to send some e-mails, that’s where ActionMailer kicks in to help you. The chapter also talks a bit about common security attacks and how you can fortify your site from these bad guys.

Chapter 9 walks you through the most heart-pumping yet critical parts of your application: the checkout process. Stay worry free, ‘cuz Active Merchant will be there at your disposal. You’ll also integrate your application with payment gateways like Paypal, Authorize.net. Not only that, your customers will instantly be able to know exactly how much they’ve to pay for shipping on checkout, thanks to the Shipping gem.

For you who caters to international markets, Chapter 10 is definitely for you. The Globalize plugin allows you to internationalize your application, and localize everything from messages to date and time to currencies. You’ll also be prepared for exotic languages since you know application will handle them using Unicode. (Note: Ruby currently doesn’t have complete UTF-8 support, fortunately Rails 1.2 has pretty good support for Unicode for those who need it)

Chapter 11 deals with acceptance testing, which is a higher level than integration testing. You’ll use Selenium, a tool built for this purpose. This is the first time I’ve heard of this tool, so I can’t give much information about it. Rest assured, the author’s depth and breadth of coverage is excellent. Acceptance testing makes it easier and effortless to do tests that traditionally can only be done manually using a web browser by your QA team (if you have one :-) .

In Chapter 12 you’ll deploy your application to a LightTPD web server, one or more FastCGI application servers, and a MySQL database server. Other alternatives (Apache, Mongrel) are discussed, but the book points you to online resources for these. You’ll be able to deploy your site automatically using Subversion and Capistrano. Soon enough “cap deploy” and “cap rollback” (hopefully seldom) are the only commands you’ll ever need to make the glorious new version of your site alive.

Chapter 13 lets you optimize your site’s performance, that begins with the absolute first: measuring, since you want to optimize what’s the real culprit of the slowness, not an already good code. (there’s almost always are tradeoff between performance and code readability/design). You’ll use Rails Analyzer and Action Profiler to do this. Next, there are some alternatives. Caching is probably the most obvious, and using several techniques, such as the popular memcached will give your site a nitro-boost (provided you have enough RAM). The authors also describe some common problems, including database and query design.

I was expecting an Appendix for quick reference commands and stuff at the end. But there isn’t! I hope the authors will add this on the next edition (I wish there will be!)

By the way, you should note that all of the tools/software used here are freely downloadable from the Internet without limitations. One of the greatest wonders of the open source movements and the worldwide network, indeed.

This is a Rails book which covers the widest aspects of web site development than most books, and I’d heartily recommend it to anyone who wants to build a real world Rails web site, not just e-commerce builders.

Related posts:

  1. Three Ways You Can Speed Up Your Fresh Rails Development A Ruby on Rails web application I’ve been developing...

Related posts brought to you by Yet Another Related Posts Plugin.

blog comments powered by Disqus