Honestly more readable than a lot of SQL Iโve read. It even has hierarchical grouping.
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.
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.
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)
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?