The real challenge is to reconceptualize your problem domain into a
non-destructive framework.
In other words, you need to transform your way of thinking from:
move function (or method) takes a Shape and destructively updates the
shape's x and y, returning void
to
move function takes a Shape and returns a new Shape with an updated x and y.

Technically, Object Oriented programming handles both approaches, but
in practice, most OO programmers tend to think of programming in terms
of breaking down problems into objects that destructively update.  So
this is really the big change for most people in how to think about
programming in Clojure.

Once you've figured out a way to work your problem into this way of
thinking, then the details of whether you use multimethods, protocols,
or just a big cond statement dispatching on type, don't matter that
much and can be easily adjusted.  A cond statement works just fine if
you don't care about having other users extend the function to new
types.  Protocols work fine if you don't care about inheritance.
Multimethods handle everything else.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to