Fork me on GitHub
#polylith
<
2023-09-13
>
jasonjckn02:09:00

The interface files should typically be identical for each respective implementing component , are people symlink them, i’ve been putting them in /interfaces/top.if-name.interface.clj and symlinking

tengstrand03:09:15

That sounds like a bad idea. In around 95 cases out of 100 or more, you will only have one implementation of each interface, and they will live in their own components. In the case you have more than one implementation, the interfaces will delegate to different implementations within each component, so sharing interface implementation will not work anyway and I don't see the value. My advice is that you stick with the convention for some months before you change things that already work well.

jasonjckn03:09:04

makes sense

seancorfield03:09:10

Can I say "stop fighting Polylith" again @U0J3J79FE?😁

👍 1
😂 1
jasonjckn03:09:11

you can , i honestly thought people were symlinking

seancorfield03:09:39

I just checked and our interfaces are not identical across two of the three "swappable components" we have. I suspect the identical one was created in a hurry from its sibling since I needed it to fix a build/deploy bug (I blogged about this). If I revisit that one, I'll probably make changes to docstrings and some of the delegation to make it less copy-pasta and more correct.

👍 1
seancorfield03:09:55

Here's the smaller of those two differences:

<   "Record a client failure -- if we've had 'too many', then 'restart' the
<   client by creating a new Hato client and resetting the failure count."
---
>   "Record a client failure -- this is a no-op for the legacy client."
16c15
<   (impl/client-failed restartable msg))
---
>   nil)

👍 1
jasonjckn03:09:42

yah it’s mostly the documentation duplication that i was after

jasonjckn03:09:04

also this is probably unrepresentative but so far o have 3 different implementations of components

jasonjckn03:09:10

so it’s triple duped

jasonjckn03:09:14

hence the question

seancorfield03:09:18

The other diff is 120 lines, but it's mainly because it's meant to be a cut-down implementation of an internationalization component, intended to be used locally without a database, so quite a few interface fns have (assert false "This should not be called.") instead of (impl/whatever args)

seancorfield03:09:25

We have 148 components and only 3 of those have multiple implementations. We did have a 4th but made other changes so it was no longer necessary.

👍 1
seancorfield03:09:59

And you have 3 impls of each of your components??

jasonjckn03:09:25

5 components, 2 interfaces so far

jasonjckn03:09:36

but i’m choosing most problematic stuff first to migrate

jasonjckn03:09:56

i have a giant monolith i need to chip away at

seancorfield03:09:09

Ah, OK. And the docstrings are identical between those interfaces? Doesn't even the ns docstring explain what's unique about each particular version of the component?

jasonjckn03:09:01

it’s pretty obvious by the component name but fair point

jasonjckn03:09:46

eg interface = jetty adapter , one component for v11 and one for v12

jasonjckn03:09:24

they both take virtual-threads? in kwargs , but 11 throws unsupported op

seancorfield04:09:04

Ah, interesting. Yes, we had a component with implementations for Ring/Jetty 9 and for sunng/Jetty 11 but we figured out another way around our "legacy app" issue. I'd probably surface that check & throw in the interface code tho', prior to delegating to the impl version.