Tag Archives: Ruby on Rails

10 Reasons why – Ruby on Rails

Your development team has been frustrating you, projects start and four weeks later the development team is still developing the framework, your budget is running out. You want productivity but just don’t know how to get it. Is there an answer? One of your developers keeps mentioning this great framework called ‘Ruby on Rails’. Is this the answer? This article discusses the positives and the negatives in moving to this new technology.

1. Ruby on Rails provides a consistent approach to building web applications with an out of the box architecture. Traditionally starting a new web application is a fairly heavy weight process, you typically need to survey and choose your various software components to solve the common architectural problems of persistence, logging, build scripts, application configuration, web tier components and workflow. With the Rails framework these decisions are already made for you, so you can get on to understanding the business problem and quickly build a working system. You become productive in minutes not weeks or months.

2. In a Rails application, a pragmatic philosophy of convention over configuration is taken, this is apparent in all layers of the architecture with the highest productivity gains noticeable in the relationship between the model and the database. Once the developer understands the rules and constraints, Rails magically connects your view to your controller and model, and your model to the database. You don’t need generators or specialised tools to manage this, it all just works.

3. Unlike other productive web scripting languages, Ruby is a fully featured object-oriented language. Ruby also adds additional power with mix-ins modules which contain independent code to inject into your classes, blocks and closures simplifying client code behaviour. Its dynamic nature gives it power beyond static languages such as .NET and java, and the benefits are apparent by how the Rails framework has been put together itself.

4. Unlike other web templating technologies, the templating technology built into Rails can be used to generate web pages, emails, xml documents or any text document that requires dynamic content.

5. Rails includes a well thought out object relationship mapping tool, ActiveRecord, which provides your answer to database persistence. Your model is seamlessly persisted to the database. Transactions, inheritance models, validation, and caching have all been thought out and are production ready. With Rails you become a lot closer to the structure of the database than traditional object-oriented development methodologies. This is a good thing as over time as the database will no doubt end up being your project’s most valuable asset.

6. Rails includes support for a variety of web technologies. Every web application needs email integration at some point and Rails provides an out of the box smart solution, and as with other Rails technologies it gives you the complete package down to configuration in development, test and production environments. Ruby on Rails also supports web services, the integration with Rails due to the dynamic nature of Ruby is simply, clean and seamless. If you are moving into the Web 2.0 space, Rails provides a rich abstracted interface to implementing AJAX operations.

7. Generally software projects do not mature if at all to the point of having a solid foundation to perform database migrations and rollbacks between environments and across development systems. However with the Rails framework you will be delighted with the implementation of database migrations for applying and rolling back database changes. You enter your update and rollback scripts in Ruby, Rails understands the current version and can move forwards or backwards to any database version.

8. For development productivity, the shorter the gap between the change and test cycle the better. In Rails, changes are reflexed immediately within the runtime environment so developers can quickly iterate between fix and test cycles without any expensive redeploys. Ruby code is also easily testable. Methods and objects can be replaced at runtime so software components can easily be tested without resorting to external tools or generators.

9. Getting started with Rails is easy as generators will propel you along. An experienced Rails developer will also become aware of numerous idioms available within the Rails framework that shared the amount of code a developer need write. Overall less code to write means lower complexity, higher productivity and less bugs.

10. Ruby has been around for a long time, the Rails framework which has deservedly propelled Ruby into the spotlight has hit version 1.1 and is production ready. Ruby and the Rails framework is open source and well supported by a clever team of contributors.

*So what are some of the cons?*

1. If you take time to follow the Ruby examples and tutorials it may give you a false sense of productivity. They typically follow the formula of creating a database model, configuring a connection to the database and joining it up to the model controller and view by use of the generators. This is all very simple involving a dozen or so lines of code. In the real world however you will be working at higher level of complexity and will need to understand multiple facets of Ruby and the Rails framework to be productive in churning out business functionality. You will need to invest in getting up to speed with the language and framework. As Ruby is a dynamic language, more automated testing is required. Your developers will need to become more disciplined and rigorous in creating unit tests as part of their development process.

2. As the Rails framework is not in widespread use compared to technologies such as Tomcat and ASP.NET, you may not have access to the same level of community support from various website forums and open source libraries.

3. If the type of development you are doing is glueing together existing systems or building back end systems, be aware that Rails is optimized for building web applications, your host system or enterprise database may not have the integration module you require for Ruby.

4. If your system is likely to grow to that ‘10 person, 3 year project’, there are several factors you need to consider, you may find the level of tool support lacking. Features such as find references, refactoring techniques and code-complete are still not available on the current set of IDE’s. This however is hopefully only a problem of time, RadRails a version of Eclipse built for Ruby development and is now a viable and great Ruby IDE. New features are continuously appearing from the core version of Eclipse.

After considering the pros and cons, my advice would be that if your business has tight timelines and limited IT budgets (and who doesn’t?), and a requirement for web driven database applications then I seriously suggest considering investment into the Ruby on Rails framework.

Advertisements

PHP vs Ruby

Both PHP and Ruby are scripting languages used to develop web applications. There is a little difference between these two languages.

Pitfalls of Ruby:

  1. Slower: Ruby is noticeably slower than other interpreted languages and has a lot of performance issues. Even classic, simple CRUD applications often discover somewhere down the line that there’s something enormously computationally intensive that they want to do, for example, blog software might want to add Bayesian filtering to eliminate spam from comments. This is where you suddenly realize that if your language of choice is 10 times slower than the competition, you may be simply unable to add that feature, or you may have to call out to another language.
  2. Hosting Issues: Rails applications are also more trouble to host than PHP applications. Because of the size of the Rails framework code, it has to be kept in memory all the time, not loaded in response to a request. You need 100–200 MB of dedicated RAM to host even a low-traffic Rails application. With PHP applications, in contrast, you can host hundreds of applications on a single server, because they don’t occupy any memory when they aren’t being accessed. Another result of these server requirements is that Ruby on Rails hosting tends to be more expensive than for other platforms and languages. If you’re in the Rails sweet spot, your application is significant enough that the incremental hosting cost is insignificant compared to the value you get from using Rails.
  3. Popularity: PHP is well established and is has a lot of IDE’s, frameworks, open source projects etc. Ruby is just starting to get into the mainstream and there are still some fundamental issues with Ruby and web development. For example, Ruby integration with APACHE is still not stable. It works, but there are some known problems and can be a hassle to set up. There is a large developer community for PHP than that of Ruby.

Conclusion

Ruby is a promising language, and works well for small scripts and utilities, but shouldn’t be used it large-scale applications until it is a proven technology. PHP is well established language and we see a lot of applications running successfully using PHP including many CRM’s.

We can develop the application in two different ways using PHP. We can either develop the application from scratch using Code Igniter framework, which is very much similar to Rails framework. The other way is the customization of an ecommerce product. We can select the product once we freeze the features list of the application.