Re: (:key map) lookup vs accessor functions in large applications

2011-08-08 Thread Tyler Perkins
Renaming accessor functions has the benefit of help from the compiler, which will tell me if the function is not defined so I can easily change the client code to use new name. I think you could just define vars that evaluate to keywords. Adopting the convention as follows gives protection

Re: (:key map) lookup vs accessor functions in large applications

2011-08-07 Thread Stuart Sierra
Hi Martin, It's definitely a concern, keeping track of map keys and finding mis-typed names. I always use keywords instead of accessor functions, though. If there were functions, it's just one more thing to rename when refactoring. Pre/post conditions are your friend here. Write a validator

Re: (:key map) lookup vs accessor functions in large applications

2011-08-07 Thread Sebastián Galkin
I have suffered the exact same problem in large projects. Clojure's associative style is extremely powerful and simple, together with powerful sequence handling functions you could hurt yourself. The fact that it's really easy to put together nested maps to represent your models, shouldn't be

Re: (:key map) lookup vs accessor functions in large applications

2011-08-07 Thread Sean Corfield
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

(:key map) lookup vs accessor functions in large applications

2011-08-06 Thread Martin Jul
Having evolved domain models in large Clojure projects over a long time, I've been going back and forth on maps contra accessor functions to opaque objects and I do see some merit in the latter even though they are not idiomatic Clojure. Basically, the crucial point for me is how well they work