r/ProgrammerHumor • • 1d ago • Popcorn 1

Meme complexityWithSuperiorFormats

Post image
1.9k Upvotes

124 comments sorted by

206

u/CarolXZosiaNsfwScene 1d 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?

117

u/qisapa 1d ago • Bravo

Your boy TOML that’s outside of the frame.

24

u/WilkerS1 1d 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

11

u/Alarmed_Fudge_5706 1d ago

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

7

u/Xlxlredditor 1d ago

I profoundly dislike toml personally

16

u/cbehopkins 1d 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 1d ago • Bravo

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

3

u/TravisVZ 1d 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

5

u/jeffwulf 1d ago

Anything with meaningful whitespace needs to die in a fire.

0

u/xDannyS_ 14h ago

Yaml is good for config wym

12

u/another_random_bit 1d ago

looking up in disgust

This meme never meant this

4

u/Eptalin 1d ago

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

1

u/KeanerBike 17h ago edited 17h 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

275

u/RosieQParker 1d ago

If your syntax includes whitespace, fuck respectfully off.

52

u/decadent-dragon 1d ago

Yeah well if your syntax doesn’t allow comments, fuck off

We need a new standard

4

u/ierdna100 1d ago

One with somewhat standard schemas please!

10

u/Prawn1908 1d 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.

8

u/decadent-dragon 1d ago

Mainly for config files I want comments. Like, it’s not my fault node and angular use json for config, but they do. And there’s definitely times I’ve needed to add comments

2

u/Prawn1908 16h 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.

2

u/Waghabond 19h ago

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

1

u/Prawn1908 16h 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.

3

u/nadseh 14h ago

.jsonc exists

1

u/calculus_is_fun 1d ago

jsonc is a thing

-4

u/anzu3278 1d ago

If you need comments git gud

50

u/the_poope 1d ago

But it's HooMAnn rEAdabLe

18

u/za72 1d ago

I hate that shit

30

u/rowagnairda 1d ago

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

18

u/NorthernRealmJackal 1d ago

Python was a mistake

19

u/schewb 1d 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"

2

u/collabskus 1d ago

I used to really like whitespace  It made sense. 

Then I had to read other people's code

🥺

1

u/Alternative-Tie-4970 8h ago

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

1

u/Juice805 1d ago

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

0

u/jeffwulf 1d ago

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

24

u/DueButton7420 1d ago

XML looking at everyone from Hell...

38

u/Front_Committee4993 1d ago

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

56

u/xgabipandax 1d ago

CSV:

4

u/pingveno 1d 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 1d ago

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

2

u/Prawn1908 1d 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 1d ago

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

8

u/threewholefish 1d ago

So "true"

4

u/metaglot 1d ago

type: string

23

u/metaglot 1d ago

Yaml is not resilient against typos. Json is.

8

u/CWRau 1d ago

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

42

u/bjorneylol 1d 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

14

u/Suitch 1d ago

Like a space in the wrong place

-10

u/CWRau 1d 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 1d 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 1d 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 1d 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 1d 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 1d 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 1d 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.

-2

u/CWRau 1d 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 1d 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 1d ago

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

2

u/wd40bomber7 1d 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 1d ago

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

4

u/Suterusu_San 1d ago

Rust has me converted to toml

7

u/aweraw 1d ago

YAML is a superset of JSON since v1.2.

All valid JSON documents are also valid YAML documents.

4

u/Operation_Neither 1d ago

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

3

u/Spikerazorshards 1d ago

Let’s just go back to INI files.

3

u/Specialist_Dust2089 1d ago

As a json fan, I have no comments

3

u/ForgedIronMadeIt 1d ago

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

4

u/Elbinooo 1d ago

I hate both

6

u/nithix8 1d ago

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

5

u/ApacheFlame 1d ago

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

2

u/schewb 1d ago

John Serialization. The main character of modern digital communication.

2

u/Keyan_Farlander7 1d ago

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

2

u/Izikiel23 1d 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 1d 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 1d 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.

13

u/zthe0 1d ago

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

6

u/Doto_bird 1d 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] 1d ago

[deleted] — view deleted comment

1

u/crystalchuck 1d 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 1d 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 1d 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 1d ago

The only format worse than YAML is TOML.

10

u/xilyix 1d ago

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

2

u/mcellus1 1d ago

Can look but can't comment 🤫

2

u/GreenWoodDragon 1d ago

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

2

u/anzu3278 1d ago

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

2

u/TheWatchingDog 1d ago

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

7

u/GreenWoodDragon 1d 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 1d 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 1d ago

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

1

u/GreenWoodDragon 1d ago

Tabs for indentation, that's madness.

1

u/CWRau 1d ago

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

1

u/NewGuySham 1d ago

I see what you did there

1

u/0bsidianM1nd 1d 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 1d ago

Oh boy, both are shit

1

u/0ttr 1d ago

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

1

u/Xlxlredditor 1d ago

Isn't yaml a superset of json technically

1

u/Random_182f2565 1d ago

Jason and Yamal

1

u/greyfade 1d ago

The problem with JSON, though, is JavaScript

1

u/Enough-Scientist1904 1d ago

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

1

u/FFevo 1d ago

JSON for data. YAML for workflow definitions.

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

1

u/ryaaan89 1d ago

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

1

u/wurnthebitch 1d ago

No comment

1

u/86BillionFireflies 1d ago

Compact binary formats looking at text based formats.

1

u/notatechproblem 1d 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

1

u/__sean_eng__ 1d ago

Protobuff on the sidelines

1

u/TyrannusX64 1d ago

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

1

u/arcticslush 1d ago

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

1

u/Excellent_Tubleweed 22h ago

xml notes that schema are a thing, peasants

1

u/kurotenshi15 3h ago

As a DevOps engineer first, YAML for life.

1

u/Wentyliasz 1d 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 1d ago

Binary data at that time

0

u/Curious_Associate904 1d ago

Meanwhile hocon

0

u/[deleted] 1d ago

Nah. XML

-1

u/nithix8 1d ago

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

1

u/Myself_78 1d ago

JSON Deruloooo

-4

u/KitaVixen 1d 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] 1d ago

[deleted] — view deleted comment

-2

u/wildwildwaste 1d ago

The worst solution to a problem that never existed.

1

u/ZZartin 1d ago

Implicit arrays go brrr.....

1

u/schewb 1d ago

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