On Mon, Jan 5, 2009 at 2:54 PM, Stuart Halloway <stuart.hallo...@gmail.com> wrote: > > Since there has been so much back-and-forth about the Clojure snake, I > decided to write one [1]. Like Mark, my goal is to create a readable > version, but the details are quite different. > > I plan to use this as the code example for the Swing section in the > book. Feedback welcome. > > Stuart > > [1] > http://github.com/stuarthalloway/programming-clojure/tree/master/examples/snake.clj
The #1 lesson I learned from this exercise is that the "extract method" refactoring pattern is your friend. I think it made a world of difference in making the code more readable. I see you didn't override getPreferredSize in your JPanel proxy and instead call setSize on the JFrame. When I did that I found that the size included the JFrame title bar. That meant that the usable area wasn't as tall as what I wanted. That's why I decided to size the panel instead and then pack the frame. I'm curious why you decided not to surround the names of constants with asterisks. I see you did use asterisks around snake and apple. I'm still confused about whether there's a convention for that. Why did you decide not to use structmaps for the snake and the apple? -- R. Mark Volkmann Object Computing, Inc. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---