portland-or

Clojure in PDX yo!
hlship 2017-02-06T17:03:17.000032Z

I wish I could share the reasons for the delays; it would be amusing if it wasn’t happening to us!

hlship 2017-02-06T17:03:44.000033Z

There’s another GraphQL implementation out there, it’s just not nearly as sophisticated as ours. You could start prototyping.

mattly 2017-02-06T19:32:01.000034Z

@bill I use mount

mattly 2017-02-06T19:32:29.000035Z

it's easier to use in development but my complaints are similar to josh's above

mattly 2017-02-06T19:33:11.000036Z

it's basically a way of creating singletons with state, and managing the dependencies between them

mattly 2017-02-06T19:34:37.000037Z

Once I hit about ten defstate singletons in my app it started getting way too hard juggling those for testing

mattly 2017-02-06T19:36:16.000039Z

overall I still like mount more than component, so I'm not planning to switch anytime soon, but I've been moving towards a pattern like

mattly 2017-02-06T19:43:45.000041Z

this has made testing about 100x easier, and things still work as expected in dev/prod

mattly 2017-02-06T19:44:04.000042Z

it's nicer in dev, as I can spin up a second server on another port or with a different config as needed

bill 2017-02-06T20:09:28.000043Z

@mattly how is Component not "basically a way of creating singletons with state, and managing the dependencies between them”? In this respect I feel like Component and Mount are equivalent. One key difference I see is syntactic. w/ Component, every single fn that wants to access the ugly state has to take it as a parameter whereas with Mount the reference to the ugly state is made by require so functions may close over those references. I realize how ugly that sounds. The resulting namespaces look a lot more like ugly namespaces written using dynamic vars to set default state which gets redefined in test and prod using with-redefs. OTOH with Mount, (unlike with-redefs) the state is not thread-local.

mattly 2017-02-06T20:13:16.000044Z

@bill, no I mean mount is basically a way of creating singletons with state

mattly 2017-02-06T20:14:16.000045Z

not singleton/state in a thread sense but in a "there is a fixed reference point to it in the global namespace" sense

bill 2017-02-06T20:14:24.000046Z

sure

bill 2017-02-06T20:14:55.000047Z

and wouldn’t I try to use Component the same way, i.e., try to have the minimum number of Components I could possibly have?

mattly 2017-02-06T20:15:44.000048Z

sure

mattly 2017-02-06T20:15:49.000049Z

I'm not comparing it to component necessarily

mattly 2017-02-06T20:15:59.000050Z

mostly offering some perspective on using mount in a fairly involved project

mattly 2017-02-06T20:16:23.000051Z

...don't get me wrong, I think either mount or component is vastly superior overall to using neither

bill 2017-02-06T20:19:38.000052Z

So I was all excited about Component as the 500 LoC Clojure answer to my colleagues’ 80K LoC Guice (for Java). Then I got excited about Mount because Component seemed like it’d lead to essentially lots of Components and OO-ish badness in actual practice, and I thought Mount was better. Now I am more and more inclined toward dependency rejection a la: http://blog.ploeh.dk/2017/01/27/from-dependency-injection-to-dependency-rejection/

bill 2017-02-06T20:20:53.000054Z

^ that article takes you in about 30-minutes to indirect output and indirect input via monads without using That Word. sigh

mattly 2017-02-06T20:21:27.000055Z

heh

mattly 2017-02-06T20:25:41.000056Z

I'd be curious to see what that would look like in clojure

mattly 2017-02-06T20:25:54.000057Z

my haskell isn't as good as I'd like it to be

bill 2017-02-06T20:52:26.000058Z

I too, am curious @mattly! I’m starting with Who In Their Right Mind Would Use Monads in Clojure?: http://blog.muhuk.com/2015/10/01/who_in_their_right_mind_would_use_monads_in_clojure.html

mattly 2017-02-06T20:52:35.000059Z

hah

mattly 2017-02-06T20:52:49.000060Z

that link 404s for me

mattly 2017-02-06T20:55:28.000061Z

One thing I'm trying to do, per the example above, is move towards having each thing handle it's own configuration & validation based on what's passed in, and then having only the mount pieces explicitly use the other mount pieces

mattly 2017-02-06T20:56:23.000062Z

so defstate server's :start pulls from both environment variables and another mount state, but the start-server function knows nothing about those and handles the validation

mattly 2017-02-06T20:56:40.000063Z

whereas before I was doing all of that in the config namespace