274
submitted 2 weeks ago by [email protected] to c/[email protected]

Meme transcription: Panel 1. Two images of JSON, one is the empty object, one is an object in which the key name maps to the value null. Caption: “Corporate needs you to find the difference between this picture and this picture”

Panel 2. The Java backend dev answers, “They’re the same picture.”

you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 0 points 2 weeks ago

That's exactly not the thing, because nobody broke the contract, they simply interpret it differently in details.

Having a null reference is perfectly valid json, as long as it's not explicitly prohibited. Null just says "nothing in here" and that's exactly what an omission also communicates.

The difference is just whether you treat implicit and explicit non-existence differently. And neither interpretation is wrong per contract.

[-] [email protected] 2 points 2 weeks ago

Null means I'm telling you it's null.

Omission means it's not there and I'm not telling you anything about it.

There is a world of difference between those two statements. It's the difference between telling someone you're single or just sitting there and saying nothing.

[-] [email protected] 1 points 1 week ago

I (think, at least) the point they're making is that unless the API contract specifically differentiates between "present and null" and "absent" then there is no difference. (Specifically for field values.)

[-] [email protected] 0 points 1 week ago

The point I'm making is kind of the opposite, unless the contract explicitly states that they're the same they should not be treated as the same, because at a fundamental level they are not the same thing even if Java wants to treat them as such.

load more comments (7 replies)
load more comments (8 replies)
this post was submitted on 30 Jun 2024
274 points (94.8% liked)

Programmer Humor

18388 readers
823 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