Fork me on GitHub
#clojure
<
2023-04-27
>
Joshua Suskalo13:04:21

@vemv different 🧵 to not clutter things, but: what's the rationale behind migrating from integrant to component? Most people I talk to are trying to migrate the other direction, so I'm really curious what the thought process is.

👀 2
vemv15:04:38

I've used both intensively in work codebases and I've always been rather unimpressed with how Integrant plays out when it comes to authoring tests. I hear that people temporarily redefine defmethods? Or use with-redefs? With Component it's much cleaner to have test-specific behavior: just implement the given protocol and merge that impl into the test-specific System. With metadata-based extension, Component is lightweight, repl-friendly and can easily be instrumented with spec/malli/etc.

Joshua Suskalo15:04:55

I guess I can see it. My experience writing tests doesn't generally focus on systems. I either write integration tests against the deployed system, or unit tests against things smaller that don't need components. I haven't felt this problem, but I can see how it could be an issue.

lassemaatta15:04:05

> just implement the given protocol and merge that impl into the test-specific System. but can't you do that almost similarly with integrant by deriving the test-component key from the parent service key and merging the test component into the system (as per https://github.com/weavejester/integrant/issues/81#issuecomment-615906828 comment)?

iperdomo12:04:28

is not the case that you want to use a different config file for tests, swapping the integrant keys with your test components ... from the same author, this is what duct-framework does

vemv14:04:12

> but can't you do that almost similarly with integrant by deriving the test-component key from the parent service key and merging the test component into the system (as per https://github.com/weavejester/integrant/issues/81#issuecomment-615906828 comment)? Ah yes derive ... tbh I hadn't used it in a long time with Integrant, that was 2018 (other Integrant codebases didn't use it at all) I guess it works. But also that it's global state / indirection? I see some sort of contradiction between making more global state (more bespoke keys, globally registered) for making more local/specific variations (test-specific behavior)

Joshua Suskalo14:04:51

I mean that is what namespaced keys are meant to solve, but I'm not trying to convince you to use integrant. Protocols etc. do provide a reasonable way to do mocking of whole systems.

lassemaatta14:04:16

you don't necessarily need derive, you can use vectored keys in your system map, {[:mock-email :email-sender] {:some-mock-arg true} .. instead of (derive :mock-email :email-sender)

kwladyka14:04:59

I saw post saying Datomic is free. Is it true or there is a catch? Why? Did people who maintain Datomic change? What have changed? What is the catch? ;) is / will be payable version?

🎉 2
Alex Miller (Clojure team)15:04:04

Use #C03RZMDSH if you have questions…

kwladyka15:04:12

Sorry, I thought it is interesting topic for whole community and worth to share the news license have changed

Alex Miller (Clojure team)15:04:14

No worries at all! I just thought you didn’t know about it and there are some discussions there already.

escherize18:04:41

I didn’t read any of this: is this Miller’s Law?

😂 2