There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

Witchfire , in no.. just no
@Witchfire@lemmy.world avatar

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

reimufumo OP ,
@reimufumo@lemmy.ca avatar

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 ,

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

doidera ,

Yes

somePotato ,

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 ,

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.

blackbrook ,

Check out JOOQ.

shotgun_crab ,

JOOQ made me realize that most ORMs suck

leftzero ,

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

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

jflorez ,

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

istoff , in no.. just no

Is that select * ?

I expect it looks more cumbersome with joins and multiple columns from different tables.

adamth0 ,

That’s what I was wondering. It’s doing a SELECT, but not saying exactly which columns it wants to retrieve.

kamen , in The Holy Trinity of JavaScript

Lots of silliness indeed, yet I can’t remember the last time I had to use a non-strict comparison.

CanadaPlus ,

Yes, it’s been established that you can still use JavaScript, and it will only backfire sometimes, even though it’s a bad language. And yet, people try to use it where it’s not even required.

normalexit , in no.. just no

This idea is bad and whoever came up with it should feel bad.

III ,

It never ceases to amaze me how far idiots will go to avoid learning the most simple things. SQL isn’t hard, people’s difficulty with it says a lot more about them than it does SQL.

emptyother ,
@emptyother@programming.dev avatar

People think in different ways. What might seem logical to you might look alien to another. I know SQL well enough to optimize queries, but I find it a lot easier to think about and write queries as LINQ methods. A lot more cleaner and logical to my brain.

mvirts , in no.. just no

Remember kids, JSX is just function calls. It can’t hurt you.

Thcdenton ,

Oh it can and it did.

guy , in The Holy Trinity of JavaScript
@guy@lemmy.world avatar

== is a heathen with no rightful place except equality to null. All praise ===

cmdrkeen OP ,

That’s what I used to think but it turns out to be the most Christian operator there is.

match ,
@match@pawb.social avatar

Eval works in mysterious ways

ADTJ ,

I Object to your terrible pun

cmdrkeen , in no.. just no

Honestly not the worst thing I’ve seen.

xmunk ,

I’d like you to think for a moment about CTEs, the HAVING clause, window functions and every other funky and useful thing you can do in SQL … Now just think, do you think that this syntax supports all those correctly?

cmdrkeen ,

Probably no better or worse than any other ORM written in a more traditional language. Worst comes to worst, you can always escape to plain SQL.

Primarily0617 ,

sql syntax doesn't support even itself correctly i fail to see your point

felbane ,

You’d certainly have to have a CTE to even entertain the thought of using this syntax in the real world.

kpw , in no.. just no

The most offensive thing here is the amount={5} attribute. What is it? It's not XML.

MostlyHarmless ,

It’s JSX. It’s used to embed markup into javascript

sndrtj ,

It’s to embed Javascript into embedded markup in Javascript

ABC123itsEASY ,

It’s a react component and that would be the proper way to give a numerical value in jsx

Huschke ,

JSX has grown beyond react, so without further context it doesn’t have to be react.

zqwzzle , (edited ) in The Holy Trinity of JavaScript

=== is just == with extra steps

kamenlady ,
@kamenlady@lemmy.world avatar

It’s to be REALLY sure

thanks_shakey_snake ,

It’s actually the other way around. == has to perform type coercions as part of its equality algorithm, whereas === does not, so == has more steps.

paul , in Manager: This task only takes 30 minutes. Why did it take you the whole day?

do git commit -v and then just summarize the diff you have in your editor in a human readable form.

KeepFlying ,

Don’t just summarize the content though, summarize the rationale or how things connect. I can read your diff myself to see what changed, I want to know the logical connections, the reason you did X and not Y, etc.

Or just say “stuff” and provide that context in the PR description separately, no need to overdo the commit log on a feature branch if you’re using squash merges from your PR.

deadbeef79000 ,

P1000x this.

I can read a diff.

I need to know why.

No, a code comment isn’t good enough, it’s out of date after the next commit.

KeepFlying ,

Code comments for "why"s that persist. Commits for why’s that are temporary.

If you need to run X before Y, add a comment. If you added X before why because it was easier, leave it in a commit

deadbeef79000 ,

If you need to run X before Y…

Add a test that asserts that.

KeepFlying ,

With a comment on the test detailing why it matters so people don’t just assume the test is out of date when it fails.

And ideally test the underlying result of x before y, not the fact that x is called before y.

And while we’re at it, assert in Y that X has been called, and again comment the reason for the preconditions.

jiberish , in PlEaSe CeNtEr ThAt DiV

As an amateur web designer in the 90s and early 2000s, this speaks to me. I stopped web development when CSS became popular and I couldn’t wrap my head around it.

Is there a petition I can sign to scrap all this nonsense modern web progress and go back to that beautiful, dial-up friendly HTML?

Acetamide ,
@Acetamide@lemmy.world avatar

Let’s just design every website using a table again. Or even better, frames!

vk6flab , in There are many similarities between programming and parenting
@vk6flab@lemmy.radio avatar

All I’ll say is that I’m glad that I’m neither your child, nor a member of your software development team…

abbadon420 OP ,

I don’t get it, why make it personal?

Sonotsugipaa ,
@Sonotsugipaa@lemmy.dbzer0.com avatar

They lost their firstborn son in The War to untracked artillery because neither -i, -n, nor -f were given.

abbadon420 OP ,

Oh I’m sorry man, I didn’t know. Thank you for your service.

something_random_tho ,

You’re telling me no -f’s were given?

zero_spelled_with_an_ecks ,

Your bedroom and your code sound dirty. No dessert until there are no more dirty clothes on the floor and all your merge conflicts are resolved.

mods_mum ,

jeez, you must be fun to be around. I’d say it’s the OP who dodged the bullet with you in their team lol

gnutrino , (edited ) in There are many similarities between programming and parenting

One mistake and you have to maintain it for 18 years…

Brahvim , in `"☹️".reverse() == "🙂"`
@Brahvim@lemmy.kde.social avatar

What’s with the lines of both equals symbols being combined together haha?

hydroptic OP , (edited )

That’s known as a ligature and they’re pretty common in many programming-oriented fonts, which usually have stylistic sets with different ligatures for different programming languages that you can optionally enable in your editor’s configuration. For example, here’s the stylistic sets the Monaspace font offers:

https://sopuli.xyz/pictrs/image/9081bd41-85a0-404b-baa8-886f69ee4adf.webp

Personally I’m not too fond of ligatures so I never enable any, but many folks do like them.

Edit: and just as a side note, ligatures are super common in many fonts, you just might not notice them. Here’s some classic examples from the DejaVu Serif font, with and without a ligature:

https://sopuli.xyz/pictrs/image/c3c53e73-e71a-42ce-9ecb-f4be46551c16.webp

Lifter , in `"☹️".reverse() == "🙂"`

“A”.reverse() === “A”

hydroptic OP ,

“A”.reverse() == “∀”

Where is your god now?!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines