6 ms·
It's like every other article I read these days takes a strong opinionated stance and then gives decent but not overwhelming support for it. Please don’t.
by nebulous1 8y ago
It's like every other article I read these days takes a strong opinionated stance and then gives decent but not overwhelming support for it.
Please don’t. Ever. Not even once. It’s a really bad idea.
Followed by a list of reasons of which lack of comments is the only one with any universal weight.
- retrocryptid 8y agoyeah. i was somewhat surprised he didn't even mention "it forces you to use early javascript's type semantics." i mean... i agree that JSON isn't ideal for config files and comments are generally a good idea, but there's more than just that.
- mmcnl 8y agoWhat's even worse is the lack of a proposed alternative. These days I'm getting sick and tired of "X is bad and you should not use it" articles with X being something popular that everybody uses/does, without proposing a decent alternative. Tell me what I should do, not what I shouldn't do. The first one is very valuable, the second is just giving yourself a tap on the shoulder.
- h1d 8y agoShows how people just want to stand out from the average with elitism without decent back up facts.
- Carpetsmoker 8y agoAs the author, the reason I removed some proposed alternatives is because people kept emailing me with stuff like "but what about X?" where "X" was something I never heard of, or was only superficially familiar with. You make it sound like it's easy to just "propose an alternative", but it's not really. First off, some problems aren't necessarily obvious from just reading a few examples. YAML is a good example of this with a lot of subtle behaviour that can really trip people up. This isn't really obvious form just a glance, and required an in-depth review. So doing a full in-depth review of all alternatives is much harder than it might seem. Secondly, there is no single right answer. It depends on what you're doing, the language and environment you're using, social factors (e.g. if all tools in your company already use XML, then it's probably a good idea to stick with that), and probably a bunch of other factors. Alternatives that are better are also so plentiful that quite frankly, listing all possible alternatives strikes me as rather redundant. YAML, TOML, JSON5, or even eval(), and many more, all are decent alternatives for many different scenarios, although obviously not all. That JSON is popular doesn't mean it's a good idea. I think there is a simple reason that it's so popular: for quite a few programming languages it's the only file format that's supported in the stdlib, and people are already kinda familiar with it. This is not unreasonable choice at face value, but at the same time a lot of people don't always see the downsides at face value. "Tell me what I should do, not what I shouldn't do" sounds like a half-wisdom. Sure, it's probably more useful. But at the same time, pointing out possible errors people haven't thought of isn't useless. I've actually received quite a few emails over the years with the gist of "I wanted to use JSON for my program, but then I read your article and decided it was a bad idea so I used YAML instead, thanks!"; so clearly, it's useful for some.
- overgard 8y agoThat’s a pretty silly stance. If I tell you not to touch a hot stove do you expect me to give you instructions on what to touch instead? And if I don’t are you going to burn your hand to spite me? “Well if you don’t have a better idea I’m just going to keep burning my hand”
- adjkant 8y agoWell if you need to do X, then yes, you need an alternative. The alternative of not doing anything is worse in the case (or at least that premise seems to be accepted by the author). So if you say do X but don't use tool Y, then you need the alternative. Your stove metaphor breaks because the alternative of doing nothing have no consequences.
- overgard 8y agoIf you’re a professional you get paid to make these decisions. You don’t need a blog to do it for you.
- adjkant 8y agoYes, because doing any research on anything is not what professionals do, they just do everything themselves... Blogs are meant to offer insight and arguments, and all the top level comment is saying is that this blog did a bad job in that respect.
- overgard 8y agoAdvice on what not to do IS an insight. And there's an argument for why not. The idea that you have to give an alternative in order to not be "negative" or whatever when there's not a one-size-fits-all piece of prescriptive advice is just dumb.
- adjkant 8y agoYou don't have to offer alternatives but it does improve the piece. No one said it had to be one-size-fits-all, there's plenty of room for nuance.
- ehsankia 8y agoIt's almost like if different config languages have their pros and cons, and each can be useful in different use cases. I do wish though that JSON5 would become more widespread, as that basically solves every downside of JSON.
- overgard 8y agoMaybe you should be reading peer reviewed research papers instead of blogs.
- EdgarVerona 8y agoAgreed - really folks, it's not going to be the end of the world if you use JSON for your configuration. Or XML. Or comma delimited text files. As long as you agree to it and you have it documented somewhere, I promise your codebase won't suddenly set on fire because of it. Now, if you add programmability to your configuration files... that is asking for someone to abuse it and turn a simple configuration file into an abomination. I've definitely seen that happen.