On Fri, Jan 9, 2009 at 7:55 AM, Tom Ayerst <tom.aye...@gmail.com> wrote:
> 2009/1/8 Mark Volkmann <r.mark.volkm...@gmail.com>
>>
>> On Thu, Jan 8, 2009 at 11:05 AM, Tom Ayerst <tom.aye...@gmail.com> wrote:
>> > The point, for me, is that Mark Engelberg's construct allowed the system
>> > to
>> > work with no mutation
>>
>> I don't yet see how that is possible.
>
> We agree then.
>
>>
>> ...
>>
>> Can you explain in more detail the issues you see with the current code?
>>
>> > Given that, and the problems with to threads accessing the Swing layer,
>> > I
>> > think living in the EDT makes the most sense.  For example the
>> > "everything
>> > in the EDT" approach takes advantage of Swing's painting features and
>> > deals
>> > with multiple events
>
> See above.
>
>> I don't remember now who suggested it, but an earlier critique of my
>> code encouraged me to do as much processing as possible off the EDT.
>
> This is one of those 'it depends' questions.  You can safely do everything
> in the EDT in Swing, it will just be very sluggish (and freeze occasionally)
> if you have long running actions on events.  So it is good practice to spin
> off workers in separate threads for anything that will take a while.
> Nothing in the snake app falls into that category.  Also; if you are spining
> off additional threads they must use invokeLater to safely rejoin the EDT
> for displaying updates.

As a newbie looking for good example coding styles - I'd definitely
prefer if this were coded for the "normal" case, rather than made
special for the "no long running actions" case.

I really appreciate this code, by the way.  One of my biggest barriers
to using Clojure is the terseness of the examples - stuff like
http://clojure.org/agents#toc , while nice and concise, is quite
off-putting for people used to more readable coding styles.

- Korny
>
>>
>> > while cleanly painting the board; the two thread
>> > approach flickers terribly when the snake is short.
>>
>> I could be wrong, but I don't think that flicker is related to my
>> choice of doing the painting off the EDT. I think it's just a matter
>> of the relatively large cell size.
>
> I use the same cell sizes on a derivative of Stuart's version and that does
> not flicker.
>
> Cheers
>
> Tom
>
>
> >
>



-- 
Kornelis Sietsma  korny at my surname dot com
kornys at gmail dot com on google chat -- kornys on skype
"Every jumbled pile of person has a thinking part
that wonders what the part that isn't thinking
isn't thinking of"

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to