This shows what treemaps are:
http://blog.tupleshop.com/2006/7/27/treemap-on-rails
This gives the background:
http://www.win.tue.nl/~vanwijk/stm.pdf
And this is the Ruby implementation:
http://rubyforge.org/projects/rubytreemap/
There's not a lot of code but it's heavily object-oriented and
destructive.
How do we translate it to Erlang?
As a bonus, I'll do a Nitrogen demo showing a treemap of Flickr
photos, once we have a working implementation.
What do you think?
> Where should our solutions go?
Paste them here until we have a code review tool.
Alternatively, set up a GitHub repo and post the link.
> This Padawan started, but found that he is too weak in the Erlang
> for this
> exercise. Maybe you can have some baby-steps exercises sometimes for
> us
> beginners. (Sort of like those puzzles that go in the comics
> sections of the
> newspapers! :-) )
I would suggest modeling objects as processes initially. The process
would hold the object fields in its internal state and accept requests
to fetch and modify the field values. Create an object by creating a
process.
You can also implement the clone message by having your object
duplicate its current state (easy in Erlang) and launch a new process
with that state.
Does this help?
> So is the objective to entirely transliterate the Ruby code into
> Erlang
> code? Or to implement a minimal treemapping algorithm in Erlang ala
> Ben
> Schneiderman (who happened to be one of my professors at the
> University of
> Maryland a quarter of a century ago)?
Implement a squarified treemapping algorithm to display beautiful
Flickr photos in an irregular grid (treemap). I just found the Ruby
implementation to be the easiest to grasp.
The pseudocode is given in the paper but, I'll be honest, I don't know
how to implement the row layout :-).
On Dec 7, 2008, at 4:03 PM, Eli Liang wrote:
> BTW, is there a better cheat-sheet to Ruby than this
> http://refcardz.dzone.com/refcardz/essential-ruby for those who have
> never
> read/written any Ruby before?
On Dec 7, 2008, at 9:33 PM, Eli Liang wrote:
> OK. I've read the paper. But I'm a weak on Flickr, since I never use
> it,
> although my wife has. I assume that Flickr holds photos of an
> arbitrary
> rectangular size, scaling as needed to fit each photo within it's own
> display constraints.
Thank you for your in-depth explanation. Perhaps my use of Flickr was
misguided but I still think the algorithm could be useful for other
things, e.g. visualizing disk space or code coverage.
If the exercise is not as fun as I thought (not many takers, huh?)
then let's move on to something else!
> Since I've spent time reading the paper, I'm going to try to
> implement it
> (or at least the algorithm itself) in Erlang. (This is where my
> programming
> ineptness will show!)
Don't worry, it's a rough draft that we'll improve on!