r/ProgrammerHumor • • 11d ago • Popcorn 1

Meme complexityWithSuperiorFormats

Post image
2.1k Upvotes

129 comments sorted by

228

u/CarolXZosiaNsfwScene 11d ago

I am confused, are they rich aristocrats looking down on me, because they are better than me, or am I looking up to them in disgust, because I am a peasant about to overthrow the system?

Who is superior to who here?

133

u/qisapa 11d ago • Bravo

Your boy TOML that’s outside of the frame.

27

u/WilkerS1 10d ago

TOML is chill. doesn't have quite the hang of everything and can get ugiy visually sometimes, but it does what it needs.  :3

12

u/Alarmed_Fudge_5706 10d ago

Best part: you can leave a note apologizing for how ugly it got

8

u/Xlxlredditor 10d ago

I profoundly dislike toml personally

16

u/cbehopkins 10d ago

Toml is the 3rd choice you use when your colleagues can't decide if the design should use JSON or YAML.

"If you can't decide then I'll pick an option you both hate equally!!!"

Like I once worked in a place that had tab indents set to 3 spaces because the senior engineers couldn't decide between 2 and 4.

Edit: I do joke of course, Toml is great.

19

u/thirdegree Violet security clearance 10d ago • Bravo

JSON isn't good for config and yaml isn't good for anything

3

u/TravisVZ 10d ago

I've been building Ansible playbooks lately, and maybe it's the Stockholm syndrome talking but I don't hate YAML as much as I used to

7

u/jeffwulf 10d ago

Anything with meaningful whitespace needs to die in a fire.

1

u/xDannyS_ 9d ago

Yaml is good for config wym

15

u/another_random_bit 10d ago

looking up in disgust

This meme never meant this

6

u/Eptalin 11d ago

You can look up in disgust, but there's no chance YAML overthrows JSON.

2

u/KeanerBike 9d ago edited 9d ago

“What if this picture is actually my POV as a peasant looking at them in disgust because I’m about to overthrow the aristocracy”

Reddit moment

306

u/RosieQParker 11d ago

If your syntax includes whitespace, fuck respectfully off.

51

u/the_poope 11d ago

But it's HooMAnn rEAdabLe

32

u/rowagnairda 10d ago

Ffs it is not... whoever came to that statement should be stabbed in the face

18

u/za72 11d ago

I hate that shit

21

u/NorthernRealmJackal 10d ago

Python was a mistake

21

u/schewb 10d ago

💯It's hard to explain, but something about having the brace at the beginning or end of a block that I can click on and have my IDE highlight the other destroys any argument to me that whitespace-based blocks are "more readable"

3

u/collabskus 10d ago

I used to really like whitespace  It made sense. 

Then I had to read other people's code

🥺

1

u/Alternative-Tie-4970 9d ago

The whitespace is the least of yaml's problems let's be serious

1

u/Juice805 10d ago

Yaml is a superset of JSON. Don’t use whitespace if you don’t want to

0

u/jeffwulf 10d ago

No, they shouldn't do so respectfully. They should die disgraced in a ditch.

0

u/[deleted] 10d ago

[deleted] — view deleted comment

48

u/BewareTheGiant 10d ago

Obligatory XKCD https://xkcd.com/927/

5

u/geek-49 9d ago

which completely explains the existence of, and most of the problems with, the programming language called PL/1. (Consider yourself fortunate if you are new enough to have to look it up.)

16

u/Prawn1908 10d ago

Why does a data transfer syntax need comments? It was never intended for writing config files like people use it all the time now (99% of which would do fine with a plain old .ini).

Not that JSON is particularly optimal for data transfer either. Using plaintext formats when neither the recipient nor the sender are humans is just a waste of memory/bandwidth and serializing/deserializing time.

2

u/Waghabond 10d ago

So what should we use for config and what should we use for data transfer?

2

u/Prawn1908 9d ago

Like I said, the vast majority of config files I've seen would work perfectly fine as a plain old .ini which incurs far less processing time to generate or parse and wastes far less space on syntax while still being perfectly human readable.

There are plenty of binary data formats to choose from for computer-to-computer data transfer. If the recipient knows the shape of the incoming data, all you need is to designate a field separator and control byte escape or stuffing sequence.

