First Class Views With Hoshi

Pete Elmore has released Hoshi. "Hoshi is a library for creating real first-class HTML/XML views. So, unlike template libraries, you can take advantage of mixins, inheritance, and all the other wonderful features of Ruby's object system."

Comments

I can't find it on RubyForge currently, I think they just registered the project name and are waiting for approval.

It also appears you'll need Ruby 1.9 for Hoshi, since it's passing blocks to blocks (which is a totally rad feature btw). This library looks super cool.postmodern - November 07, 2008 21:40
GGAAARRRRRRR!petesez - November 08, 2008 00:37
It actually works under 1.8.7, so, win-win. Regarding the rubyforge thing, it is still pending. I'm sure in the wake of rubyconf, there are probably at least 9,001 gems waiting.

(By the way, the above petesez is a co-worker.)Pete (the real one) - November 08, 2008 00:41
Looks interesting. How does it compare to Erector?


Erector is a Builder-like view framework, inspired by Markaby but overcoming some of its flaws. In Erector all views are objects, not template files, which allows the full power of object-oriented programming (inheritance, modular decomposition, encapsulation) in views. See the rdoc for the Erector::Widget class to learn how to make your own widgets, and visit the project site at http://erector.rubyforge.org for more documentation.
Wayne - November 08, 2008 12:11
Why and how do my posts always seem to get edited?

Who took out the blockquote tag and my snarky "Nuff said"?

It seems weird that _I_ can't change my own posts, but they seem to get edited by others....ab5tract - November 08, 2008 19:03
@Wayne - Erector is currently Rails only.ab5tract - November 08, 2008 21:07
Ofcourse the focus is completely different but for raw HTML generation, Haml is the best.Doc Oc - November 10, 2008 15:04
There are a ton of similar libraries at this point. Naturally, I'm still most partial to the one I wrote: http://instrument.rubyforge.org/sporkmonger - November 10, 2008 15:27
The main advantage versus Markaby is that within blocks, you aren't in the builder object, you're in your class instance. So you can expect things like inheritance, mixins, instance variables, etc. to work normally.

Versus Erector, the advantage is that a class isn't limited to implementing a single view (or view component). You just call the view method (with arguments if you like) like a normal method. Ex: view.show( entry ).

Versus HAML, Hoshi is just Ruby, which makes it far more flexible, extensible, etc. You can still keep your markup quite neat. Obviously, if you want to expose templates to users, this is less attractive than HAML, but otherwise, I think the pure Ruby approach is more attractive.

Instrument (and Cell) are more component-oriented, which a very different, but also very compelling approach, IMHO.

In effect, the point of Hoshi was to deliver a pure Ruby view implementation that did not have any of the disadvantages of Markaby. I think Pete has knocked it out of the part. In short, Hoshi is the new Markaby. :) For Waves, Hoshi will be the "default" view technology.Dan Yoder - November 11, 2008 23:53
Thank you for this site.

Contact : Lidamccy - April 29, 2009 06:52

Post a Comment

Note: If you are a registered user, log in to populate these fields.

You may use ONLY these HTML tags to format your comment:
<a href="" title=""> <b> <blockquote> <code> <em> <i> <strong>
Do NOT use <p> tags. Just use newlines :-)

FROELEZETYPPE