DEV Community 👩‍💻👨‍💻

Discussion on: You don't need null

Collapse
anonyme profile image
Comment marked as low quality/non-constructive by the community. View Code of Conduct
Anonyme • Edited on

EDIT: lol you got utterly btfo so you hid my comment and blocked me from writing new comments? Coward. Hope you at least learned something.


EDIT 2: you're still a coward and continue to reply to me while I'm blocked. but you don't even worth the comment I wrote. bye.


Second reply below, before I saw you blocked and edit this:

  1. Im talking about null in js and you answer in typescript. If you want to talk about typescript say "you should not use null when using typescript". Your article seems to be talking about js and ts alike.

  2. Are you really that much of a junior that you actually write your api json validations manually with if-else, and not using a proper schema validators? Have you never written any API before or are you just being dishonest when presenting your "solution"?

  3. You wrote your article in a very strong, clickbaity tone, then you go and hide behind that tiny disclaimer in the end. Stop acting innocent. You wanted to write an edgy and controversial opinion? Own it! And if you can't or don't have the balls to do so, don't write so boldly. Just say "why you should sometimes prefer undefined over null". But that's not cool and edgy and click bait enough isn't it? So you want to eat the cake and have it too, by putting your little disclaimer in the end. Real mature.

  4. Which brings me to the next point - why I insist on putting you back in place - I know juniors like you, you try to make a name of yourself by spewing out controversial edgy nonsense that may sound like they make sense, but are actually really bad. Problem is, other juniors pick up this nonsense and repeat it to sound cool and end up writing bad code because of that. Much smarter and experienced people than you decided null was necessary. There's a reason for that. You don't have to try and butcher every holy cow just for the sake of it.

  5. Json is not extremely fast, it's extremely slow compared to pushing bytes array, but its fast enough for most APIs which makes it ok. When you choose JSON for your API you make the decision of readability over performance, and that's OK for 99% of cases because json fast enough. But if you made that decision, you don't turn back and later uglify your entire API just to do tiny optimization. That's something a junior would do. Either your API is performance critical in which case you dont use json at all, or its not in which case you try to keep it clean. I mean, you don't rename keys from 'userName' to 'un' just to save few bytes right? That's equally dumb than omitting fields that should be null, and probably save a lot more bytes. But I do hope you don't actually do that...

In summary- nulls are useful, stop trying to sound edgy then run back to your disclaimer, and you dont sacrifice readability for performance when using json.

lukeshiru profile image
Luke Shiru Author • Edited on

I know you're new here, but the community of DEV is based on respect for each other, even if you don't agree with something, you keep it respectful. You already started saying this was "ugly" and the solution was "junior", but I let that pass because you're new and maybe it was a language barrier ... but then you went and insisted with the junior thing, "lack of balls", being immature, which was more ad hominem than an actual argument. To top it all out, you added that "coward" thing when you noticed you got blocked.

If you don't want to keep getting blocked by other users or banned from DEV altogether, I suggest you lower that a notch.

Cheers!

Some comments have been hidden by the post's author - find out more