1

u/hyrumwhite 7d ago

Hear me out: TSON, Typescript Object notation for self typing responses using proposed comment types 

0

u/[deleted] 10d ago

[deleted] — view deleted comment

2

u/Prawn1908 9d ago

I mean my point is that config files are a stupid use of those formats. As long as we're wishing for something different than the systems we're stuck with, may as well wish they chose to use a better system entirely than just a bodge of the poor choice they made.

4

u/ierdna100 10d ago

One with somewhat standard schemas please!

3

u/nadseh 9d ago

.jsonc exists

2

u/hyrumwhite 7d ago

{ “comment”: “thus, I refute thee” }

1

u/aceluby 5d ago

hocon

1

u/calculus_is_fun 10d ago

jsonc is a thing

-4

u/anzu3278 10d ago

If you need comments git gud

27

u/DueButton7420 10d ago

XML looking at everyone from Hell...

39

u/Front_Committee4993 11d ago

"is it to much to ask for both" paradox when developing Victoria 3

59

u/xgabipandax 11d ago

CSV:

4

u/pingveno 10d ago

I do love me a good CSV for dumping some untyped string data. Of course, miserable if you have to nest anything.

17

u/avast_ye_scoundrels 11d ago

Advisory: No professional has any opinion about the thesis of this developing nerd war.

2

u/Prawn1908 10d ago

On the contrary, professionals should have strong reasoning for why they choose the formats they are using in the software they write. Too many software design choices are made carelessly because "that's the library I know" or "that's what we've always used" without thinking of the specifics of the application and their impact on the end user.

I personally think there is little to no reason to ever use plaintext formats for complex data structure serialization, and many applications like config files can get along perfectly fine with something far simpler like a good old fashioned .ini file which is easier to parse, so I rarely if ever see myself reaching for either JSON or YAML.

1

u/avast_ye_scoundrels 10d ago

Best tool for the given job wins. Tradeoffs and context. Every single time.

8

u/threewholefish 11d ago

So "true"

4

u/metaglot 11d ago

type: string

23

u/metaglot 11d ago

Yaml is not resilient against typos. Json is.

9

u/CWRau 10d ago

How is json resilient to typos in a way yaml is not?

44

u/bjorneylol 10d ago

I assume they mean that when you make a typo in a JSON it will throw an error. There are dozens of typos that you can make when editing yaml that will produce syntactically valid documents that will instead just silently break functionality in an impossible to debug manner

15

u/Suitch 10d ago

Like a space in the wrong place

-10

u/CWRau 10d ago

No? That will break yaml, except if you don't validate your input, but then json won't help you either (at least with other typos)

11

u/Suitch 10d ago

The point is a removed space in yaml usually doesn’t make it an invalid yaml file but a missing functional character in json will fail to parse in the first place.

-3

u/CWRau 10d ago

Ok? But if it's not invalid, what's the problem?

Aside from this being a problem from 20 years ago, as any editor will format it correctly anyways

3

u/wd40bomber7 10d ago

If you actually read some of the comments you reply to maybe you'd understand the problem...

The point is your want the parser to reject the file when you make mistakes. Accidentally removing spaces from yaml just gets accepted and your keys, now at the wrong level will usually be ignored leaving you ignorant as to what went wrong...

2

u/clintkev251 10d ago

It can at the same time be valid, but not work as you actually intended it to because now something is sitting at a different level. That’s the issue.

0

u/CWRau 10d ago

Then you didn't validate it correctly, cause why would you accept a key where you don't actually want it?

1

u/clintkev251 10d ago

Every time you edit a random YAML file you always have the schema available to your IDE so that it can do live validation? And then you're 100% sure that every system that ends up reading that file will validate it and error out on that unexpected key in a predictable and easy to understand way?

The point is that it's better to have that also enforced inherently by the syntax so there are fewer opportunities for the holes in the swiss cheese to line up and/or you're able to catch issues before they make it to CI or god forbid a prod server.

1

u/c_amy-4662 3d ago

JSON catches malformed syntax; neither parser knows `porrt` was meant to be `port` without config validation.

-2

u/CWRau 10d ago

I can't imagine a single typo outside of strings themselves (which json would also accept) that wouldn't break yaml

