You are viewing a single thread.
View all comments

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

permalink
report
reply
52 points
*

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.

permalink
report
parent
reply
22 points

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.

permalink
report
parent
reply
4 points

itโ€™s a readable query returning a sane JSON object.

No itโ€™s not. What table is the data supposed to be coming fromโ€ฆ?

permalink
report
parent
reply
2 points

Check out JOOQ.

permalink
report
parent
reply
7 points

JOOQ made me realize that most ORMs suck

permalink
report
parent
reply
4 points

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)

permalink
report
parent
reply
2 points
*

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?

permalink
report
parent
reply
1 point

Yes

permalink
report
parent
reply
1 point

It is so readable that you missed the fact it doesnโ€™t have the FROM clause

permalink
report
parent
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

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

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 3.4K

    Monthly active users

  • 1K

    Posts

  • 37K

    Comments