JavaServer Pages has been in the web developer arsenal for several years, but “Ruby on Rails” author Bruce Tate thinks Ruby may offer a better approach to web page development.
Java has been good to web developers over the past few years. Through the use of the Servlet API released by Sun, developers could include Java code in JavaServer Pages. Dynamic web pages for sites like catalog retailers flourished.
I worked on one of those for a few years, mostly as a system administrator. My introduction to Solaris came by way of the IT department’s VP, who suggested I use my next three weeks to learn how to admin Solaris 2.6.
My skills on the web side were mostly HTML and Perl. I learned enough about JSP and Servlets to help developers debug those on occasion, and alter existing ones to do new things. Thankfully, Vim was up to the challenge. (Aside to people who get to use Eclipse these days: I’m not jealous of you. Really.)
Author Bruce Tate and Ruby on Rails have grown into what looks like the next best thing when it comes to a framework for developing web applications. Tate discussed this in his article on dynamically typed languages, on IBM’s developerWorks website.
“Ruby templates rely on simple capabilities in the language to provide a simple but effective approach for Web page development,” said Tate. “You can rapidly understand Ruby templates by grasping a few layered concepts, with each layer more powerful than the last.”
Every template starts with a string, which is a first-class object in Ruby. Tate noted that data does not pass through a string enclosed by single quotes. With double quotes, Ruby does the substitution pass through the string, as Tate showed in a basic newline character example.
From there the developer can move on to simple variable substitutions, and crafting simple templates. “The ability to include simple coding structures, such as looping for tables with dynamic data, forms the backbone of most dynamic Web pages,” said Tate.
Filters on the web server process the Ruby files and turn embedded code into useful output, similar to the way JSP is handled by an application server of choice. The filter can be plugged into an Apache server installation, and used to invoke Ruby web pages.
A solid community of Ruby on Rails users can help developers learn more about using Ruby for web applications, and details about Ruby the language may be found online.
—
Tag:
Add to Del.icio.us | Digg | Yahoo! My Web | Furl
David Utter is a staff writer for murdok covering technology and business.