architecture

Jimmy Alejandro Alvarez Calderon 2022-12-01T13:04:08.054569Z

Hi, Currently I'm. woring in a feature that calculates some information about payments. The situation is that we have the calculation logic already implemented, but, we think we do no have to rely on where the information required for the calculation comes from. based on that constrain, we came up with the idea of having some sort of repository pattern where basically maps an input to a domain model without creating a coupled dependency from where the data comes from. I was investigation on how to accomplish this in clojure and came up with https://clojure.org/reference/protocols and https://clojure.org/reference/multimethods which for me it looks good with what we need. However, I would like to know what are your opinions of using this clojure feature in the community, is this commonly used?, what was your experience using it? or any tip you can provide so I can assess better my implementation shoot.

➕ 2
adi 2022-12-06T08:32:33.750359Z

> we came up with the idea of having some sort of repository pattern where basically maps an input to a domain model without creating a coupled dependency from where the data comes from Well, this is exactly the design constraint I adopted, in my take on the "Mars Rover" problem, using domain-as-data, and multimethods, and a calculator at the heart of it all... It is a small piece of code containing a bunch of design ideas that a team can review and discuss in half a day: https://www.evalapply.org/posts/clojure-mars-rover/

adi 2022-12-06T08:34:29.444849Z

@alejandro24alvarez see if it helps, as a companion post to Chas's post that Sean linked above.

Jimmy Alejandro Alvarez Calderon 2022-12-05T19:56:15.804329Z

Thank you guyss 🙌

timo 2022-12-01T13:16:42.216579Z

Both are heavily used in clojure

seancorfield 2022-12-01T18:19:16.928249Z

@alejandro24alvarez This is still a good resource for thinking about types, protocols, etc: https://cemerick.com/blog/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form.html