Common problems with Clojure multi-methods and protocols?
I am asking this question as I am starting to really use multimethods and protocols alot, but in doing so I'm also wondering if I'm making my code too un-maintainable. For example in the good old (or bad old :) OO days I would know where to f开发者_如何学编程ind everything related to a particulat type, which would mean that all interfaces and methods would be in the same source file, but now they can be spread out all over the place. Any experiences on this?
It is true that everything can be scattered in different places if you are not forced to organize code in certain ways, like Java forces you.
It's completly up to you as a developer to organize code in logical units so it could be easier to find them and keep in mind that With great power comes great responsibility
.
The more you work in functional style, you'll find better ways to organize your code, the key is that you are not afraid of refactoring. Besides M-.
in Emacs/Slime will bring you to the definition of symbol wherever you are. I suppose other Clojure IDE plugins have a similar feature.
精彩评论