I'm thinking hard and I can't imagine a single one, do you have one in mind?

Missing a colon, wrong char in the keys, whitespace,... all I can think of would break loud, just like in json.

Maybe stuff like 80 -> 80e20? But that would go unnoticed in json as well...

EDIT: or do you not validate your input? But then json won't help either, aside from the whitespace part

2

u/wd40bomber7 10d ago

So so many. Removing some whitespace, dropping the - character... Just look up "yaml Norway problem" for a whole class of bugs json doesn't have...

1

u/CWRau 10d ago

But why not specify a schema? That way you even have completion, as well as catching such errors?

2

u/wd40bomber7 10d ago

I've had to use YML for configuration of a *lot* of things and I've never seen anyone with strict enforcement like you're describing.

-3

u/Juice805 10d ago

JSON is valid yaml. So it is just as resilient.

4

u/Suterusu_San 10d ago

Rust has me converted to toml

4

u/ForgedIronMadeIt 10d ago

meanwhile XML is the lich living in the dungeon under the palace

7

u/aweraw 10d ago

YAML is a superset of JSON since v1.2.

All valid JSON documents are also valid YAML documents.

4

u/Operation_Neither 10d ago

And you can still use YAML formatted comments in JSON! It's the best of both worlds.

3

u/Spikerazorshards 10d ago

Let’s just go back to INI files.

3

u/Specialist_Dust2089 10d ago

As a json fan, I have no comments

4

u/Elbinooo 11d ago

I hate both

6

u/nithix8 11d ago

guys i’m sorry but who’s this Jason?

5

u/ApacheFlame 11d ago

His surname is Waterfalls. Apparently you shouldn’t chase him either.

2

u/schewb 10d ago

John Serialization. The main character of modern digital communication.

2

u/Keyan_Farlander7 10d ago

TL;DR: One is data, the other is config.

2

u/notatechproblem 10d ago

Understand that there are older and fouler things than YAML in the deep places of the internet...

https://www.ietf.org/archive/id/draft-rsalz-jsonx-00.html

2

u/Izikiel23 10d ago

Have configuration files be whitespace dependent? No way in hell, I've already been bitten more than once by YAML in k8s due to this.
JSON with all its {} is the superior choice as it clearly delimites stuff.

3

u/Dangerous_With_Rocks 11d ago

standard sql has no native support for parsing or querying yaml. and since i’m currently having to fuck around with that at work i absolutely abhor yaml.

7

u/aberroco 11d ago

I much prefer yaml in my project, because it's more compact and concise, especially in the way it handles collections, so small arrays of simple values can become [0, 1, 2] or [[0, 1], [2, 3], while bigger collections may be written as each item on it's own line. It allows for clear distinction between typed values and strings (I use quantities like 40ms, 300%, 30s, 2kg etc, and this also helps to distinguish enum values from strings), it has references that are very useful for serialization if utilized properly, it has tags that help with extending capabilities (I added !include <filename> for nesting one file into another, !template for discarding some values and using them only as a template for actual values, and !<typename> to define the instance type when the expected value is a base class).

So, no, for me the original post was correct.

15

u/zthe0 11d ago

You can write each item of a collection on its own line in json too

6

u/Doto_bird 11d ago

And comments in default / example config files that other people need to implement is a blessing (because no one reads documentation)

0

u/[deleted] 10d ago

[deleted] — view deleted comment

1

u/crystalchuck 10d ago

I think you're being downvoted because JSON comments are non-standard. Non-standard is bad. Which parser you're using shouldn't even matter, but it does if you start considering non-standard comments. It's introducing other problems just to fix a dumb shortcoming of a standard that somehow got shoehorned into tons of applications it's not even that well suited for.

1

u/rubeste 10d ago

I previously used ARM templates (JSON) to manage Analytical rules in Microsoft Sentinel. It was always a pain as JSON does not support multiline strings so you have to escape every query. Not only is this an extra action but reviewing a PR with many changes is such a chore. Luckily with Bicep it is more akin to YAML and does support multiline strings.

Also I have used Anchors for a Helm chart YAML file so I only have to setup a value once and can use it multiple times.

1

u/aberroco 10d ago

