KillerSites Blog

Ruby

Book Review: Ruby For Rails

June 23, 2006

Ruby For Rails connects the dots between Ruby and Rails.

In a nutshell:

This book looks at how Rails uses Ruby, and in so doing, you learn a heck of a lot about Ruby programming.

Ruby For Rails goes into detail about basic Ruby, enough so that I think someone new to Ruby, could learn enough about the language to be able to build web applications. But, the book is not a comprehensive Ruby reference – there are things that are not talked about.

The thing I really liked about the book, is the way the author introduces a concept and then shows you how Ruby or Rails implements that concept in a practical application.

For example:

You are introduced to a Ruby construct called a ‘module’*.

  • You learn what a module is.
  • Why Ruby has modules.
  • How Rails uses modules and why.

I am glad to have this book and think anyone interested in learning Ruby and /or Rails, should get it.

* Ruby modules are programmatic constructs that are like classes (they have methods and constants,) but they are not directly instantiated like a true class.

Instead, modules are created to be inserted into to classes or objects to give the host class or object the extra functionality. Often modules are referred to as ‘mix-ins’ because modules are mixed in to classes.

read more

PHP vs. Ruby

May 9, 2006

With all the buzz about Ruby these days (because of the web application framework ‘Ruby on Rails’) Zend (the people who manage PHP) are feeling the pressure.

Nerd Note: a ‘web application framework’ makes creating databased driven websites much easier because the framework takes care of a lot of the ‘dirty’ work that you would normally have to build yourself.

As far as Zend is concerned, PHP is not getting its’ fair share of attention even though PHP is:

  • Much more available than Ruby – in terms of hosting.
  • PHP is a widely used and a proven language with big sites like Yahoo, Digg and Flickr using it.
  • PHP is easy to use and easy to learn.

As I mentioned above, Ruby’s recent rise has been largely due to the web application framework ‘Ruby on Rails’. So in response to this, Zend has developed their own framework called: Zend Framework.

Along with the Zend Framework, comes a nifty new web site. From the press release:

Future of Web Application Design Is Here and Looking Good

Varien, a web design and development firm, has redesigned the Web site for Zend Technologies’ PHP framework. Varien completed the redesign as part of an effort to reposition PHP as the cleanest and most simple programming language.

Los Angeles, CA—April 20, 2006—Varien has completed redesigning the Zend Technologies’ new PHP Framework Web site in an effort to make the Framework more accessible. The Framework is a powerful new tool for Web developers, providing a simple, standardized way to create powerful web applications using PHP.

The redesign was part of a broader effort to reposition PHP, which included designing a new logo for the Framework. By repositioning PHP Zend hopes to make the Framework and PHP more appealing to current Web developers and less intimidating to those looking to get into Web development.

“Here you have PHP, a programming language that runs Flickr, Wikipedia, Digg, and even Yahoo, and yet Ruby has become synonymous with the new Web,” said Ben Blumenfeld, the Design Director at Varien. “Hopefully this redesign makes Web designers and entrepreneurs take another look at PHP. With Zend’s Framework, PHP is now simpler, faster and more powerful than it has ever been.”

PHP usage has grown tremendously since PHP4 was released in 2000. However, PHP has recently lost some of its mindshare to the heavily touted Ruby on Rails, despite a huge gap in actual usage. (TIOBE programming community index)

The Zend Framework aims to provide a high-quality, commercial-friendly and open-source based solution for programming in PHP. Zend is excited about the Framework’s usability and knows the site redesign will help developers get the most out of the new technology.

“The coolness fact is also important in initially attracting Web developers and is complementary to the technology. The new look of our Web site enables us to build a more appealing perception of the Zend Framework,” said Andi Gutmans, the vice president of technology at Zend.

The Framework can be found at framework.zend.com. The redesign allows users to download the framework from the front page and highlights projects created using PHP in a section on the front page.

WILL RUBY CONTINUE TO EAT AWAY AT PHP’S MIND SHARE?

This is the $64 000 question. But we have to consider one point: Ruby has capability that is widely used in Rails that PHP simply does not have; so can a PHP framework be as effective as Rails?

Nerd-minds want to know!

Stefan Mischook

read more

GoDaddy.com Supports Ruby

May 1, 2006

I have had two major problems with Ruby and Ruby on Rails:

  1. Hard to find Ruby/Rails hosting.
  2. Not too many clients looking for Ruby programmers.

One thing has changed:

