Hello! I am writing a guide for experienced Java enterprise developers that are used to solving particular enterprisy problems in particular ways to understand how they would do that in Clojure, the premise being that there is no 1:1 mapping because in Clojure we do stuff differently (and have better tools :-)).
I have two questions:
- Can you think of other important concerns than the ones I mention below?
- Would you address a concern differently from what I propose? If so, how?
You can of course read the whole post: Translating an enterprise Spring webapp to Clojure but perhaps it suffices for further discussion to repeat here the summary table:
|Code structure||controller/, <domain>/, …||Evolve as needed|
|Architecture||3-tiered: web, services, integration||Similar but evolved as needed + Functional Core, Imperative Shell|
||Typically not needed; use namespace-local “singletons” or pass around in a context object|
||Typically not needed; wrap with higher-order functions/macros. Use
||Be explicit. Wrap with higher-order functions/macros.|
|Logging||Logger in each class, XML/code config.||Same, use the
|Request tracking||ThreadLocal to store, AOP/Filter to set||ThreadLocal or a context attribute to store, Ring middleware or a HoF to set|
|Resource pooling||Inject the configured pool via IoC||See IoC above|
|Request decoration||Servlet Filters||Ring middleware|
|Testing||Mocks FTW!||Call pure functions as-is. Set a namespace singleton/pass context attribute for the Imperative Shell|
(I will also go through the projects listed at Example "enterprise" Clojure (web) app? to find more concerns and solutions.)