On Mon, Dec 29, 2008 at 2:24 PM, Brian Doyle <brianpdo...@gmail.com> wrote: > Looking at this code the uppercase variables stands out. > This isn't idiomatic is it? > > (def GRID_SIZE 10) > (def HEIGHT 600) > (def MARGIN 50)
I don't know. I was following Java conventions of making constants all uppercase. Is there a convention for this in Clojure? Is there a way I could prevent them from being changed later? Maybe I should make them be map entries where the keys are keywords and the values are the integers. That seems extreme though. > On Mon, Dec 29, 2008 at 12:19 PM, Mark Volkmann <r.mark.volkm...@gmail.com> > wrote: >> >> On Mon, Dec 29, 2008 at 11:11 AM, lpetit <laurent.pe...@gmail.com> wrote: >> > >> > You should consider using docstrings for documenting functions >> >> Good suggestion. I've changed my code to do that. I also noticed that >> I had forgotten to replace special characters with built-in entities >> in my HTML, so that is fixed now. The new version is at >> http://www.ociweb.com/mark/programming/ClojureSnake.html. What else >> would you do different in this code? Do you think it still contains >> too many comments? >> >> > On 29 déc, 16:45, "Mark Volkmann" <r.mark.volkm...@gmail.com> wrote: >> >> On Mon, Dec 29, 2008 at 5:44 AM, Mark Volkmann >> >> >> >> >> >> >> >> <r.mark.volkm...@gmail.com> wrote: >> >> > I would like to produce a version of the snake code that could serve >> >> > as an example of the kind of code that the Clojure community thinks >> >> > is >> >> > "good". Unless it's part of an exercise to produce the shortest code >> >> > possible, I think we should always write Clojure code with a goal of >> >> > making it as easy as possible for others to read, while not >> >> > attempting >> >> > to serve as a Clojure tutorial. Again, my goal here is to get more >> >> > developers to give Clojure a shot. >> >> >> >> > My challenge to everyone on the list is to start with any version of >> >> > the snake code you've seen and make it as readable as *you* think it >> >> > should be by doing things like renaming variables and functions, >> >> > adding comments and changing indentation. I'd really like to see what >> >> > *you* think is the best way to write this code. The lessons learned >> >> > from this exercise could then be applied to other code we write in >> >> > the >> >> > future. >> >> >> >> Okay, I took the challenge and produced a modified version of my >> >> earlier code where I removed what I considered to be redundant >> >> comments and did a little more renaming. You can see it >> >> athttp://www.ociweb.com/mark/programming/ClojureSnake.html. Feedback is >> >> welcomed! >> >> >> >> I also started documenting some Clojure coding guidelines aimed at >> >> making code more readable >> >> athttp://www.ociweb.com/mark/programming/ClojureCodingGuidelines.html >> >> and would appreciate feedback on these. I expect there will be cases >> >> where not following these is justified, which is why I refer to them >> >> as guidelines instead of rules. >> >> >> >> -- >> >> R. Mark Volkmann >> >> Object Computing, Inc. >> > > >> > >> >> >> >> -- >> R. Mark Volkmann >> Object Computing, Inc. >> >> > > > > > -- 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 -~----------~----~----~----~------~----~------~--~---