A major hosting company (GoDaddy.com,) has stepped up and now supports Ruby on Rails hosting – there goes my first argument against learning Ruby!

Quote from GoDaddy:

Our customers are finding Ruby on Rails to be incredibly valuable in shaping their online presence,” said Bob Parsons, GoDaddy.com CEO and Founder. “We are pleased to be able to offer support for a framework that increases the utility of the sites we host.

With GoDaddy.com jumping in, this will force/influence other hosting companies to adopt Ruby and as such, I believe over the next year, Ruby hosting will become more and more common.

BUT EVERYTHING IS NOT PERFECT WITH RUBY… YET.

Even though it looks as though the hosting thing is resolving itself, we still have the issue of the number of Ruby gigs/jobs floating around … not that many yet.

There is still so much PHP out there (hosting, frameworks, products) that I think for next few years, PHP will continue to dominate with regards to small to medium size projects.

That said, I think that Ruby will be a player for a few reasons … most important, is the strong acceptance of Ruby (and Rails) by the Java community.

Another problem with Ruby and Rails, is the stability of the fastcgi plug-in that works with Apache 2.x.

Basically, there are still some lingering issues with how Ruby ‘talks’ to Apache. This is major, but there are many high profile, high traffic websites that seem to be running fine anyway … ?

CONCLUSION

Despite the aforementioned issues with Ruby and Rails, I am actually involved with putting together a major project with Rails … I know, I know, I’m a bit of a hypocrite!

My reasons?

  1. Ruby and Rails are compelling – there’s some good stuff in there that should make the project much easier to build.
  2. I wanted to explore Ruby and Rails with a real project – I’m just a ‘Curious George’ I suppose …

I plan to come back to you and give you my impressions as to how easy (and useful) it would be for web designers (not programmers) to learn at Ruby vs. say PHP.

Stefan

read more

Book Review: Agile Web Development With Rails

April 28, 2006

Review by: Richard Mischook

First, a little about this nerd reviewer:

I’ve been writing web applications for over ten years. I’ve used a variety of technologies over that time including CGI with various shell script dialects, Netscape Livewire, and Active Server Pages.

But mainly I’ve used Java because it generally has been the best choice for many of the projects I’ve worked on. (ed: and it paid the bills!)

Now saying ‘Java’ doesn’t say a whole lot because when it comes to web application development, Java can mean a lot of things. It can be as simple (and messy) as just using Java Server Pages or can include servlets, EJBs and/or the various frameworks that are available such as Struts and Spring.

Many of us have been happy to pick and choose from the rich menu of available technologies, confident that these were solid and reasonable choices.

Things change …

But there is a disturbance in the force. It’s a small thing right now but some important people have been grumbling. They’ve been saying things like ‘Do I need to write so much code to do this’ and ‘How many XML configuration files do I need to get Hello World to show up in a browser?

And while many have embraced PHP there is a growing movement centred on a framework called Rails.

Rails is built on the Ruby scripting language. Ruby is an object-oriented scripting language that is concise and “…makes it easy to create methods that act almost like entensions to the syntax…It makes our programs shorter and more readable.” (page 1).

RAILS USES MVC

Rails provides a Model View Controller based framework with some important extras thrown in, most particularly a built in Object Relational Mapping tool that makes saving and loading data to and from Ruby objects almost trivial.

In fact Rails seems to provide a lot of the stuff you’ll find in Struts without the headaches associated with maintaining the Struts config file(s).

Ok, ok … what about the book!

The book wastes no time and starts with an overview of a simple Rails application. It then steps back and covers installation on a number of platforms.

It then dives in deeper and builds a fictitious shopping cart application using an agile and iterative development approach (the book is after all called Agile Web Development with Rails). After spending 125 pages building an application, the authors look at the guts of the framework and illustrate how it can be tweaked.

One important theme running throughout Rails is that of intelligent defaults – if you follow a relatively small number of conventions you can have an application up and running with little or no configuration file tweaks.

But if you do need to change things, you can, and the book does a great job of showing you how in simple and clear language.

EMAIL AND AJAX

The book also looks at support for sending and receiving email, as well AJAX and web services support in Rails. There is also a chapter on deployment that is upfront about some of the issues here as well as an interesting appendix covering the Ruby language for those who may be new to it (like me).

CONCLUSION

Overall the book is a great read if you want to get to grips fast with Rails. The examples and scenarios are fairly realistic and the writing is clear and to the point. Clearly the authors are very passionate about Rails and their enthusiasm is contagious. Highly recommended!

read more