News for hackers. Stuff that matters.
Re:Thank you, Rails by tptacek on Friday November 06, 2009 @01:28AM (#925573)
The Rails Javascript helpers are a huge blind alley, and something that should have been jettisoned a while ago --- as is RJS.

I got addicted to Sinatra because it pretty much begged me to try Haml + jQ --- which is an amazing combination --- and we recently ported all our Erb's to Haml in our Rails app as well.

I think it's a major design mistake to hide or abstract Javascript now that jQuery has pretty much won the JS framework war.

Re:Thank you, Rails by marknutter on Friday November 06, 2009 @09:54AM (#926041)
I also stopped using RJS once I switched to JQuery. I however haven't moved to HAML just yet. Something makes me nervous about not working with raw HTML (especially with all the non-rails front-end development work I do). Why is HAML + JQ an amazing combination and am I really missing out on something here?
Re:Thank you, Rails by tptacek on Friday November 06, 2009 @12:42PM (#926461)
Because most of the day-to-day things you do in jQuery involve doing something special with an element by id or class, and Haml's syntax for special classes and id's is painless. For instance:

  %a.post_link.confirm_link.destructive_link{link_to(@x)}  
    Hi mom
I'm probably not selling it very well. But basically, you know the old DOM tutorials that talk about how you can do you own tags like:

  <box name="foo">
    <item number="1" />
    <item number="2" />
  </box>
and then convert it to

  <div class="box" id="foo">
    <div clas="item" id="item_1" />
    <div clas="item" id="item_2" />
  </div>
or whatever; in Haml, that's just:

  .box#foo
    .item#item_1
    .item#item_2
Re:Thank you, Rails by marknutter on Friday November 06, 2009 @02:28PM (#926706)
In some ways I can really see the readability gains - haml is very succinct and neat. But there's a cost involved, namely getting my eyes and brain to comfortably recognize new syntax and patterns, something that for me usually takes a long time.

I also worry about creating something in HAML and having people not familiar with it not be able to dive into the project and start working right away. I'm actually on the other side of that scenario right now and it's a pain.

But I do have to admit, it's a very pleasing syntax.

Re:Thank you, Rails by tptacek on Friday November 06, 2009 @02:50PM (#926775)
It's not even readability that makes it a win; it's that the combination of jQ and Haml is like working in a markup language that has native support for every widget or UI flourish you could want.
Re:Thank you, Rails by marknutter on Friday November 06, 2009 @04:51PM (#927022)
Very intriguing. Hmm.
Re:Thank you, Rails by jshen on Friday November 06, 2009 @12:19PM (#926408)
they have a very similar syntax, and haml reduces line noise of plain html.