All hell broke loose after Zed Shaw (the guy behind Mongrel) wrote a post claiming Rails is Ghetto. In the post he points out the ugly part of “Rails Community”.
“This is that rant. It is part of my grand exit strategy from the Ruby and Rails community. I don’t want to be a ‘Ruby guy’ anymore, and will probably start getting into more Python, Factor, and Lua in the coming months. I’ve got about three or four more projects in the works that will use all of those and not much Ruby planned. This rant is full of stories about companies and people who’ve either pissed in my cheerios somehow or screwed over friends..”
Now Dreamhost (one of the biggest web hosts out there) comes with a rant on the technical problems with Ruby on Rails. Following sums up the whole post.
I don’t have anything to add to Zed Shaw’s comments about how the Rails development team operates as I don’t have any personal knowledge of that. What I do have personal knowledge of is how difficult it can be to get a Rails application up and running and to keep it running. DreamHost has over 10 years of experience running applications in most of the most popular web programming frameworks and Rails has and continues to be one of the most frustrating.
The main problems pointed out by DH blog are,
- Performance problems
- Poor support for shared hosting platform
- Backward compatibility issues
Also worth noting…
It’s all good and fine to recommend that users use higher end dedicated server hosting for their commercial applications but you simply cannot ignore the fact that nearly everyone will want to use lower cost shared hosting for getting started. It’s just simple economics. Additionally, people who use systems like Ruby on Rails want to spend time programming and not time setting up servers. Recommending technologies that are not widely used or supported by any major web hosting company is putting too much of a burden on your users, the people you want to keep happy! It’s a good thing we never even tried to switch our system to support Lighttpd and SCGI, too, because 6 months later the ‘in thing’ in the Rails community had shifted to Mongrel, instead.
January 9th, 2008 | Posted in Ruby News, Ruby on Rails | No Comments
One of the advanced features of Ruby, which is behind the success of rails is the dynamic code execution. Code fragments can be executed using eval method. This is very similar to JavaScript eval function.
following is an example,
eval executes the code in the current context. It is also possible to execute the code in a different context.
Code can also be executed in class context using another method class_eval. class_eval can add methods due to a class during execution! In the following example, we add a method doHello to the Sample class during execution of initialize. Then we execute doHello!
Now this is the technique which is behind the secret of attr_accessor used in classes. In fact attr_accessor is just a method. We will try to create a similar functionality using attr_accessor2. All the classes in Ruby are subclassed automatically from the class Class. Hence we will modify Class and add attr_accessor2 method which in turn will add getter and setter methods for the passed variable!
January 7th, 2008 | Posted in Code Snippets, Ruby Howto, Ruby Tips | 3 Comments
In this post I will look at various ways of interacting with a Ruby program’s runtime environment. Following sample program has methods to identify the operating system platform, environment variables in the OS and finding out the command line parameters.
January 6th, 2008 | Posted in Code Snippets, Ruby Howto | No Comments
Ruby is a relatively young language. One of the advantages with this is that Ruby has libraries for common programming needs. In this post, I will show you how easy it is to process CSV files in Ruby.
A CSV file contains comma separated values and is an easy way to store information in text files. In many Web applications, CSV file is generated and is output as excel filetype so that Microsoft excel program can process it.
For this example, let us consider the following CSV file. It contains exam results of 3 students.
Jayson Joseph,39,fail
Thomas Mathew,92,pass
Ravikumar,83,pass
Save this as examresults.txt. Following program shows how this can be read using Ruby. In this example, we will read the exam results, print the name of the people who failed the exam and finally add one more entry to the exam results file. All this can be achieved with minimal plumbing code!
Check out the documentation for complete set of methods available in csv library!
January 6th, 2008 | Posted in Code Snippets, Ruby Tips | 2 Comments
A new development version of Ruby (1.9.0) was released last week. Currently this release is not intended for production use. There are incompatibilities with 1.8.x series and 1.9.0 is more of a stepping stone for the upcoming 2.0 release.
So what is new in Ruby 1.9.0? Here is a summary,
- Block arguments are local now. This can break existing code.
- Introduced a new class called BasicObject.
- Kernel and Module packages extended.
- Regular expression engine upgraded.
- Native threading support.
- Offers literal hash syntax for parameters. :action = “helloworld” becomes action: “helloworld”.
- And many more….
It is important to learn these as the next stable version 2.0 will look very much similar to 1.9.0.
December 29th, 2007 | Posted in Ruby News | No Comments
The following program gives good illustration of string functions, regular expressions and blocks. This is a solution to the Reverse Polish Notation generator problem explained at http://www.spoj.pl/problems/ONP/.
Given an algebraic expression with brackets, this program will output the corresponding RPN form. For example, (a+(b+c)) becomes abc++. A good exercise will be to extend this program to use operator precedence in addition to brackets. But that would probably need a better algorithm.
December 29th, 2007 | Posted in Code Snippets | No Comments
One of the best ways to start learning Ruby is to try out simple programming problems. Let us see how we can generate fibonacci series using Ruby,
This is a verbose an example. You could achieve the same in a single line!
December 29th, 2007 | Posted in Code Snippets | No Comments
In the following days I will cover how you can quick start your Ruby learning. Today we will start with Ruby installation and IDE setup.
The first thing you need is a decent IDE so that you can quickly try out Ruby programs. Ruby installation comes with command line tools such as “irb”. But for any real development, a good IDE is necessary. In this example, I will use Aptana IDE which is based on RadRails.
Step 1 : Download and install latest Ruby release.
Step 2: Download and install Aptana IDE.
Step 3: From Aptana IDE, install Ruby extensions (you can exclude rails extensions for faster install). From Aptana, click on Help->Software Updates->Find and Install->Search for new features for install.
Step 4 : Create a Ruby project from Aptana IDE. You can keep all the sample Ruby programs you write here.
Step 5: Write the following sample code in file named ”HelloWorld.rb” and click on “Run HelloWorld.rb”. You should see your first Ruby program output!
October 4th, 2007 | Posted in Ruby Tips | No Comments
Ruby invasion into the programming world has been swift in the last few months. Obviously one of the reasons was the elegance of the language. But more importantly ruby popularity is driven by tools written on it. It is an open secret that much of the credit goes to Ruby on Rails Web application framework by David Heinemeier Hansson. In this post, I will look at some of the influential tools written on top of Ruby.
Ruby on Rails – Arguably the most popular tool written on Ruby. Ruby on Rails is an Agile web application framework which boosts programmer productivity. It uses convention over configuration to cut down on the manual coding. The productivity boost in Rails is due to Ruby elegance and also due to automatic code generation from data model. There are numerous Web apps written on Ruby on Rails – For example, Basecamp and Shopify.
Typo – Typo is a lean blogging tools powered by Ruby and Ruby on Rails. It is also open source and free. It supports comments, trackbacks/ping, export function and full text search.
RMagick - RMagick provides an extension which provides access to ImageMagick and GraphicsMagick image processing libraries from Ruby. Supports a huge set of image formats and comprehensive image processing API.
Instiki - Instiki is a Wiki clone based on Ruby on Rails. It is also possible to use this as a lightweight CMS. David Heinemeier Hansson is one of the project admins. Instiki features all standard wiki features such as file uploads, password protection and feed support. Also provides markup choice between Textile, Markdown and Rdoc.
Watir - Watir is an automatic Web application testing tool written in Ruby. This tool allows you to record user actions and then replay them whenever you want to test the Web app. It also comes with developer toolbar extension for internet explorer.
September 16th, 2007 | Posted in Ruby Tools | No Comments
September 12th, 2007 | Posted in Ruby on Rails | No Comments