Monday, January 31, 2011

the power of paper -

less is sometimes more. Whenever I get stuck with a programming issues. I tend to leave the office, find a coffee store and a bunch of paper. And start drawing the problem to get to the mathematical solution first instead of keep trying to work on the algorithm.

What does this mean to be precise?

I spend the last 2 days, writing hierarchical and tree layout algorithm in javascript (don't ask why...) and for the love of it could not avoid the collisions I keep getting.
So I went to mishkas and 20 minutes later I had a single elegant formula to describe the relation of parent and child elements on the horizontal axis in my tree, without any collisions so far.

now I just have to adapt this formula to work with complex graphs, but the implementation took all of 5 minutes and the result is:

terrific! Sometimes less really is more.

No comments: