7 ms·
Not really a Clojure user, but I made a small API with it once and it blew my mind, especially the design patterns involved. An interesting one is the ports-and
by moon2 6y ago
Not really a Clojure user, but I made a small API with it once and it blew my mind, especially the design patterns involved. An interesting one is the ports-and-adapters (a.k.a. hexagonal architecture) [1][2] . Basically, all the business logic will be kept at a layer, and all of the functions there should be pure (i.e. they will always return the same information according to your input, and these functions won't cause side effects [3]). Then you would have layers where you can plug databases and REST handling.
And Nubank take testing really seriously. REPL and pure functions makes it very easy to use TDD.
[1] https://github.com/nubank/basic-microservice-example#ports-and-adapters-microservice https://github.com/nubank/basic-microservice-example#ports-a...
[2] http://wiki.c2.com/?PortsAndAdaptersArchitecture http://wiki.c2.com/?PortsAndAdaptersArchitecture
[3] https://practicalli.github.io/clojure/thinking-functionally/pure-functions.html https://practicalli.github.io/clojure/thinking-functionally/...