Fork me on GitHub
#clojure-nl
<
2019-12-06
>
skuro11:12:46

afternoon 🙂

yannvahalewyn12:12:08

tonight I’m having a long meeting with Tony Kay for an ambitious but exciting open source project for rapid application development. I’m equal parts excited and mortified to talk with someone with so much experience.

yannvahalewyn12:12:24

when I offered my help I was more thinking along the lines of writing tests, docs, cleaning up the API, implementing some things. He’s actually involving me in the design and hammock process too to my surprise. So wish me luck!

borkdude12:12:52

cool, good luck @yannvahalewyn. does this project already exist somewhere?

yannvahalewyn12:12:46

It’s in the experimental idea phase, and everything is changing. But there is some kind of a demo online + a conversation between him and me outlining what needs to be done if you’re interested 🙂

borkdude12:12:12

ah that Tony Kay, I mixed it up in my head with some Smalltalk or other interactive guru

borkdude12:12:37

now it makes sense 😉

yannvahalewyn12:12:12

tldr; RAD aims to allow developers to declare parts of their system and leverage the declaration to remove as much of the boiler plate as possible, but not to force the dev in a certain direction. Think about db queries, pathom resolvers, fulcro mutations, prefab UI components to make forms on admin panels, validation, authorisation, data fetching from multiple data sources, you name it

yannvahalewyn12:12:36

conceptually all will be open maps and you could extend the system with your specific needs

borkdude12:12:50

it seems like fulcro is becoming the rails of clojure (but in a good way)?

yannvahalewyn12:12:17

Like many others I’m really hoping for that killer app to make an appearance 🙂

yannvahalewyn12:12:52

I’m very excited about this because it aligns well with the direction clojure is taking and with Tony’s decades of experience I think he might bring something great to the table

yannvahalewyn12:12:18

but for now I just hope I won’t make an ass off myself #impostersyndrome

mitchelkuijpers13:12:42

Tony Kay is very laid back don't worry

yannvahalewyn13:12:09

Yeah he is, we talked a bit already and it went ok. You know him?

mitchelkuijpers21:12:21

I met him in Austin, and worked with him. We are long time Fulcro users. From the time it was called Untangled :-p

Mno13:12:14

I mean I didn't get most of this, but It sounded very exciting!

upside_down_parrot 1
Mno13:12:02

You can do all the things Yann! 🎉

yannvahalewyn13:12:37

I tried explaining it the best I could, but when Steve talks I feel the same way haha

borkdude13:12:08

me slaps yann with a hammock

borkdude13:12:58

pun on IRC line from the olden days > /me slaps around with a large trout

Mno13:12:01

I'm trying to watch the video but I'm afraid since I don't know much about fulcro it might be hard to follow 😅

Mno13:12:27

btw the railsiest thing I've seen for clojure so far is Coast on Clojure

yannvahalewyn13:12:28

I.. don’t know it yet either 😅

Mno13:12:33

which is them basically copying all the patterns from rails, but slightly better. But you probably meant the "Rails of Clojure" as in the killer app that makes people want to learn/migrate to clojure.

borkdude13:12:32

there is another exciting thing in progress which I can't talk about yet, which could be a clojure killer app

1
Mno13:12:46

I want to know though 😭

yannvahalewyn13:12:50

I actually made something even more railsey I think, rails + administrate in ~100 lines of clojure as a proof of concept a couple of weeks ago

yannvahalewyn13:12:12

all the things, inflection, schema read from the database (horrible idea but railsey 😉), rest resources (routes + handlers), UI, forms. clojure is insane

yannvahalewyn13:12:55

argh you removed id haha

Mno13:12:05

I kinda never learned pure sql because I used rails

Mno13:12:08

and trusted it blindly

Mno13:12:19

Never really had an issue with it.

borkdude13:12:25

sorry, I removed it to not come across negative towards automatic db queries 😉

yannvahalewyn13:12:34

Don’t worry I’ll do it for you

yannvahalewyn13:12:48

When using a sql database I need the sql stuff at some point, so I don’t like ORM style of things. But at work we have so much boilerplate in the basic CRUD stuff right now it’s annoying

Mno13:12:54

Hahaha, I like them for rapid development.

yannvahalewyn13:12:22

funily I’m actually working on improving this right now. Well I should be but I’m hanging out on slack with you guys

Mno13:12:09

basically for prototyping it's nice to just modify/generate queries on the fly in the code rather than have to create a query string yourself and figure it out until it works (probably because I'm not great at writing pure sql)

yannvahalewyn13:12:05

