Can you give an example of how your data structure changes?

Getters and setters are only a problem when they come baked into your
datastructure, as the only way to access the contents.

If you require more custom getting/setting logic than the built-in
datastructures provide, you can always just write a function that does
something more complex, and pass the datastructure in as an argument.

Its useful to realize that in datastructures, complexity bubbles up,
and thus having simpler components makes your problem go away.

If your datastructure contains a bunch of components that themselves
have their own setters and getters, your datastructure needs to define
yet another pair of setters and getters because you need to abstract
away the variations in your components.

If the components all all just clojure maps, sets, and vectors, then
you don't have this problem of needing to account for all this
variation.


On Wed, May 2, 2012 at 10:03 AM, Mark <markaddle...@gmail.com> wrote:
> I've read in some recent posts that Clorujians prefer data to APIs.  I'm not
> sure I understand what this means, in practice.  When I'm in the early
> stages of developing an application, the data structures undergo a great
> deal of change.  One of the ways, I isolate parts of the code from these
> sorts of changes is by writing accessor functions.  Maybe this is OO
> thinking but it seems to me a wise application of DRY.
>
> Would these accessor functions be considered an API?  If so, why should I
> prefer accessing the raw data structure?  If not, what is constitutes an
> API?
>
> --
> 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

-- 
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

Reply via email to