This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-28
Channels
- # announcements (2)
- # babashka (15)
- # beginners (13)
- # chlorine-clover (17)
- # cider (14)
- # clj-kondo (1)
- # cljfx (3)
- # clojure (21)
- # clojure-australia (2)
- # clojure-europe (3)
- # clojure-nl (4)
- # clojurescript (25)
- # core-async (7)
- # cursive (8)
- # datomic (4)
- # defnpodcast (17)
- # events (1)
- # honeysql (5)
- # jobs-discuss (18)
- # pathom (8)
- # polylith (6)
- # reagent (2)
- # reveal (1)
- # shadow-cljs (2)
- # spacemacs (12)
- # tools-deps (13)
- # xtdb (2)
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…Yes, we also think that depstar
solves 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!