[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ruby, unittesting and lego

Simon Strandgaard

3/2/2005 10:33:00 PM

Recently I have rediscovered lego. Its very useful to build a model
of that data structure you want. When you have your physical model
then its easy to think out all kinds of senarios that data structure
possible could be used for.

Here is a picture of my lego model:
http://aeditor.rubyforge.org/data/lego_model_of_caching_...

I wanted to make a new improved syntax coloring system for my
editor, in paticular a robust caching scheme. The old caching mechanism
sometimes didn't render dirty lines, other times it didn't flag lines as
being dirty, ofthen it did too much work by rendering more lines than
necessary.... and yet other times it crashed.

My new data structure is robust and doesn't do more work than absolutely
necesary. I don't believe that I would have gotten this far without lego.

--
Simon Strandgaard


2 Answers

Brian Schröder

3/3/2005 10:10:00 AM

0

On Thu, 3 Mar 2005 07:33:10 +0900, Simon Strandgaard <neoneye@gmail.com> wrote:
> Recently I have rediscovered lego. Its very useful to build a model
> of that data structure you want. When you have your physical model
> then its easy to think out all kinds of senarios that data structure
> possible could be used for.
>
> Here is a picture of my lego model:
> http://aeditor.rubyforge.org/data/lego_model_of_caching_...
>
> I wanted to make a new improved syntax coloring system for my
> editor, in paticular a robust caching scheme. The old caching mechanism
> sometimes didn't render dirty lines, other times it didn't flag lines as
> being dirty, ofthen it did too much work by rendering more lines than
> necessary.... and yet other times it crashed.
>
> My new data structure is robust and doesn't do more work than absolutely
> necesary. I don't believe that I would have gotten this far without lego.
>
> --
> Simon Strandgaard
>
>

Hello Simon,

would you mind to elaborate a bit on how this models your caching
system? Even though the model seems quite concise and I understand
danish I just don't get how it works ;)

Regards,

Brian
--
Brian Schröder
http://ruby.brian-sch...



Simon Strandgaard

3/3/2005 10:41:00 AM

0

On Thu, 3 Mar 2005 19:10:25 +0900, Brian Schröder <ruby.brian@gmail.com> wrote:
> On Thu, 3 Mar 2005 07:33:10 +0900, Simon Strandgaard <neoneye@gmail.com> wrote:
[snip]
> > Here is a picture of my lego model:
> > http://aeditor.rubyforge.org/data/lego_model_of_caching_...
[snip]
>
> would you mind to elaborate a bit on how this models your caching
> system? Even though the model seems quite concise and I understand
> danish I just don't get how it works ;)

Its heavy to do realtime syntax coloring in an editor, so naturally one wants to
do as little work as possible. Computing syntax coloring for 50 lines takes
about 0.7 seconds on my 700 MHz box.

You can change one letter and then the editor will compute the affected line.
In case the syntax state is different to the previous syntax state then we must
propagate the change to the following line. Imagine inserting a double
quote then
the following lines gets colored differently.
When inserting/removing a few line into the buffer, then we want to
recycle as much
syntax state as possible.

Its difficult to explain. Sorry.

The lego model helped me thinking through all kinds of senarios. If I
had to draw these
senarios on paper than it would have taken forever.

--
Simon Strandgaard