Per some recommendations on clojurians #clojure channel:

- namespaced keys and addition over destruction
- generally keep your data as flat as possible
- finicky nested over "organized" data models are magnets for repeated 
restructures into a new "better, more organized" structure


On Monday, July 10, 2017 at 2:39:25 PM UTC-4, Luke Horton wrote:
>
> This is probably not clojure specific, but it’s a problem for which i’ve 
> never really found a satisfying in other languages. Maybe clojure has a 
> better opinion on the matter?
>
> How does one evolve/change data (entities) in a system over time without 
> also having to change every piece that touches that data?
>
> e.g. if I had an entity “foo”:
> {:a 'a
>  :b 'b
>  :c {:d 'd}}
>
> and I wrote a nice `clojure.spec` for that foo entity, and maybe 
> formalized it into a record, anything that needed the data could read 
> straight from built in functions:
>
> (get/get-in/... keyword)
>
> I could move one step more formal and write “accessors” for compound data, 
> i.e. 
>
> (defn get-a-compound [foo] (str (:a foo) (:b foo) (get-in foo [:c :d])
>
> Now at some point I have to change my entity because a business 
> requirement changed, or the domain model wasn’t correct the first time. 
> Must now everything that touches foo and follows the clojure.spec 
> "contract" of the data shape change?
>
> What’s the idiomatic clojure way to handle this? Is it a solved problem, 
> or is this just a reality that everyone must suffer? 
>
> Do I write "getters" for every little piece and lose the :keyword function 
> accessibility? This seems like data hiding, and smells bad. 
> Do I leave the raw data alone, and write compound getters? How do 
> protocols fit into this?
>
> In short: how does one prevent the shape of the data from bleeding into 
> the system such that you can evolve your data over time?
>
> Any opinions, references, or discussion would be much appreciated.
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to