Fork me on GitHub
#polylith
<
2022-10-04
>
Jungin Kwon15:10:40

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?

tengstrand16:10:58

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.

❤️ 1
Jungin Kwon11:10:00

Sorry for the late check. Thanks, I definitely understood. 👍

👍 1
Jungin Kwon15:10:17

Another question sheepy Is interface only used to call core functions? Then, are interface functions and core public functions always one-to-one?

seancorfield18:10:55

I'm not sure what you mean by this. What are "core functions"?

seancorfield18:10:02

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).

1
seancorfield18:10:16

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.

Jungin Kwon00:10:56

What I mean by “core functions” is the implementation nses. Thank you for answering! Completely cleared up.

1
👍 1