|
|
AS OF 5/17/2008 3:57AM EST
|
Rails for Tactical Business Applications
By Zak Mandhro
January 1, 2007 —
Rails is a Web development framework based on the cross-platform object-oriented Ruby language. Both the language and the framework are free and open-source software.
Rails offers remarkable productivity by taking advantage of powerful Ruby features. Among these are dynamic classes and closures, and programming concepts such as meta-programming and convention over configuration, using the Model-View-Controller (MVC) design pattern and Test-Driven Development to help developers build high-quality and easy to maintain software with fewer lines of code.
Most of my Rails colleagues shy away from doing enterprise software. I dont blame them; over the years, the phrase enterprise software has amassed negative connotations such as overly complex, expensive to build, and difficult to maintain. The Rails community wants to detach itself, and enterprise software, from this legacy and take a green field approach to Web development.
Some of the Webs most popular Web sites, such as 43things, 37signals and Odeo, run on Rails, and many more are being built every day. I believe what makes Rails the preferred platform for many Web 2.0 applications also makes it an attractive option for building tactical business applications.
A tactical business application, or TBA, is a Web front end to enterprise relational databases. Unlike ERP applications and complex transactional business systems, TBAs are simple data input and automation systems that fulfill specific business needs. Information gets inputted, validated, stored in the database and reported back. Some popular platforms for TBAs include Access, Visual Basic, Visual FoxPro, PowerBuilder and Delphi, all predominantly non-Web technologies that are difficult to manage and distribute. Meanwhile, some developers have elected to use PHP and ColdFusion for such applications; these page-oriented scripting languages embed data access (SQL) and control logic into pages, leading to code that is cluttered, verbose and difficult to maintain.
By contrast, Rails uses true object-oriented code with clean separation of data access, presentation and control concerns. Unlike Java and .NET, Rails is very concise. It takes advantage of Rubys concise syntax and dynamic nature to eliminate excessive declarations, type definition and casting, XML configuration files and annotated metadata. For example, Rails injects the attributes and behavior dynamically at runtime from the database structure. A simple model with two lines of code will give you create, read, update, delete and finder behavior dynamically while staying true to object orientation and MVC principles.
Writing controllers and rendering HTML pages is just as easy. Rails injects class local variables from the controller into the pages so you dont have to think about request/response objects. Rails also comes with a very powerful template engine that lets you create layouts, page partials, portlets and other reusable visual components.
Rails bundles plenty of generators that help developers get a jump start on the project, including the ability to create skeleton TBAs with all the basic data management features. Rails also has a powerful plug-in architecture that allows the community to extend Rails, build custom generators, etc. There are plenty of excellent open-source Rails plug-ins available online that can be utilized to cut development costs. Enterprises can build in-house plug-ins to standardize on reusable components and extensions.
RAILS OUT OF THE BOX Perhaps one of the least-known facts about Rails and Ruby is that its a full-stack integrated platform with all the essential tools prepackaged to work together. Rails out-of-the-box capabilities include AJAX, automated builds, unit testing, integration testing, functional testing, logging, filtering, templating, mail processing, XML and Web services.
Open-source Ruby tools include support for continuous integration, UDDI, LDAP integration and much more. Looking forward, Rails 1.2 promises to bring best-in-class RESTful Web services support. As far as tools and IDEs are concerned, RadRails, the open-source Eclipse-based Ruby and Rails IDE (radrails.org) gives you most of what you need in a single integrated environment. Enterprise developers get the essential frameworks and tools configured and ready to be used. The JRuby project (jruby.codehaus.org) and NetBeans support for Ruby from Sun are looking quite promising as well.
Agility matters, especially for business applications. TBA development is an iterative process of defining and developing the technical solution to the business problem. The more you build, the better you understand the solution; you must adopt as you go.
RAILS AND AGILITY When it comes to agility, Rails really shines. Rails sports Test-Driven Development, a critical enabler of agile development. For example, Rails code-generators write a blank test class for every piece of generated code. Model objects get corresponding unit tests, controllers come with functional tests. Thanks to the dynamic nature and conciseness of the Ruby language, writing tests requires fewer lines of code and less time. Rails goes beyond the JUnit/NUnit-style unit tests by providing an infrastructure to do functional tests, test fixtures, mock objects and integration tests (HTTPunit style user-interface tests). Agility with Rails lowers the cost and risk associated with requirements adjustment. Enterprises can evolve and adopt TBAs to maximize business value without blowing the budget and schedule constraints.
When the Web came to the enterprise, information workers took a productivity hit. Business applications went from being rich and responsive client/server applications to rudimentary page-oriented Web applications. Thanks to the rediscovery of JavaScript and the innovation around AJAX (Asynchronous JavaScript and XML), Web applications are starting to become productive again. To get an idea of what a difference this can make, try comparing the classic Web mail services with Zimbra.
AJAX is an integral piece of the Rails framework. In fact, prototype and scriptaculous, two leading JavaScript libraries that helped popularize AJAX, are products of the Rails core team. Both libraries are tightly integrated with Rails so you dont have to write plumbing code. The same model, view and controller constructs are used, whether the application is AJAX or not.
Rails also includes a powerful mechanism for orchestrating the AJAX user experience. RJS (Ruby-JavaScript) templates allow developers to write high-level Ruby code to perform visual effects, dynamic rendering of partials, modifying HTML objects, and so on without writing any JavaScript. With Rails simple yet powerful AJAX-capabilities, enterprises can enjoy centralized deployment and richer cross-browser business applications without increasing cost and complexity. Richer business applications will enable information workers to be more productive with their day-to-day tasks.
Ruby on Rails is a powerful Web development framework that offers remarkable developer productivity without compromising software design. It is a full-stack platform with all the essential features that enterprise developers are accustomed to. Rails enables and promotes agile software development by making it easy to write testable software and automated tests, thereby allowing business applications to evolve and adopt to best meet the business needs. It also makes it easy to build rich user interfaces with intrinsic AJAX capabilities to improve information worker productivity. Although some enterprise integration components are in development stages, such as support for UDDI and concatenated keys, Rails and Ruby have all the building blocks necessary to build robust business applications.
For enterprises looking to improve software development efficiency and develop richer tactical business applications, I strongly recommend evaluating Ruby on Rails. Head over to rubyonrails.com and experience it for yourself.
Zak Mandhro is a technical architect and senior manager at BearingPoint, a global consulting company, and is project lead for the ROXML and UDDI4R open-source Ruby projects.


|