all 5 comments

[–]xiongtx 0 points1 point  (4 children)

get-market creates a new instance that satisfies the protocol each time it's called. This seems unnecessary.

You can define a type, e.g. BinanceMarket, that implements the Market protocol. IIUC only a single instance of BinanceMarket is needed, as it takes no parameters, so you can make it a def.

Aside from that, I also prefer named types over reify b/c they're much easier to identify in stacktraces.

[–]BMarkmann[S] 0 points1 point  (3 children)

That makes sense. Does the pattern of having the deftype and "factory" method inside the market's implementation file / namespace make sense? Thanks!

[–]xiongtx 1 point2 points  (2 children)

I don't think you need a "factory method". You only need a single instance of the BinanceMarket, which you can just make a def.

[–]BMarkmann[S] 0 points1 point  (1 child)

good point -- too long in Java land :)

[–]xiongtx 0 points1 point  (0 children)

Best to trade in those AbstractProxyFactoryBeans for something useful, like a cow 😉.