Fork me on GitHub

Does the polylith architecture disregard the use of protocols/clojure’s “OOP” features (as some like to call it)? I’ve yet to seen a polylith code base using a protocol due to the component/interface.clj abstraction, a possible side effect which I would like to not happen is having to rely on with-redefs for some “mechanical” things


@jarvinenemil I guess one advantage of using pure function delegation over protocols, is that you don’t need an object instance to dispatch by type. And I would imagine you can avoid the with-redefs issue by having a stub/test version of the component you wanted to redefine (for testing, I assume)? So you’d control it by having tests depend on that version of a component instead of the regular implementation?


This is a work-in-progress but…

(! 698)-> clojure -X:new :template polylith :name seancorfield/polyex
Generating a project called polyex based on the 'polylith' template.
(! 699)-> (cd polyex ; clojure -M:poly info )
  stable since: 51f2955

  projects: 2   interfaces: 1
  bases:    1   components: 1

  project      alias   source
  polyex       polyex   ---  
  development  dev      x--  

  interface  brick     polyex   dev
  ------------------   ------   ---
  greeter    greeter    x--     xx-
  -          cli        x--     xx-
(! 700)-> (cd polyex/projects/polyex/ ; clojure -X:uberjar )
[main] INFO hf.depstar.uberjar - Compiling seancorfield.polyex.cli.main ...
[main] INFO hf.depstar.uberjar - Building uber jar: polyex.jar
[main] INFO hf.depstar.uberjar - Processing pom.xml for {net.clojars.seancorfield/polyex {:mvn/version "0.1.0-SNAPSHOT"}}
(! 701)-> java -jar polyex/projects/polyex/polyex.jar 
Hello, World!
(! 702)-> java -jar polyex/projects/polyex/polyex.jar Lisa
Hello, Lisa!
It uses depstar instead of uberdeps (because I think depstar is better 🙂 ). The tests aren’t set up properly yet and the README template etc needs to be cleaned up but…

❤️ 9

Yes, we also think that depstarsolves the problem in a better way, so we plan to update the examples to use that instead!


It’s setting things up per the issue-66 branch so I won’t release it until Polylith gets a new official release with that stuff in it.


Sounds great!