HAML Brings Seaside To Ruby
gilesbowkett.blogspot.com
gilesbowkett.blogspot.com
I second that. I used Sinatra and HAML when I wrote Feedstomper.com and the whole thing just felt lighter and more fun than some Rails apps I've written (when I was also using erb).
Granted, the whole concept was lighter than those apps, but still -- I like HAML.
One issue: sometimes you can stumble over javascript: http://b.lesseverything.com/2008/2/19/haml-doesn-t-like-java...
Oh, and if you're interested in Sinatra (and why not, while we're waiting on Mrailerbs), you can learn it from just this page:
Reading through the comments, though, :javascript was developed specifically in response to that post - it wraps everything indented in script tags, and does the right thing with special characters/etc.
The More You Know
But apart from continuations seaside also provides system to abstract out HTML generation, that not only changes syntax of HTML but also has support for building page from tree of prepared components (like you would construct desktop application). And this HAML thing only seems to change syntax of HTML and not add any similar capability, so comparing it to Seaside probably is misguided.
I think the real point wasn't even that Seaside's HTML generation is smart/powerful/fun. It's this:
I enjoy programming in Seaside because when I'm programming in Seaside, I'm programming. I'm not wrestling with markup; that's for computers to do. I get the same pleasure out of using HAML.
Anecdotal counterpoint:
I'm one of those who has the opposite experience with Haml. It's a constant fight. OTOH, XML/HTML is stupid easy; my editor takes care of the annoying parts, and I never fight with cryptic errors. It's easy to cut-n-paste for assorted sources, and use WYSIWYG editors if and when I want to.
I think I could live with Haml (I'm sort of compelled to deal with it since I took over an abandoned Rails project) if it did not use significant indentation. It works ok for small chunks of text, utter pain when there's much nesting going on.
The application of the description "terse" is quite on the money. It's not a feature.
xml.form {
xml.label "zipcode"
xml.input :type => 'text', :name => "zipcode'
xml.input :type => 'submit'
}I wanted to hate it. I don't like significant whitespace at all and so dismissed Haml at first as not something I would ever look at. Enough people told me it was awesome that I had to try it for 10 minutes, and it really grew on me.
Like Sinatra, it's just fun. They pair really well together.
I'm sorry. I really think it is legitimate to dismiss Haml out of hand. The ideal framework writes everything for me but the html. If there is one think about the web that works, it is html. HTML is the first markup language used widely by non-programmers. You can come up with whatever argument you want for its undesirability but its like trying to fight the need for a qwerty keyboard in a PDA.
Not only is Html a great, proven, standard language for representing rich text on a page, it is a language that even your customers can understand (not to mention your web designer..). I'm sure someone once came out with a great, non-ascii word processor...
When you have a language who's syntax is directly capable of representing that structure natively, it's a huge programmatic boon to simply write the markup directly in the host language.
In Seaside for example, since HTML is written in Smalltalk directly, I can use all of Smalltalk's automated refactoring tools on it, extracting methods, renaming things, pushing methods up and down the class hierarchy, etc. You can slice and dice pages in a way not possible with text files.
This is a huge advantage over raw HTML templates for the programmer. Seaside firmly insists that the programmer, not the designer, should be generating the proper markup; the designer has CSS. If this fits your work style, or if you're both the designer and the programmer, this style will benefit you and is much more enjoyable that raw HTML.
IFF the other people you have to collaborate with, such as designers, artists, new programmers, etc... are all fluent in that language. That's a big 'if' in my opinion. I can hand someone a Rails template file, and they can hack at it even if they don't know Ruby.
A better way of thinking about it would be simply an alternative syntax for HTML, eliminating most of the tag soup that's inherent in HTML + ERB.
If you abstract it the idea will come.
Having said that, I think Seaside is headed the way of the dodo as javascript clients become easier and more powerful.
Instead of bringing seaside to ruby, can we bring a merb-like framework in smalltalk? seaside's continuations are very cool. But I do not need them for most interactions, just the more complex ones.