this post was submitted on 27 Dec 2023
542 points (96.7% liked)

Programmer Humor

19463 readers
212 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] Witchfire@lemmy.world 148 points 10 months ago* (last edited 10 months ago) (3 children)

Honestly more readable than a lot of SQL I've read. It even has hierarchical grouping.

[–] somePotato@sh.itjust.works 52 points 10 months ago* (last edited 10 months ago) (3 children)

I was disgusted by the XML at first, but it's a readable query returning a sane JSON object.

Meanwhile, I'm mantaining Java code where the SQL is a perfectly square wall of text, and some insane mofo decided the way to read the resulting list of Object[] 🤮 is getting each column by index... so I'd switch to SQXMLL in a heartbeat.

[–] cmdrkeen@programming.dev 21 points 10 months ago

React basically figured out how to make XML work.

Remember, XML was actually designed for use cases like this, that’s why it came with XPath and XSLT, which let you make it executable in a sense by performing arbitrary transformations on an XML tree.

Back in the day, at my first coding job, we had an entire program that had a massive data model encoded in XML, and we used a bunch of XSL to programmatically convert that into Java objects, SQL queries, and HTML forms. Actually worked fairly well, except of course that XSL was an awful language to do that all in.

React simply figured out how to use JavaScript as the transformation language instead.

[–] leftzero@lemmynsfw.com 4 points 10 months ago

it's a readable query returning a sane JSON object.

No it's not. What table is the data supposed to be coming from..?

[–] blackbrook@mander.xyz 2 points 10 months ago (1 children)
[–] shotgun_crab@lemmy.world 7 points 10 months ago

JOOQ made me realize that most ORMs suck

[–] reimufumo@lemmy.ca 4 points 10 months ago (1 children)

true, but having it look like a component might get annoying. since this is likely to stay at the top, having an island of non components between two components might make it hard to see where functions start and end. and if this isn't used directly inside a component it'll just look dumb and inefficient (this also looks like it'll take way more to edit once you change something)

[–] bahbah23@lemmy.world 2 points 10 months ago* (last edited 10 months ago) (1 children)

I think I agree with you both. I'm not a Node developer; could you keep your SQL objects/components in a separate file so that they don't clutter up other logic?

[–] jflorez@sh.itjust.works 1 points 10 months ago

It is so readable that you missed the fact it doesn’t have the FROM clause