so I only have to setup a value once and can use it multiple times.

Even better is that you may setup a shared template value once and use it multiple times changing only relevant properties, which for each use might be a different set. In my game I have it like that. A template for a part with all common values, a bunch more on top of that for parts of different sizes, and then each part only defines or redefines what it needs.

3

u/andymurd 11d ago

The only format worse than YAML is TOML.

11

u/xilyix 10d ago

For configs I’ll take TOML > JSON > YAML any day

2

u/mcellus1 11d ago

Can look but can't comment 🤫

2

u/GreenWoodDragon 10d ago

I like YAML. It's less messy than JSON, more compact and much more readable.

3

u/anzu3278 10d ago

That's a weird way to spell "more messy"

3

u/TheWatchingDog 10d ago

Have you ever tried to minify a YAML? Or got a huge response from an API?

7

u/GreenWoodDragon 10d ago

Who in their right mind would return a YAML response? It's for config, you're talking about JSON which is rightly a defacto standard these days.

11

u/CWRau 10d ago

That's not what yaml is for, yaml is for config, for stuff you as a human read and write.

The stuff you mention would be json, or another format like protobuf where readability isn't important

3

u/prinkpan 10d ago

That’s only if people use tabs for indentation. Anything less is eyesight test.

1

u/GreenWoodDragon 10d ago

Tabs for indentation, that's madness.

1

u/CWRau 10d ago

I'd say you have to adjust your editor to make it more visually distinct

1

u/NewGuySham 11d ago

I see what you did there

1

u/0bsidianM1nd 10d ago

If you are so great, why can't you parse this.

{"configuration": { Json looking at yaml: "enabled": true, "version": 2.0.1, "settings": [undefined, NaN, <invalid>] }}

1

u/bogoris76 10d ago

Oh boy, both are shit

1

u/0ttr 10d ago

Overthrow them, they can have my YAML when they pry it from my unemployed hands

1

u/Xlxlredditor 10d ago

Isn't yaml a superset of json technically

1

u/Random_182f2565 10d ago

Jason and Yamal

1

u/greyfade 10d ago

The problem with JSON, though, is JavaScript

1

u/Enough-Scientist1904 10d ago

Lmao looks like the json boys got deeply hurt by the previous meme

1

u/FFevo 10d ago

JSON for data. YAML for workflow definitions.

If you think they are competing solutions, you are wrong.

1

u/ryaaan89 10d ago

I love json but at least yaml lets you temporarily comment out a line.

1

u/wurnthebitch 10d ago

No comment

1

u/86BillionFireflies 10d ago

Compact binary formats looking at text based formats.

1

u/__sean_eng__ 10d ago

Protobuff on the sidelines

1

u/TyrannusX64 10d ago

I still don't understand why docker k8s chose yaml over json. Json is way easier to read IMO

1

u/arcticslush 10d ago

Pkl: "I can't even see you guys from up here"

1

u/Excellent_Tubleweed 10d ago

xml notes that schema are a thing, peasants

1

u/kurotenshi15 9d ago

As a DevOps engineer first, YAML for life.

1

u/Alan157 8d ago

What about YARA?

1

u/blablafoof 7d ago

You can't just comment those out and still expect it to work.

1

u/Wentyliasz 10d ago

JSON > toml > yaml > CSV > pickle > writing down the data on a post-it note and retyping it each time > scrapping the data and having ChatGPT hallucinate a new set each time > setting the server on fire > xml

1

u/MIGULAI 10d ago

Binary data at that time

0

u/Curious_Associate904 10d ago

Meanwhile hocon

0

u/[deleted] 10d ago

Nah. XML

-1

u/nithix8 11d ago

guys i’m sorry but who’s this Jason?

1

u/Myself_78 11d ago

JSON Deruloooo

-4

u/KitaVixen 10d ago

JSON with its all " everywhere and problems if there is comma at end of something. YAML is better but still not perfect

0

u/[deleted] 11d ago

[deleted] — view deleted comment

-2

u/wildwildwaste 10d ago

The worst solution to a problem that never existed.

1

u/ZZartin 10d ago

Implicit arrays go brrr.....

1

u/schewb 10d ago

Hey, now, we can't say that about XML with CORBA sitting in the room