clojure-uk

A place for people in the UK, near the UK, visiting the UK, planning to visit the UK or just vaguely interested to randomly chat about things (often vi and emacs, occasionally clojure). More general the #ldnclj
jiriknesl 2020-09-11T04:44:46.234500Z

Morning

seancorfield 2020-09-11T04:59:19.234700Z

Mornin'

djm 2020-09-11T05:37:28.234900Z

👋

dharrigan 2020-09-11T05:44:43.235100Z

Good Morning!

mccraigmccraig 2020-09-11T05:49:03.235700Z

¥mÄn¥

alexlynham 2020-09-11T07:11:39.235800Z

morning

thomas 2020-09-11T07:51:54.236Z

morning

alexlynham 2020-09-11T10:27:20.236100Z

i was just introduced to the idea that this is a code smell http://wiki.c2.com/?PrimitiveObsession

alexlynham 2020-09-11T10:27:26.236200Z

and i was like looooooool

alexlynham 2020-09-11T10:27:35.236300Z

using primitive data is good design

alexlynham 2020-09-11T10:27:41.236400Z

not a code smell hahaha

alexlynham 2020-09-11T10:28:34.236500Z

come back to me about primitive data once you've scaled a service that uses microservices or external parties... i don't think your ValueObject will serialise as easily as 1

mccraigmccraig 2020-09-11T10:29:45.237300Z

primitive-data + language features to enforce type or schema of that primitive data is the killer combo

👍 1
alexlynham 2020-09-11T10:52:19.237400Z

xactly

alexlynham 2020-09-11T10:52:26.237500Z

i feel like it's quite obvious

alexlynham 2020-09-11T10:52:38.237600Z

but it's very hard to explain to some folks

alexlynham 2020-09-11T10:53:15.237800Z

been using jsonschema on current project cos it's typescript and damn it makes me miss schema

alexlynham 2020-09-11T10:53:26.237900Z

having to write schemas and my types out is booooring

mccraigmccraig 2020-09-11T11:07:17.239100Z

this feels like a convincing argument: if only the types in typescript were themselves plain-old-datastructures, then you could use them to construct a parser for your JSON and your duplication problem would disappear

alexlynham 2020-09-11T11:09:48.240300Z

ikr??

alexlynham 2020-09-11T11:10:14.240700Z

people look at you funny when you say stuff about getting things for free without having to parse the gen'd ASTs

mccraigmccraig 2020-09-11T11:10:16.240900Z

it's the same as the old unix make-everything-a-filesystem argument - you get compounded benefits from having a uniform means of access

alexlynham 2020-09-11T11:11:15.241Z

right, which you only get with primitive data

mccraigmccraig 2020-09-11T11:11:53.241100Z

there are lots of nice islands to visit in stockholm

alexlynham 2020-09-11T11:14:03.241200Z

haha

alexlynham 2020-09-11T12:06:13.241700Z

yeah noticeable that purescript is weaker than haskell in that regard (afaict anyway, from a novice perspective)

mccraigmccraig 2020-09-11T12:15:25.242Z

in the end i presume a sufficiently expressive ability to despatch on type is equivalent to having the type-structures available as data, but perhaps safer ?

mccraigmccraig 2020-09-11T12:16:52.242200Z

or, are there things which can't be expressed in one way that can be expressed in the other ? i can't recall anything about this... have you seen anything @minimal ?

minimal 2020-09-11T12:36:59.242400Z

I think by default it supports simple types and you can write custom convertors for others

2020-09-11T13:16:26.251600Z

@alex.lynham: I hear what you’re saying, but isn’t the advice behind that essentially saying, don’t use for example Int to mean EmployeeId, define a type or spec called EmployeeId, and use that instead, even if it’s just essentially an alias for Int? i.e. it’s better to lift primitives into domain language.

2020-09-11T13:17:40.252800Z

e.g. in clojure.spec: (s/def ::employee-id integer?) is better than just using integer? everywhere where you mean employee-id.

alexlynham 2020-09-11T14:02:22.253Z

well when you see it in OO context it tends to mean encapsulate it in an object

alexlynham 2020-09-11T14:02:56.253300Z

& even in your example it's just a ref innit, so it's quite different to something inaccessible

alexlynham 2020-09-11T14:03:18.253400Z

back to the data/metadata thing with objects being like metadata that doesn't compose

alexlynham 2020-09-11T14:03:23.253500Z

where e.g. types do compose

alexlynham 2020-09-11T14:04:11.253600Z

because in OO land defining a type entails the baggage of instantiating objects and using objects

alexlynham 2020-09-11T14:04:35.253700Z

i've got no quarrel with types sir

2020-09-11T14:15:24.255Z

:thumbsup: For them it certainly does mean encapsulating in an object; but I think that’s just because the c2 community and most of that wiki’s content were written circa 2000; by a bunch of smalltalkers, and folk adopting java
 so most of it has an OO flavour. Weren’t they just using the tools and language available to them to try and express the more general idea of prefering domain representations to primitive ones?

2020-09-11T14:16:42.255700Z

Nobody likes the drudgery of wrapping/unwrapping things that’s for sure
 but sometimes needs must!

2020-09-11T14:21:39.256Z

100% agree that every class is an island though

alexlynham 2020-09-11T14:29:18.256100Z

i guess the context is that i'm leading a project where we pass around largely domain-specific hashmap representations to avoid messing with classes/objects and we're the only team really being that functional primitive obsessed is a kinda criticism that's been levelled at me a few times as regards coding style and so yes while i think there's historical residue to the definition and indeed a charitable interpretation is 'map your domain well' the reality is i've found it something that OO people prize without understanding the trade off to

alexlynham 2020-09-11T14:29:36.256200Z

because it parses as 'primitive data bad, objects good'

alexlynham 2020-09-11T14:31:28.256300Z

example given in a friendly exchange earlier: > also toString(Money(7, ‘GBP’)) is different to toString(7) to which i retorted ['gbp', 7] (in js, obv in clj you could use :gbp or a namespaced version

alexlynham 2020-09-11T14:32:18.256400Z

but the idea that instantiating a class for what is self evidently modellable as a tuple or variant while keeping within the bounds of primitive data is wild

alexlynham 2020-09-11T14:32:35.256500Z

and imho dead wrong, but then i am an fp fundamentalist

2020-09-11T14:43:24.256700Z

:thumbsup:

alexlynham 2020-09-11T15:14:02.257200Z

wrong tab craig

Conor 2020-09-11T15:18:44.257300Z

"Deploy first. Think later. It's the natural order."

dominicm 2020-09-11T16:57:23.257600Z

SQL is broken.

mccraigmccraig 2020-09-11T17:06:16.257900Z

more than usual ?

dominicm 2020-09-11T17:10:01.258200Z

No. Well, maybe.

dominicm 2020-09-11T17:13:51.258900Z

I want to join to multiple things but retain the tree shape.

seancorfield 2020-09-11T17:16:38.261Z

Interesting comments about the c2 stuff. Back in the '90s and early '00s, OOP was still supposed to be the industry's "saviour" and Object Think and OOAD were the One True Way because the whole industry had aligned behind that after procedural and structured programming had failed to shine at scale (complexity scale).