Fork me on GitHub
#portland-or
<
2017-02-07
>
bill20:02:01

I’ll add this wonderful little series of short posts: http://www.clojure.net/2012/02/02/Monads-in-Clojure/

mattly20:02:41

@bill yeah I gave the talk on cats a few months back https://github.com/funcool/cats

mattly20:02:01

that http://muhuk.com link is 404ing

mattly20:02:15

as it appears their site is offline

bill20:02:17

wish I hadn’t missed your Cats talk

mattly20:02:57

I tried to walk through the "why" before the "what"

bill20:02:34

perusing…

mattly20:02:48

I use "maybe math" as an example at the beginning because I've ended up having to implement some variant of that in pretty much every language I've ever worked in

bill20:02:17

@mattly looking more closely at your code example… https://clojurians.slack.com/files/mattly/F410FHD6V/mount_patterns__old_and_new.clj I see what you did there. All dependency on state is encapsulated in a defstate. Code in defstate can call functions so long as they reference no variables def’d outside the fn. (was gonna say “pure” fns but um, this is Clojure)

mattly20:02:34

a lot of the documentation / writeups for mount encourage you to put the behavior in the start/stop clauses of defstate

mattly20:02:02

once I realized that was a bad idea and stopped doing it, it became a lot easier to manage

bill20:02:25

So back to Mount vs. Component: the point about Mount defining a bunch of singletons is apt. My fave example of that is an app that needs to read from one PostgreSQL db and write to another one. In Component, I’d just have two (differently-configured) instances of my db component and I’d be off to the races. In Mount this won’t work because you configure the database namespace once (to talk to the database) and you’re stuck. My take is that this is what Yurt is for. Yurt uses Boot Pods to provide separate isolated worlds. Communication between these Pods looks like it’d be cumbersome.

bill20:02:30

then again, w/ your scheme perhaps I could easily define two states: one for each db, initialized from two sets of config settings This would entail moving that state creation (for the db connections) outside the db namespace into some higher-level (app-specific) one

mattly20:02:47

yeah that's more or less what I do

mattly20:02:11

I have two postgresql databases and a mysql database I work with

bill20:02:28

all at once?

mattly20:02:38

config validation and pool creation are its own concern

mattly20:02:54

as well as spark, cassandra and dynamodb

mattly20:02:04

it's a mess

mattly20:02:16

but that mess is why I was able to push for clojure on this project 😄

mattly20:02:26

in what is otherwise a ruby shop

bill20:02:37

step 1: create mess, step 2: propose awesome solution, step 3: profit!

mattly20:02:45

I didn't create the mess tho

mattly20:02:14

the only stores I own outright are spark and one of the pg databases

mattly20:02:34

the rest are Other Services' Data

mattly20:02:40

and some of it is HIPPA-protected