When I first learned about Ruby and Ruby on Rails, I quickly went through some sample code and looked at the syntax of the code. I must be honest and confess that the Ruby syntax was not what I was expecting, or used to. Coming from a strictly Java and PHP world, the lax syntax of Ruby was a big turn off to me. No curly braces? No semi-colons? What on earth is going on here?!?!
Well, I just needed to step out of my habit. I still haven't had much experience with Ruby, but I have come to accept the syntax and learn to work with it. I understand that Ruby allows you to use curley's and semi-colons, but when there is no strict structure enforced, you get different developers writing in different styles, and that get pretty ugly.
The next thing I looked at was how Rails handled its view in the Model-View-Controller paradigm. Being a front-end developer, the View is very important to me. When I first got involved with JSP's, I hated how developers would put scriptlets all over the html page and mix the logic in with the presentation. The same problems occured in PHP. Now here was a brand new framework on a relatively young language, and yet it seems like the same problems exist on Rails. Rails (and Ruby) use the same scriptlet syntax as asp, php, jsp, etc. To embed some logic or code into your html, you use < %= %> to print out a value and < % %> to process other Ruby code. To the defense of Rails, there isn't much "logic" within the html templates, but the scriptlet tags are still there and some reason it just bothers me.
Instead of complaining, I decided to see if there were any Ruby templating engines out there. I was glad to find quiet a few. Some good ones and some not so good. I found a nice listing of the more popular ones on this page:
http://www.rubygarden.org/ruby?HtmlTemplates
I haven't had the chance to delve into each one in detail, but from what I've read and the tutorials I've seen, my favorite ones are:
- Xtemplate http://xtemplate.sourceforge.net/index.html
- Amrita2 http://amrita2.rubyforge.org
- Iowa http://enigo.com/projects/iowa/index.html
- Kwartz http://www.kuwata-lab.com/kwartz/index.html
When I have a better understanding of each one, maybe I will create a comparison chart and discuss their advantages and disadvantages.