2011/8/7 Sebastián Galkin <paras...@gmail.com> > (-> car :wheels first :tire :pressure) > > This probably lacks abstraction, calling code needs to know every details > about how to get the pressure starting from a car model. If at some point > you decide to change your implementation and turn :wheels into a map instead > of a list/vector, your code is broken. >
I think this is a bit of a straw man: if you want the pressure of a tire, you have to know how to describe which wheel/tire you want out of the four (or more) on a vehicle. Whatever model you decide for that has an API and that API has to be public to be useful and therefore code will come to depend on it. Complaining that you can't "change your implementation" in this case is really complaining that you can't change the _API_. If you use keywords, you can always choose to modify the model to implement ILookup so you have control over what (:key model) does - including supporting keyword name changes etc. If you use a vector, I guess it's a bit harder to swap it out depending on what API you really use on it. -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ "Perfection is the enemy of the good." -- Gustave Flaubert, French realist novelist (1821-1880) -- 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