what RAD wants to achieve is indeed to have those tools for minimal boiler plate during greenfield, but you can later rock your own solutions that better fit the project’s needs. Or just pile onto it

borkdude13:12:08

@hobosarefriends as long as you can easily override it with manual SQL when you need to, it's fine I guess

Mno13:12:01

Yeah, active record could do that, I think you could just pass a string or a lambda to where and it would run it directly basically.

Mno13:12:20

Rails seemed to have a philosophy I really liked, which was having defaults that worked for most people most of the time, but it could be overridden all the time.

yannvahalewyn14:12:50

My talk wednesday is actually called “Composition over convention” as a wink to Rails’ philosophy. I’ve found that overriding things isn’t enough if the framework doesn’t have composability in mind

Mno22:12:44

Then I better not miss it!

Mno13:12:06

Either way I have to see what cool patterns and designs the Clojure people come up with now. ❤️ clj

borkdude13:12:11

@hobosarefriends Rails is awesome for what it is, but when I started doing it (being used to Clojure) I felt there was so much magic going, on I didn't know where to look when something went wrong or didn't perform well

borkdude13:12:56

The mutability and monkey-patching makes it hard to track down issues I found

borkdude13:12:20

Still, it's an awesome tool to get things done quickly

borkdude13:12:49

(I've only done one or two real Rails projects, so take everything I say about it with a grain of salt)

borkdude13:12:28

I have done one other project with the Java version of the Play framework which was a horrible experience ORM-wise

borkdude13:12:41

there was an actual bug in the ORM-framework which was related to concurrency

borkdude13:12:13

all in all I found it faster and less confusing long term to just SQL myself

Mno14:12:54

Rails is suuuuper magical (I never fully understood a lot of the things, like the asset pipeline/sprockets), but since everyone uses the same magic the problems you tend to encounter tend to be problems other people have already encountered. But yeah Magic has it's downsides.

Mno14:12:49

if you write SQL yourself, do you find other people can also easily read it? I've haven't seen much handwritten stuff in my projects and I always wondered how legible it would be.

borkdude14:12:34

@hobosarefriends The sql is usually coupled with a Clojure function that describes what it does, including a docstring. But often the SQL is very simple and readable as well. And what is cool, you can just paste that SQL in a pgadmin somewhere and tinker with it

Mno14:12:41

Yeah I use hugsql on one of my personal projects

Mno14:12:59

It's alright, I just lack the composability that I'm used to 😅

borkdude14:12:38

if you want composable sql maybe try honeysql

borkdude14:12:08

I've never bothered with it since I often don't need that dynamicity

borkdude14:12:14

what's cool about clojure is that you can just combine all these libs and build your own cool thing I guess

borkdude14:12:30

this does look pretty compelling:

(-> (insert-into :properties)
    (values [{:name "John" :surname "Smith" :age 34}
             {:name "Andrew" :surname "Cooper" :age 12}
             {:name "Jane" :surname "Daniels" :age 56}])
    sql/format)
=> [#sql/regularize
    "INSERT INTO properties (name, surname, age)
     VALUES (?, ?, ?), (?, ?, ?), (?, ?, ?)"
    "John" "Smith" 34
    "Andrew" "Cooper"  12
    "Jane" "Daniels" 56]

lmergen17:12:14

+1 for hugsql -- perfect non-ORM for me

lmergen17:12:30

composability of these things can often be an anti-feature

lmergen17:12:54

and hugsql snippets get you quite far as well

gklijs17:12:38

I kind of liked getting down to raw sql with jcbc.next, might try hugsql if I would use it more, for now it where just a couple of functions like this, that basically validate and perform part of the transfer:

(defn transfer-from!
  [iban token amount]
  (when
    (vg/valid-open-iban iban)
    (with-open [conn (j/get-connection @datasource)]
      (j/execute-one! conn ["
      UPDATE balance
      SET amount =
        CASE WHEN balance.token != ? THEN balance.amount
        WHEN balance.amount - ? >= balance.lmt THEN balance.amount - ?
        ELSE balance.amount END FROM balance AS old_balance
      WHERE balance.iban = ? AND balance.balance_id = old_balance.balance_id
      RETURNING balance.*, old_balance.amount as old_amount"
                            token amount amount iban]))))

Mno22:12:20

I should try next just because I like things Sean Corfield makes.

Mno22:12:00

And honeysql as well, but I don't know why I didn't choose it when I started working on stuff.. Maybe it had a dsl of some. Sort

gklijs23:12:01

next is really like wight, bassically all you can do is send some sql, and get either a map, or a list of maps back. But most of the time that's enough 🙂.