On Mon, Jun 18, 2012 at 3:37 PM, Kurt Harriger <kurtharri...@gmail.com>wrote:

>
> Representations are values in Clojure, they are not mixed with behaviors
> like in mainstream OO. It follows that, if your representation need to
> change, you can write a converter function (or two if you want to convert
> from and to the old representation), that's easy, easier than writing an
> adapter class in Java because the adapter class must implement new
> behaviors on top of old ones (or the other way round).
>
>
> Isnt that just creating an api? Everywhere the old model exists you need
> to call a function to create the desired data structure and this adds
> another layer of complexity that needs maintained.  Not all conversions are
> straight forward, may require additional context of whatever introducing
> the need for deferred computation.
>


It is creating a new API (as data). To me this discussion is about managing
(API) change.
Data as API won't solve all problems but it's easier to version/write/test
compatibility layer for data than functions (methods) as API.

When you start to refactor your data, you are effectively introducing a
change in API and converters help you delimit the boundaries of the
refactored module so that your changes don't ripple through the whole
application. Inside: new format, outside old format.

Each module can even have its own specialized data representation
(optimized for its needs) and convert from and to a more "canonical"
representation. This allows for more decoupling between modules.
In this perspective functional accessors which you are advocating are
micro-managing API changes at the field level: you expect your code (and
thus algorithms) to stay the same no matter how the data is represented,
while specialized representations would allow for better algorithms.

Christophe

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