On 18 dec, 17:55, IslandRick <rick.braumoel...@gmail.com> wrote: > Can anyone here offer some advice to those who are too ingrained in > using an object-oriented hammer on every nail they see? I know Rich > and Stuart have some good design examples around (I've read many), but > if there are any tutorials that show how to re-envision OO problems in > an FP world, I'd love to see them.
You are probably running into two problems at the same time: 1 is the expectation that you can modify stuff left and right 2. is the "dispatch" issue In my (short) experience with clojure, the main problem is actually #1. In most relatively simple programs in clojure you actually don't need all that much dynamic dispatching, and if you really do need it there's always multi-methods. When you're working in clojure and want to keep the code simple, it's vital that you think about what parts of the shared data can actually change, and try to keep those parts minimal, and keep the inter- changeable parts as unrelated as possible. That tends to mean you probably prefer not to set up a big graph of inter-related objects if you can help it - while that is something that's common in OO programming. Rich's ant colony example is a good demonstration of that principle: instead of having ant objects that "carry around" all kinds of state, you have a static grid of mutable locations and the ants are immutable objects "contained" in the grid's cells. Hope that helps, If you've got more specific questions about your program, people here can probably help you in more detail. Cheers, Joost Diepenmaat. -- 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 Note that posts from new members are moderated - please be patient with your first post. 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