This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-04
Channels
- # aleph (23)
- # announcements (1)
- # babashka (21)
- # beginners (70)
- # biff (3)
- # cider (8)
- # clj-kondo (45)
- # clj-yaml (9)
- # clojure (69)
- # clojure-europe (82)
- # clojure-nl (1)
- # clojure-norway (2)
- # clojurescript (34)
- # conjure (19)
- # core-typed (6)
- # cursive (2)
- # events (5)
- # fulcro (55)
- # honeysql (1)
- # integrant (18)
- # jobs (1)
- # lsp (124)
- # malli (10)
- # meander (1)
- # off-topic (26)
- # polylith (8)
- # reagent (7)
- # releases (1)
- # remote-jobs (1)
- # sci (2)
- # shadow-cljs (19)
- # squint (5)
- # vim (17)
- # xtdb (31)
I’m a bit confused about this part of https://polylith.gitbook.io/polylith/architecture/2.2.-base. > The components are accessed through their interfaces, which allow us to use different components (for the same interface) in different projects It seems that I can create 2 projects with a combination of 1 base and 2 exchangable 2 components, right? I need to reference the interface of a specific component in the base code, how is this possible? In case I misunderstood, can you give me an example to make it easier to understand?
You can take a look at the https://polylith.gitbook.io/poly/workflow/profile section of the poly
tool documentation (the code can be found https://github.com/polyfy/polylith/tree/master/examples/doc-example). In this example, we have two components (`user` and user-remote
) which both implement the same user
interface. The reason you can access the same interface from two different projects is because each project includes exactly one component that implements the user
interface. The poly
tool ensures that both components (`user` and user-remote
) implement the same set of def
/ defn
/ defmacro
statements. That's why we can say they are the same, because they conform to the same specification, even though they live in two different places/components.
Another question Is interface only used to call core functions? Then, are interface functions and core public functions always one-to-one?
I'm not sure what you mean by this. What are "core functions"?
The functions in interface
are the only ones callable from other components
/`bases`. The functions in the implementation nses can be called from the interface
or from other implementation nses within that component (at work, we have several components where the implementation is split across multiple nses).
In addition, you might have (implementation) tests that call public functions in the implementation nses, as well as (interface) tests that only call the (public) functions in the interface
.
What I mean by “core functions” is the implementation nses. Thank you for answering! Completely cleared up.