Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
Get a devDuck
Rubber duck debugging has never been so cute! Get your favorite coding language devDuckBuy Now
Search - "declaring variables"
So, I've been programming a number of years, mainly .net, I've been looking at python recently and it just seems wrong to use variables without declaring them. It just seems dirty11
I lost points for not including the following comment:
int foo, bar;
I already knew how to code, and I completed the assignment in the fewest number of lines needed while still being well commented explaining my logic. I lost points because I didn't say what everyone understood.4
What's that? No ints? Use parseInt or Math.floor.
What are you saying? == works in strange ways? Yes, that's what we have === for.
Type coercion is wonky? Think it's weird how string + int works differently than string - int? Wanna string with number + - + - - + - - etc? Don't! Don't add strings and ints, don't subtract strings and ints. You can't in statically typed languages and you aren't supposed to in dynamically typed
Adding arrays and objects, arrays and arrays, objects and objects etc. is inconsistent? Why are you trying to do that?
Adding floats together gives odd results? Now we're getting somewhere! And Mozilla responded to that with a method called toFixed.
Declaring variables with var doesn't always work that well? Use let and const
Then there's this weird attitude that some people I've met have, where they will complain about the module system and how "well you rely on the community for those packages" as if it's a bad thing. And then coming with the "well you don't know what the (open source) packages do internally" as if I (for the most part) give a shit. Then they'll swear by companies like Zend or Microsoft as if they can't just stop supporting the languages they use. Maybe it's just because I like community content more because of video game mods.
Wanna criticize JS, then there's plenty to talk about. Like the built in date object is basically shit. Or how in NodeJS you can have node_modules in your node_modules. Or how classes don't really have the best syntax. Left-Pad. And so on (it's too late for me to be able to remember much more).1
The moment you're declaring variables but keep writing "ASS" because you're typing too fast...
Oh thank god!
Had an error in my COSMOS project and had no clue what was happening, so apparently cosmos allows you to cast using an interface when declaring variables and comparing yet it doesn't let you cast with an interface when trying to execute a function... The fuck?4
I've just noticed, the rest of the world says things like "your check is null and void," as if those two things are one and the same.
Meanwhile, to us devs, they couldn't be any more different! Something can't be both null AND void! 😅8
I saw one of my coworkers do a multi step bus ticket purchase in one file (we use angular 4) instead of using components he just hide and show the sections, resulting in a class that have about 2000 lines of code, unused variables, unused functions o just functions that console.log something, and many many lines of declaring variables. I tried to fix that, but this crazy deadlines were fucking with me3
When the college, that started at the same time as you, needs your help declaring variables after half a year in the company...