Fork me on GitHub

There's a book that's pretty old now: 1995. Designing Object-Oriented C++ Applications Using the Booch Method. Prentice Hall.<tel:9780132038379|978-0132038379>. Has anyone read it? It comes up with a metric for how 'good' your software is, based on dependency relationships. Basically it is good to have domain/utils components such that all the dependency arrows point to them, and they don't point to other components. The interesting thing is this metric could be calculated for a Polylith application. If you've heard of 'afferent' and 'efferent' coupling then that's what this is about.


And the other good type of component to have is one that really uses (points to) other components, but is not used by them (think main). Bad components use and are used in equal measure. A reasonably good metric means your software is maintainable.

seancorfield02:10:56 (for folks who have not read the book). Yes, looks like Polylith could calculate those -- and the instability metric, and even the stable dependencies principle. Or a new tool could, based on the ws.edn data.


what do you do in your interface when you have a multimethod that can take zero or more args ?


Should i be doing soemthing like this ?

(defn get-gcp-token
  ([] (c/get-gcp-token))
  ([args] (c/get-gcp-token args)))


I would say you have two main options. One is to do it the way you suggest. The other option is to do it something like this (if you have a default value):

(defn get-gcp-token
  ([] (c/get-gcp-token "my-default"))
  ([args] (c/get-gcp-token args)))
If the “my-default” value is something that changes over time, I would go with your approach, because then it should be an implementation detail, but if it is something hard coded (more or less) then the second alternative is a bit simpler, because you only need one implementing function.


ah yeah good point I did not think of moving the multi method to the interface, for a lot of my usages that would likely work as its usually for defaults when not provided cheers

👍 1

Or perhaps:

(defn get-gcp-token
  [& args] (apply c/get-gcp-token args))
Although I'd want {:arglists ..} metadata there to provide more useful hints in the editor/REPL.