You can't write a comment about code you wrote if you don't know how it works either :very-smart:
Oh plenty of people who don't understand code make comments about it, it's just all the comments are on Reddit.
I cut my teeth on competition programming and now if anyone other than the compiler can understand my lightning fast spaghetti I feel like I’ve failed as a person. If I ever have a bug I just recode everything from scratch. Functions are only for recursion and passing as pointers. For anything else copy pasting will do. I have never used more than one file and at the start of that file I import every core library of every language I have listed in my resume. I do not know what the words “Third Party” mean. A coworker once tried to explain it to me and I reported them to our boss for violating competitive integrity. I force push directly to master and attempt to publish to production as soon as my code passes the trivial test cases. I never look at the same file twice. If someone yells at me I will recode the problem from scratch. I have a crippling addiction to Adderall. I get my error cases from server crash logs and user bug reports and call this fuzz testing. I have cost my employers upwards of $80 million and been fired three times.I excel at technical interviews. My salary is $480,000/year.
You can't fire me because nobody else will be able to parse what any of this shit does.
If I finish all of my tasks, I will be asked to take on more projects.
If I make it harder (or impossible) to finish all of my tasks, I will never have to increase my workload.
if you dreamed it then your subconscious mind thought of it.
this means 2 things most importantly you were working while asleep and in a just world would be paid for overtime. and secondly you should understand it
I comment sparingly because I unironically write self-documenting code.
Depends on what I'm writing of course and who will be looking at it, bash scripts that I expect the devs that I support to read are heavily commented because bash is completely inscrutable even if you write a lot of bash. On the other hand, properly-written ruby is basically runnable pseudocode.
If I run into anything weird or annoying that involves a lot of stackoverflow or deep-dives in the docs I'll link those in comments sometimes
On the other hand, properly-written ruby is basically runnable pseudocode.
Python too. In a programming class we were to to write, on paper, some pseudocode. I just wrote Python (but with the wrong name for the list append function because every damn language has a different name for it) and decided to include
!/usr/brain/python
at the top.Yeah, Python is like Ruby but the whitespace is loadbearing and the package management sucks
lmao loadbearing whitespace
and the package management sucks
I don't think I've used any language where the package management doesn't suck. At least it isn't Node.
Ah, but which of the five package management strategies are you religiously attached to? If it's conda then I know you work in data science, but if it's poetry then I know you work in OS packaging but don't actually write any Python! :very-intelligent:
I've had to support the infrastructure for some python projects, it's always been a huge headache from an ops standpoint in local dev, CI, and CD. Its target user demographic is data scientists rather than programmers and it really shows when you compare it to any other modern language (and quite a few older ones)
is there actually a package management strat called poetry
:crab-party: and Golang handle dependencies well by basically forcing you to do what you'd do with a Pipfile in python and then adding checksum validation to it (though the centralization of crates hosting for the former is shit)
Ruby's package management is great, honestly the gold standard. Honestly prefer Yarn/NPM to just about every Python package manager (poetry is ok because it's based on ruby's package management, but it's painfully slow because of how the pypi api is designed.) I've heard good things about Rust's too but haven't used that one yet.
I misspent an unfortunate part of my youth really trying to make strong, static typing work in Ruby. The temptation to say things the cute (i.e., "it reads like a sentence!") way is simply too high and feels Perlish without having the sort of wizardly cachet that writing Perl in 20XX has, lol.
I only comment when the logic gets a bit tricky or when I need to do some weird workaround, which is usually a small portion of the codebase, most of it is just plumbing, and if you need to comment your plumbing in length you've probably fucked something up in your design. There are exceptions of course but honestly most software doesn't need that much explanation if you have a few years of experience.
You should be documenting your public interfaces though.
If it's not legible it's better to rewrite it to be legible rather than adding more comments.
Sometimes this is not possible because the code is inherently complex but most of the time it is IMO.
Personally I don't have a problem with coming back to my sparsely commented code because unless I'm in a hurry I structure it properly so it's fairly easy to read. Usually it boils down to keeping your functions/methods small and doing proper separation of concern.
The same argument works for other people's code too. If it's not garbage it probably won't need a whole lot of comments.
Also during my years of professional experience I've decided to just bite the bullet and learn to read other people's code quickly. You're just not gonna get the required amounts of discipline to have nice clean documented code from your average developer because most of them (somewhat understandably) don't really give a shit about it, might as well just roll with it and try to not make it worse with your own code.
It gets easier after the 10th legacy shitpile you're forced to maintain.
Didn't even notice it was deleted.
If you expected unanimous agreement on things like this you're in the wrong line of work.
if you stole it whatever if you don't understand it you shouldn't use it cause then who the fuck knows what it'll do
There's copying big blocks of code and then there's "how the fuck do I initialize an array with dynamic values in this language again"
Alternatively: The same reason why people don't clean up while they're cooking. Because everything is on fire and they have to do 20 more things in the next half hour or nobody gets to eat