Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API

From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "comments"
-
Pun of the day
Boss: I heard your colleagues hate dealing with code you wrote. Why?
Me: No comment15 -
Oh, man, I just realized I haven't ranted one of my best stories on here!
So, here goes!
A few years back the company I work for was contacted by an older client regarding a new project.
The guy was now pitching to build the website for the Parliament of another country (not gonna name it, NDAs and stuff), and was planning on outsourcing the development, as he had no team and he was only aiming on taking care of the client service/project management side of the project.
Out of principle (and also to preserve our mental integrity), we have purposely avoided working with government bodies of any kind, in any country, but he was a friend of our CEO and pleaded until we singed on board.
Now, the project itself was way bigger than we expected, as the wanted more of an internal CRM, centralized document archive, event management, internal planning, multiple interfaced, role based access restricted monster of an administration interface, complete with regular user website, also packed with all kind of features, dashboards and so on.
Long story short, a lot bigger than what we were expecting based on the initial brief.
The development period was hell. New features were coming in on a weekly basis. Already implemented functionality was constantly being changed or redefined. No requests we ever made about clarifications and/or materials or information were ever answered on time.
They also somehow bullied the guy that brought us the project into also including the data migration from the old website into the new one we were building and we somehow ended up having to extract meaningful, formatted, sanitized content parsing static HTML files and connecting them to download-able files (almost every page in the old website had files available to download) we needed to also include in a sane way.
Now, don't think the files were simple URL paths we can trace to a folder/file path, oh no!!! The links were some form of hash combination that had to be exploded and tested against some king of database relationship tables that only had hashed indexes relating to other tables, that also only had hashed indexes relating to some other tables that kept a database of the website pages HTML file naming. So what we had to do is identify the files based on a combination of hashed indexes and re-hashed HTML file names that in the end would give us a filename for a real file that we had to then search for inside a list of over 20 folders not related to one another.
So we did this. Created a script that processed the hell out of over 10000 HTML files, database entries and files and re-indexed and re-named all this shit into a meaningful database of sane data and well organized files.
So, with this we were nearing the finish line for the project, which by now exceeded the estimated time by over to times.
We test everything, retest it all again for good measure, pack everything up for deployment, simulate on a staging environment, give the final client access to the staging version, get them to accept that all requirements are met, finish writing the documentation for the codebase, write detailed deployment procedure, include some automation and testing tools also for good measure, recommend production setup, hardware specs, software versions, server side optimization like caching, load balancing and all that we could think would ever be useful, all with more documentation and instructions.
As the project was built on PHP/MySQL (as requested), we recommended a Linux environment for production. Oh, I forgot to tell you that over the development period they kept asking us to also include steps for Windows procedures along with our regular documentation. Was a bit strange, but we added it in there just so we can finish and close the damn project.
So, we send them all the above and go get drunk as fuck in celebration of getting rid of them once and for all...
Next day: hung over, I get to the office, open my laptop and see on new email. I only had the one new mail, so I open it to see what it's about.
Lo and behold! The fuckers over in the other country that called themselves "IT guys", and were the ones making all the changes and additions to our requirements, were not capable enough to follow step by step instructions in order to deploy the project on their servers!!!
[Continues in the comments]27 -
Announcing a few new devRant Android/iOS features, available immediately in the latest versions of the devRant app which just went live.
1. As pictured, you can now easily scroll to the bottom of any long rant by selecting “scroll to bottom” in the ... menu of any rant with >= 10 comments.
2. At the bottom of any rant that has at least 1 comment, you’ll now see a button that allows you to refresh the rant (and scrolls to the bottom) so you can see new comments if there are any.
3. Any rant can be refreshed by tapping the “Rant” title in the title bar.
How did we come up with these awesome ideas/decide to add these features? For most of them, we didn’t! At least 2 of these were recently requested by devRant users (some requested a bunch of times) and we heard everyone and saw how much these were needed. Remember, you can always suggested features in our GitHub issue tracker: https://github.com/devRant/devRant - we always appreciate feature suggestions and ideas for improvements!
Just to add one note - we still have plans to improve commenting functionality, but we’re hoping for the time being these additions make things a little more intuitive.
Let me know if you have any questions, and thanks everyone!22 -
Had a PR blocked yesterday. Oh god, have I introduced a memory leak? Have I not added unit tests? Is there a bug? What horrible thing have I unknowingly done?
... added comments to some code.
Yep apparently “our code needs to be readable without comments, please remove them”.
Time to move on, no signs of intelligent life here.39 -
Shout out to devs who put comments in your code I'm so done with my team rn
Also we have slack for a reason stop texting me to update everyone on changes...2 -
You know what really grinds my gears?
Seeing a 5-line comment, that have absolute no value, for a variable declaration.
Example:
/*
*
* String that holds a delivery address.
*
*/
public String deliveryAddress;8 -
I sometimes write code by first putting comments and then writing the code.
Example
#fetch data
#apply optimization
#send data back to server
Then i put the code in-between the comments so that i can understand the flow.
Anyone else has this habit?18 -
After opening the legacy code and finding out that the entire shit has 15000+ LOC and without proper commentsundefined devrant please help fbi fucking comment the code properly comments thensa legacy code notnsa devil wk58 god3
-
Writes program.
Doesn't comment code.
*Yeah totally gonna remember everything* 🕶
*5 weeks later*
what the heck was I writing.? 🙄😥😭6 -
Shouldn't be necessary if you just write understandable code xD..... Some people just write stories in between 2 lines of code....13
-
Just downloaded some big ass codebase and the first line i read is:
"// The source code is not well documented, but every advanced programmer will be able to understand it after some time."
Well... let's find out about your definition of "some time", Dickhead!3 -
Anybody else here has a coworker who insists on having comments everywhere and writes code like this?
// Get foo
foo = getFoo();
// Check if foo is greater than bar
if (foo > bar)
Or is it just me?21 -
I hate myself. Really.
Last week I wrote a function to handle file uploads and at some point I left this very useful comment.
Do I know what to fix? Absolutely fucking nope.
I want to punch me from last week in the face9 -
The proper use of comments is to compensate for our failure to express ourself in code.
Quote of the book "Clean Code" by "Uncle Bob".
#ShotsFired6 -
Another stack overflow rant.
I had a disagreement with a self proclaimed "high repper" last night. We exchanged words in the comments of one of my questions.
Later (about ten mins) i see that another one of my questions has been closed and marked as duplicate - by this same fuck-knuckle. He has obviously gone to my profile and then gone out of his way to harass / bully me by doing this.
The 2 questions are absolutely not duplicates and he has marked them as identical.
I go to his profile and his headline thing is
"Low reppers hate closers but they need to go bitch about it elsewhere"
If anyone on here doesn't understand why SO gets a bad rap, it's specifically due to complete cunts like this guy.
If you happen to be on here and recognise yourself from the really cringy "low reppers" comment on your profile, then all I have to say to you is that you are a complete an utter ballbag; a tool; an arsehole of the highest order.
Fuck you and all your spawn.10 -
"A common fallacy is to assume authors of incomprehensible code will be able to express themselves clearly in comments" -Kevlin Henney1
-
Shared by codechef on their Facebook page. Not sure who the original author.
But it sure does make a pretty good header for your code. ;)
#DontMessWithMyCode3 -
!rant
Someone just downvoted four of my answers on Stackoverflow just because I commented on one of his answers that "please include some description, just code won't be helpful"
PEOPLE IF YOU CAN'T ACCEPT YOU ARE WRONG THEN GET THE FUCK OUT FROM OUR COMMUNITY AND STOP RUINING IT.2 -
This is how most comments in code are. Why are you telling me it's a coffee cup, I can fucking see it's a coffee cup, who owns it and why is it right here? Are you putting coffee in it or something else?6
-
Sometimes I go ridiculously hardball on my comments in order to gain a better understanding of what I'm trying to accomplish2
-
Our PM found a contractor, results as expected..
Contractor: "The file you supplied is corrupt, some areas are greyed out and damaged"
Me: "😐, do you mean the comments?"
Contractor: "I'm not sure what you mean 'the comments'"
Me: "Does the file work as expected?"
Contractor: "Yes"
Me: "Strange! I'll have a chat with our PM and get this issue resolved right away 😉"
...
if(!contractor) {
return Promise.resolve()
}1 -
If you're gonna comment a lot or a little, at least be consistent. I just read some code like this:
//prints "are you ready?"
printf("are you ready?");
//get the value
int findVal(int x) {
/* some fucking complex algorithm with no comments whatsoever that seems to have an error messing everything up */
}10 -
I worked with this guy at a startup one time, and just to annoy me, he would write commit comments describing how I was such a bad developer, or how I was such a horrible person. After like the 15th time he did this, I decided to be totally unprofessional and do the same for him... our commit comments quickly turned into a conversation where we would just insult each other (as a joke).
The original developers of the startup no longer work there (including me and him)... I wonder who's reading those comments now.3 -
Hi guys,
I did disappear à long time, you know personal problems...
But I'm back to work now, and I was watching cppcon, when...7 -
my own program is confusing me :)
it'll be fun waking up tomorrow trying to solve a hard problem…
oh shit i forgot to add comments🙃2 -
I am sure this has happened to all of us in some extent with some variations.
Colleague not writing comments on code.
Ask him something like "How am I suppose understand that piece of garbage you have written when there is no comments or documentation?"
This keeps happening for a long time. Some time after, I write a kernel module using idiomatic C and ASM blocks for optimizations (for some RTOS) and purposely not write neither documentation nor comments.
When he asked for an explanation, I answered to everything he questioned as general as I could for "that trivial piece of code".
After that he always documents his code!
Win! 🏆4 -
When my coworker doesn't want to believe his code is inconsistent, yet he changes the syntax for commenting 3 times over 10 lines.14
-
Fuck the way comments work in xml. I want to write a 2 word comment but before that I apparently have to make an ascii art mona lisa. Infront of and after the comment.5
-
I just finish "rebuilding" a page that I have built last year. My Js file (jQuery) went from 1200+ lines to 600..
I rewrite everything, the functionality is the same but the code is mush more cleaner.
Soo bad and redundant code.
Although comments where very helpful.
Feels good. -
The one who said "Code should comment itself" must not have used assembly.
I literally wrote this 30 seconds ago and I can't work out what it does now...1 -
Add no comments or documentations whatsoever during my initial years of coding (when actually I used to write code worse than a constipated elephant's shit).. In my mind I would be like "This is quite clear-cut.. A first grader will be able to understand this code.."
But then I had to debug my own code barely some 1-2 months later and I figured out the importance of good comments and documentation..3 -
Comments should describe the why and not the what and always be up to date ... or this will be the result.2
-
Inherited project from another company that the owner wants updated rather than rebuilt.
The comments could write a programmers joke book as you can tell it's been passed between multiple developers.
This is a literal excerpt
//Not sure why this line needs to be here but it breaks without it
//Nope I don't know either
//FFS now I have to deal with this. Thanks guys :/2 -
literally lol'd out loud when I saw this. Found in the source of popular event loop library libev, in ev.c line 214:2
-
A list of hilarious comment in code:
http://stackoverflow.com/questions/...
One that I liked in particular:2 -
So my co-worker loves to tell us to comment our code, for obvious reasons.
But now I'm debugging his code, and guess what.
No comments.
Okay, maybe two comments in two different queries, but they were not that helpfull.
So now I have to debug his code, and I have no idea what I'm even supposed to look for!10 -
Please remember that comments in html do not start with //. This comes from the website of one of the most important gas and electricity distributor in Italy btw...2
-
Me: Can you do the javadocs comments
Coworker: I've never done that, *looks for it on google*, I can't do it, I don't know how.
Me: Did no one asked you to comment you code at school?
Coworker: Yeah, but only the ones with '//'
Me: Ok, bring me coffee1 -
Is it normal for every stupid, arrogant, selfish person to talk all kinds of bad stuff about my app and attack me personally on the play store? It's just a soundboard and it's free you pricks, be grateful for once and don't mind the god damn ads so much. I can't believe that shit.5
-
Yeah, thanks for blocking my comment but can you help us tell these fuckers to include what they have tried before posting?4
-
Don't you hate it when you come across a old internet argument but one of the people deleted all of their posts so now you just see a bunch of out of context replies.3
-
I have a coworker who comments every line of code he writes and it doesn't matter how simple the code is and it drives me crazy when I have to look at it. A real life example:
// Gets the total length of the server name string
var total = serverName.length;8 -
There are still old youtube comments from my younger self to be found on youtube. Delete every evidence!2
-
The codebase I'm working with hss rarely comments on it. But when there are comments written they are shit like:
//Kill Matt
//don't ask me where that hard-coded value came from, it just works
//we have to add the elements to the fucking list
Reeeeally helpful. Yep.1 -
Friend - could you comment your code, so I can review it pls.
Me - *comments "gets shit done" ,
"Does some shit ",
"I really don't like commenting my code "4 -
Code reviewer keeps removing my comments saying, "This will only be read by other programmers, the code should speak for itself".
<hyperbole>
This is the exact opposite to back in uni where for every line of code they demanded 2 lines of comments!
</hyperbole>9 -
“Good comments explain why, not what,” says Andy Marks. “Do more of the former and none of the latter. A well named method or variable will beat a well-written comment every day.”2
-
Your favourite comment?
My team was working on a legacy system, one part of it is an assistant, sadly required as global variables.
Being a non-english-first-language company, some dev years ago thought shortening said assistant to "ass" would be a wise idea - less to type, right?
When we redid the application 2016 part-by-part, our code needed to define 3-4 global variables starting with the "ass" prefix for the legacy parts to work. The colleague who was tasked with this is a fine gentleman from England.
Later as I read through the commit, I found 5 lines of code following 20 lines of comments explaining and deeply apologizing for "ass", "ass_open", etc.
The same dev also had a "HACK OF THE YEAR" comment he moved around when time constraints made a less-than-optimal fix necessary which was worse than the last "highscore".1 -
gotta love them comments:
#TODO: move this,
#TODO: deprecated,
#TODO: fix this,
#TODO: DON'T DO THIS,
#TODO: refactor,
#TODO: CHANGE THIS
I shit you not8 -
I (don't) like how some people say "If your code needs comments, your code is probably ugly and should be rewritten".
Well, asshats. You have never considered complex calculations/functions or "temporary" workarounds, right?
Sometimes, you have to do it in a not-very-readable way for efficiency. There is no way around that in that case, and comments that either explain the code below or provide alternative, slower code that's commented really help others understand your code.
If I ever work with you and you don't bother commenting your code at all (or rather use slow code because more efficient code doesn't appeal to your "muh code dun need comments" approach), I will hate you.6 -
Haven't coded for a few days, returned to my github project to find one of my co-workers has gone through every single line in all of the scripts and added passive-agrresivd, sarcastic, comments about what they do.
Thanks.... I guess....5 -
/*Why this website does not use slashes to the front of all the comments on a rant is beyond me!*/4
-
Code comments #1: A way to document bad code that wasn't reduced to it's essentials and thus unreadable. Bad.
Code comments #2: A way to explain for non-programmers how the code works. Wrong place.
Code comments #3: Company policy. No one really knows why, but others do that, so we better do it to. The management sucks.
Code comments #4: Because some hip methodology/guru describes how to document code. After a few years, when the methodology has been (unofficially) forgotten, everyone still comments the code the same way. The old management sucked.
Code comments 5#: For insecure programmers who want to convince them self they understand the code they've written. Maybe apply at McDo?
Code comments #6: Some programmers are apparently paid by lines of code. Possibly understandable.
// Comments, anyone?8 -
When you find a 'TODO' comment deep in a crucial function, that you know have been there for at least 5 years. :S
-
"There are only two hard things in Computer Science: cache invalidation, naming things, and off-by-one errors."1
-
Back then when I was working on a website logic, I didn't want to comment my code. Despite that, I wrote some things which were obvious and I thought it would be funny to explain obvious things in code. I made a joke out of commenting.
Recently I needed to use a part of the code for a different project and the comments were exceptionally helpful and I would be lost without it.
So, kids, comment your code!11 -
I let my programming buddy comment all the code I write. He's great. His comments looks like this:
/*
I am groot!
*/1 -
I Remember what my senior told me once:
"You know you're in the wrong job when you see source code filled with comments written by ur senior dev scolding other devs for code fuckups" -
Start-up I'm working for as a front-end dev is pretty nice. I have good hardware, free coffee and my coworkers are all decent people. My boss is chill, and I have flexible work hours.
There is this one policy for writing code, however. And I simply cannot understand it, nor can I ignore it because of code reviews: no comments in production code.
I mean, what? Why? Comments are nice, and they make life easier for the future maintainers. At least let me put a small two-liner explaining why I did stuff this or that way. But no, I only get to explain it verbally (once) to the person reviewing my PR. Why, man?9 -
If you comment your code like this, I'd like you to rethink your life choices.
This is a project we need to work on in university. The code was given to us.4 -
While I was still in University I didn't valued much the importance of comments and documentation, mostly because my projects were small and I was working on them by myself. Frankly, writing comments felt like a waste of time those days.
Now that I'm a junior developer working with an existing code base and together with other devs I couldn't be more grateful seeing those green lines of human readable strings. Without them I would have struggled more and probably been less productive.1 -
I have always believed that clean code is readable code, and if your code is readable, then it shouldn't require masses of comments to explain it. However, in the course I am being taught, we are being told that in programming, comments are massively important to help another developer understand your code and what it does. So what is the consensus of the dev community?
Do you feel comments are key, or redundant if your code is written well?16 -
Some people seem to dislike Stack Overflow, but I remember it from the time when it was much funnier. In those days I, for some reason, thought the web is a scam(free _correct_ answers? kiddin' right?).
Here you have some pearls from comments and even code. It's worth reading! ^^
http://stackoverflow.com/q/184618/...1 -
Just read this comment in my code from a few months ago... I guess I was in a strange mood at that time..
// Listen for fuckers. Also known by their muggle name: users.2 -
Let's try this.
In the project I'm working there is an strict rule : NO COMMENTS!!!
I mean wth, the times I've spend hours trying to understand the crappy legacy code in VB.Net that has been there almost decades, that wouldn't happen with comments, I know i know there are some supernatural developers that think in binary and their eyes work as compilers, but I'm not like that, so seriously go to hell.
P.S. Of course I follow that rule, after all, my code is so damn perfect that even a baby can understand it.
jkundefined devops etiquette stupidest pichardo for president stupid stupider stupid stuff jk rant code smells comments3 -
Maintaining old code as comments, coz... you never know when that bug in your commented code turns out to be the next big feature.5
-
HOW. IN THE WORLD. COULD IT BE SO DIFFICULT TO COMMENT THE CODE I WRITE MYSELF ?
After my first project (you know, the "Working project I made for fun long ago" code everyone did once, but when you look at it again it looks like sorcery and there's no way to understand it ?), I decided that I'd comment almost everything I'd do... But...
When I begin a project, it's fiiiine and I do my comments the way they should be... AND THEN, WHEN DIFFICULTIES ARRIVES AND I START TO BE TIRED (ie : always) THEY START TO INCLUDE INSULTS OR WEIRD JOKES ABOUT THE PROGRAMMING LANGUAGE, MOVIES REFERENCES, AND SOMETIMES THEIR LANGUAGE VARIES. (Like, that project you're doing in English and suddenly there's a comment written in French in the middle of that)
Soo, yeah, even if I do comment my shit now, it isn't more helpful, lol. Maybe I should listen to relaxing music when I code err.
Oh, comments. Damn comments. Someday I'll do those correctly. Maybe.8 -
I just took over a new project from a brand new client today. It's an Android app that he said needed some updates and refactoring, and he said it wasn't well documented but he would add some comments for me before giving me the code. He gave me access to the code today and one class in it is over 1200 lines long with exactly 4 methods in it... the shortest method is still over 200 lines long. There is one comment at the very top:
// Needs refactored.
... gee thanks.2 -
I hate to write clutter comments! Honestly, comment every method is fucking stupid.
If I have a method that is called "getCalendar" that takes as parameter "timestamp: Timestamp" and returns "Calendar", then I don't need to write:
/**
* Create a calendar from the given timestamp
* @param timestamp Timestamp from which the calendar is created
* @return Calendar Calendar returned
*/
I understand why we do that in older PHP versions, in which we need that for IDE support.
I understand why we do that if the javadocs are automatically created.
But that's not the case here. It's just a coding convention and all it does is make me not read comments anymore. Because they are everywhere. The code is often shorter. And I chose the name getCalendar because it already describes perfectly what it does.
There is a time and place for a comment. Something like this:
def getCalendar(timestamp: Timestamp = Timestamp("2018-03-14 00:00:00")): Calendar
Here I'd like to read a comment like:
Defaults to 2018-03-14 because that is the founding day of the company. No timestamp can ever be earlier until we have invented time machines and in that case stop me from writing this comment.
Okay, being serious, a default date that like that warrants a comment. Comments have their place. But when you put them everywhere, I stop reading them. And you just devalued important comments by cluttering everything redundantly.
Oh, and guess what happens when you change what this method does... You will forget to update the comment.
Fuck clutter comments.16 -
When you accidentally commit and push code that has massively commented out sections that you meant to remove >:/
-
The student assistant gave me a half point penalty for writing down to much comments! Direct translation:
To much of this kind of comments is not needed, the code itself is clear on its own.13 -
*Writes something I think is clever
*Write like a 3 sentence comment explaining why it's clever.
*Smugly run.
*Doesn't work.
*Quietly erase line and comment.
*Repeat -
OK people, I don't need a novel written for every line of code, but PLEASE STOP trying to tell me that "yOuR coDe sHouLd bE sELf dOcUmeNtiNg aNd cOmMenTs mEaN iT's aUtoMaTiCaLLy bAd". That's a bunch of BS. I can't begin to tell you how many times I've saved my own butt by dropping a "this call can't be awaited; causes the library's internal API to throw an error" comment in my C#, or a "can't use double quotes here; doesn't work right for some reason" line in my JavaScript. Sometimes there are very good but un-obvious reasons why something was done a certain way, even though it looks like it could be done better. And don't try to tell me "the tests will catch it". Let's be realistic here, nobody has 100% test coverage on any project that's much more than "Hello World". And even if the tests DID catch it, why waste the time when you could just write a comment?
P.S.: This is not directed at anyone on here specifically. It's directed at all the devs I've met IRL and the comments I've seen on SO, who think that comments must be bad.15 -
Last 4 days, struggling to get ship it from a Dev who is reviewing my code.
The comments have already piled up more than the LOC submitted.
The code review consists of just 2 interfaces and a pojo. Hardly 20 LOC in total, excluding javadocs.
I hope it gets ship it soon.
Wish me luck.2 -
So, Instagram put that "Be the first to comment" as a part of the background on the image itself. Whenever I scroll past comments that is visible in between the gaps. They couldn't even render a simple text view if there are no comments. And, I thought I was the only one who uses lazy hacks to make things work.2
-
Must read --> What is the best comment in source code you have ever encountered?
https://stackoverflow.com/questions...
Best comment there:
//When I wrote this, only God and I understood what I was doing
//Now, God only knows5 -
I am glad that I usually include comments, which make me smile years later...
What are your best findings when you look at your old code?
something like:
// having any and all at the same hierarchy is not valid (and stupid)
someMistakeDeep: 1 // deep fail
// TODO: find out, why the cache is behaving like this. And fix it ¯\_(ツ)_/¯
or my all time favorite comments
// this should not happen.
// wat?
or testing emails like
- tldsAreNotCheckedBTW@something.idontthinkthisdoesexist
- nonValidEmail.com
or urls...
- ProtocolMissing.com
- www.stillNoProtocol.com
And when I'm out of ideas, something like this
messageContent: 'Bla Bla Bla. Exception in FS on Host https://w.com/hpsa',
{ SmsVerb: 'randomVerb' }, // unknown Attribute6 -
That moment during your internship when you work on a project using a framework you're not familiar with, with no doc, and absolutely no comments, and you find a file with 1.3k lines of code without the ability to contact the previous dev4
-
Why the heck would you allow (or need) nested block comments? Imo this is a major design flaw in the kotlin linter.
I always use /*... //*/ so I can remove the comment starter w/o having to remove the comment end, but kotlin just starts a second, nested comment there.
Java, C, Cpp, C#, JS,... Not one of these uses nested block comments. I think jetbrains was just lazy?
I mean, I know why such stuff happens. I also developed DSLs in MPS, but there sure are ways to go around such things..7 -
!rant
Having lots shitty comments and lots of shitty rants is like having passive income, the ++ come slowly but surely. -
When a user deletes a comment, it would be more ideal if the comment was tagged *deleted rather than entirely removing it. Sometimes this makes other people's comment sound out of context whereas they where referring to a previously existing comment.33
-
/* Spending time writing comments in code because if everything else fails, at least I can write a novel depicting a deteriorating struggle to make up my mind from them */
-
Download an open source project and look for code comments to get my understanding... Nothing but 'todos' here and 'todos' there
-
So I did a code review for a colleagues pull request and I've noticed that he hasn't written the PHPDocs for a lot of the classes and functions. One minor thing I wrote is to add the author for the class.
About 2 mins after writing that comment he came over to tell me why should he write the author in the comments when people can just go look at the git commit logs. I was like WTF? I asked why would he do that, his answer was that if there's an issue, we can just use git blame to identify the author. To me that makes no sense as git blame isn't supposed to be used like that.
It's guys like these are the ones who don't document anything whether in an online document or even in code. And they just make work harder for the rest of us.2 -
"Sorry, but nothing in this MR is as it should be (I don't even know where to start) - all you do here is waste scarce CI resources"
Much helpful. Such wow. Teach me how to make such toxic and useless merge request comments.7 -
What's your opinion on leaving funny notes in comments from time to time? Is it highly unprofessional or you don't mind them if they are sparse?
I found this on GitHub jebej/Schrodinger.jl7 -
That feeling when you're finally done with a pretty big PR and ready to go live. You excitedly send it out to a few of your peers, and then... 20 comments! The real work has just begun 😭1
-
COMMENTS BE LIKE...
Physics exam. Seems I was the special guy who did the task in a different (and almost correct way), so my teacher had to share some golden thoughts with me.
Passed anyway xD7 -
Dear last dev, thanks 4 leaving little 2 no //comments as u possibly could. 😑😣😢😠
Please //comment ur code!!1 -
"Multiline strings can be used as block comments in Python." Except in some places, where your code will pretty much blow up without any errors, because instead of commenting out a portion of an array, you've just added one big string element. And there's no other way to make block comments. And after actually commenting out every single line, your version control won't know how to merge it anymore, because there are now 100 changed lines instead of 2.6
-
Just realized that the scroll position indicator dances when scrolling through a long list of comments 😄, and I think that's beautiful1
-
So Ive to make new screens in xaml in combination with C# (WPF)
So I had something like this in the codebehind
titleBox.Text = Properties.Resources.someKey
The resources looks like
<data name="someKey">
<value>some text</value> <!-- this is some comment --> <!-- and another one -->
</data>
The title got as value "and another one", when I removed it it became "this is some comment" removing that resulted in the value "some text"1 -
Me: I'll comment that later
Also me: Why tf isn't there any comment
No seriously, comments and documentations are really necessary. Today I've been debugging for hours, why a certain variable has a certain value. Age of code: 15+ years. No comments. No docs. 🙃5 -
Me:
let's ask for advice about open source publishing.
other devRant users:
let's start a discussion about what git service/website is the best in the comments.2 -
int i = 0; // i is an integer initialized to 0
wtf?!?!?
comments should explain why not how or what the code is doing...1 -
It turns out 1200+ comments on a rant breaks devRant, I can't load the comments section anymore without the app crashing.
https://devrant.com/rants/2420819/...
On a other note, where did the block feature go?7 -
Code doesnt work, i dont know why
*comments then uncomments same line*
Code works, stilll dont know why2 -
At the risk of starting a war, what are folks opinions on in-line comments?
Personally, I'm against them. Self documenting code for the what, SCM for the why.
Comments can get out of date if not maintained; code cannot lie.9 -
Awful idea of the day - Have a programming language with no comments, but regex preprocessor macros. Use macros to define your own comment syntax and strip them before compiling.
#define /\/\/.*//1 -
Why commenting is important?
If you are commenting a variable or method and you can't find the right way of explaining it, there's a problem with your code6 -
If you have any project (personal or not, doesn't matter) that does not have proper code comments and documentation and you don't want to make one because of the effort (maybe even "wasted" effort), think again. When commenting on a wall of code to say what it does, you may find a better way of doing what you have to do, possibly increasing performance, or improving security.
I have been able to do better input sanitization for a method on a personal project of mine because of this.
Don't use the amount of effort for proper documentation as an excuse not to make one.2 -
Picking up some uncomment code:
var_dump() and console.log() everywhere
1h later: shit I think I lost it again...
2h later: It was a 2-3 lines fix..
fml1 -
So I fix a bug and I create a PR, someone reviews it and leaves a couple of comments, I address those comments and push up my updated code thinking “great I should be ok to move onto this big story waiting for me”
Then some Expletive.random(); from a totally different team who has no context of my change comes in and starts leaving petty comments. He literally pointed out 3 different things that could be made private/package-private.
Bugger off and focus on your own team’s work instead of leaving comments about relatively trivial things on my PRs.
Apparently he is well known for this. I can tell we are gonna have some fun encounters...1 -
When Google (or other companies) make AI that makes another AI or code does the original AI write comments?4
-
Bugs are good in code. It shows that you're Human. You make mistakes. And you're willing to correct them.
But when they're someone else's bugs in a piece of code they didn't give a flying fuck about documentation, bugs can tick one off. The bigger the project, the better the documentation needs to be. And I'm not taking about java docs. Put proper comments in your code. Especially when it's not a personal project and you fully intend to leave the company. -
Going back to a project from a few months ago, a fellow dev has committed 'test this' comments with my name...
Hitting up git blame shows my tests were written 2 weeks before! If you're gonna be passive aggressive, at least do it right :/ -
I saw this piece of code, one of my colleagues at work wrote it.
The content in in the function also had 0 comments.
Sorry for posting this here co-worker but it sincerely bothered me.
// Delete all
function deleteAllFunction(){
...
}5 -
One advice I've given to most junior developers which they've practically benefited from is...
"Avoid duplicate comments between interfaces and their base class at all times".
As a smartly-lazy dev, you shouldn't enjoy writing same thing multiple times... be it code or comment, don't write it twice!4 -
Hilarious comments check it out on the cancer (stackoverflow.com) 😂
https://stackoverflow.com/questions... -
I've finally got into the habit of writing descriptive comments in my code. I've always just got so into the coding and comment later when I don't know what the code does anymore xD1
-
"The call to the tracking was removed by the previous developer months ago" the eccom manager thought......4
-
!rant
In my team, I am not allowed to use ANY comments except for the really lengthy classes in the backend.
Thus, the code of the whole project (a complex webapp, consisting of 20-something Django projects and various services) is basically undocumented.
The slogan sounds "good code doesn't need commenting".
Seriously, fuck this and all of the times I scratched my head wondering "what the fuck is this spaghetti about".
Have any of you encountered something like this? Usually people don't want to comment, I would do it gladly but can't even make a small inline about what complex method is exactly doing :P3 -
At the risk of starting a riot. What is your preference?
// space before comment text
//or jammed up next to it?
// Furthermore, do you capitalize your comments?5 -
What's worse than no comments? Outdated comments.
If you won't maintain your comments, I'd rather you don't comment at all. We are all better off for it.1 -
In CS class I had a only 10 lines long python script (everything else was commented out). It didn't work and I searched the bug for ca 20 minutes. I asked a class mate (who commented the other code out) if he could figure it out and he just says: "The indention of the comment is wrong". We had a discussion that it doesn't matter how to indent comments. In the end he selected all the lines, pressed tab and it just worked ?!?!6
-
when my rant get more than 5 comments.
#out of memory exception#
just drop it, unfollow and let them comment.
😜7 -
"My code is explain itself. Well, I need no comments to understand it."
I don't care if you wan't to write comments or not; If don't write any then i don't care because fuck you and your code.
May it be java, kotlin, python, javascript or anyother language, you think "everyone can read", i hope you'll never find anyone who has to deal with you and your cancerous code.joke/meme the code explains itself explain code javascript cancerous readability fuck kotlin dealing with other people comments java7 -
There must have been a person, a developer, probably in the 80th, that came up with the idea that reflection can read comments, so he can add annotations or if statements in comments.
I don't say we should shoot him.
But we should think about a terminator and a time travel program.3 -
Some time I just love comments that are brain twisters.
```
( [ helpers.must_not(helpers.prefix("response", "10")) ] if _type=="detractors" else [] ) )
# Above line prevents the condition 10 is 1 but 1 is not 10 making 10 is 10 and 1 is 1 and 1 is not 10
```1 -
I always enjoying snacking on some popcorn while people argue so, what are your thoughts:
Comments in your code - good or bad?4 -
Are there any *performance benefits* in having your users comments on a separate page rather than the actual post/article page?
Example use-case: medium.com7 -
I was looking around an internal app that we use, and found this under group permissions.
Glad they're paying attention. -
Writing documentation is one of those tasks that most developers don't like doing. Especially when it comes to writing in say a Word/PDF file, an online wiki, or Confluence. It's time consuming and a pain in the ass.
But even if you don't like it, at least write comments in your source code! I hate having to keep writing "Write the PHPDocs for this class/function" in every pull request that I review. It's wasting my time writing such comments when it's such a basic thing to do when writing source code.24 -
That moment when the code that was supposed to be removed in only commented out!!! The guy butchered a bunch of classes by commenting out about 1000 lines of code
-
Just made a damn fool of myself with a client. I handed off three projects and they had no idea what they were for and neither did I. My boss gave me these months ago. No code comments, no documentation, just some stored procedures they wanted me to actualize.
The best I could offer was to promise the client I would send a description of the projects to them as soon as my boss gets them to me. Fuck. I thought the client would know what they asked for when I showed them, but fuck me, they didn't remember. So embarrassing. 😡😡😡 -
If you write comments for your functions (you should) do not use param names as param description! This is fucking useless.6
-
I tend to write with long variable names instead of using too many comments to explain what i am doing in the code. Is it wrong?1
-
When comments find their way to class tests:
“TODO: Finish conjugation of montre in the whole text”. I had no idea of the conjugation and finished under time pressure so this stayed in the class test (gave it back last second) and I was well aware of it.
Just wondering what the teacher must have thought. Didn’t say (or write) a word about it tho.
Should see if someone tweeted or posted this (I mean someone wrote a book only with examples of stuff like this)
Idk, I should ask if I’m allowed to write class test in an IDE. And set MARK, TODO, etc. Would make them a lot easier.27 -
This is the first social media I actually like. Came from codingconfessional because there's way less cancer here. Y'all rock.
I left a '# fix this thing here' in production code :/ I make myself feel better by pretending it's a hashtag.2 -
Comments throughout code with things like "changed to fix bug #". And commented out code all over.
We have source control, why the hell are you doing this? -
"Rants and comments can only be edited for 5 mins after they are posted."
5 mins is not fair; I think it must be at least 30 mins (or an hour).3 -
Comment introduced by a commit 3 years ago before an empty function:
```
%% TODO determine if there needs to be something here or if this can be removed
```4 -
There is ads now appearing in the comment sections of certain post .. so far I've seen one, but it's a matter of time before more appears. Is there a spam filter ?6
-
I've always found commenting my code tedious, is it better to comment as I code or wait until its stable and then comment all in one go at the end?12
-
It is better to write almost all of the logic used in the code as comments/documentation.
Trust me.
It is a good thing. It increases Code readability.
Nobody is going to copy your logic and get hired in a high paying job or get promoted for that reason. People will come to know about your wit and will appreciate you instead.2 -
Recently took over a freelance project to update an existing app, and this thing is full of comments like "TODO: Remove This" with no context. So hard to work with.
For the love of God, add some context to your comments. Especially if someone else is going to be seeing your code. -
#get unique images ids
images_ids = np.unique(images_df.index)
Dear developer who wrote the code I'm looking at,
thanks, I really need comments like this one. I was wandering lost in 1500 lines of code, looking for an explaination of what the actual fuck the code is doing, and there I see you, comment. It's not like I want to know what the hundreds of lines functions do, who cares about that. What I needed to know, what shed light on this dark forest, is what the numpy functions do, because as you certainly know dear developer, such functions are really hard to comprehend, lacking of documentation.
Thanks.2 -
When I got at least 20 comments for a mid-sized changelist and managed to dodge/reject the suggestions provided. No questions asked further and it was committed!
-
Stack Overflow question on best comment ever. My fav:
try {
} finally { // should never happen
}
http://stackoverflow.com/questions/... -
Feature request:
OP gets ++s for different stages of comment amount.
E.g.:
5 comments = 1++
10 comments = 2++
20 comments = 4++
40 comments = 8++
...
;)15 -
When you are changing and updating your code update your comments/docs also, there's nothing worse than getting confused by someone else's code to find that the comments/docs are wrong
-
Whoever left this code with comments like “Le JavaScript” or “Le HTML 5 Shim” I wish you immense anguish.3
-
When Eclipse releases a powerfull Project configuration tool with not a single line of helpfull comments and I have to pleasure to add Features for my Company ....6
-
It's always nice when I get back to work on something I shelved and I find notes from Past Me anticipating my sub-goldfish memory.1
-
When people use comments for build configuration. And don't put down handy comments like "uncomment this if you want to do that".
I guess what I'm saying is that this "code cleanup" task is turning into a "code keep the bloated baseline" task.3 -
What is everyone's preferred formatting for functions/if statements. Does the first curly brace go on the same line or a new line?
function 1() {
}
or
function 2()
{
}14 -
Once I wrote a tool to help convert alarm messages from an excel sheet into an xml file with other specific things included.
My colleague (who is very proficient at coding in his chosen system) while I was writing said tool asked why I was commenting code as it was basic!
I asked him to work out what my code was doing (it wasn't mega complex) he spent a long time googling! -
Making classes and functions without commenting what I expect each class and function to do. Which means that my classes and functions have really long names.
Example Code:
Class ReallySpecificClassToWorkWithThisFramework { ...
public void DoThisActionInTheFramework (obj TheKeyToTheWholeFunction) { ... }
} -
Was tasked with going over an app that my company owns to see what aspects of it we can use for our next project. So, I checkout the codebase in Android Studio, and to my surprise after going through tons of confusing classes I don't find a single comment! How am I supposed to to figure out how anything works if the previous developers didn't comment ANYTHING!
Now, I'm still fairly new to programming professionally (about 2yrs) but I've learned how beneficial comments can be.
Ugh, now I have to spend the rest of this week deciphering this code like an archaeologist inside an Egyptian pyramid. -
At what point does it get easier to just log your errors than to add a to-do that this needs to be logged?
Asking for my boss who clearly prefers Todos to actual logging -
I just wish phone manufacturers would put the charge port on the back of the phone instead of on the sides. Don't they know everyone rests the phone on their chest in bed? It would also solve the problem of replacing knackered cables.9
-
When it comes to writing comments in your code, I do quite a lot of it. Even for parts where you just need to read the code to understand what it does. However I do write very clean comments, not even snarky comments where I know someone has done something completely stupid. In my work, I generally keep it very clean. I wonder how many people write profanity, or use weird naming for functions or variables?
https://thenextweb.com/dd/2018/...3 -
How does your organisation and team balance PR comments demanding changes and dev time?
Here, while fixing PR comments we sometimes end up wasting as much time as we took in actually developing the feature... As a result, almost every major user story overshoots the estimation and almost every sprint gets delayed.
Yes, to each his own; but talking in general, why do you think this time wasting happens?
Do you think that happens because some of us are not as experienced as the others, the existing code not being up to the mark giving a bad example, or just a skewed review process?2 -
// doesn't work.
/* nope */
<?php /* uhhh */ ?>
Only devil decided that we have to speak PHP on nearly all our comments. -
Code comments are good and all, but there's a time and a place for them. They're more or less an opinionated free-form version of what code is doing.
In a library, they're good for documentation. However in a platform, it makes less sense. Especially one which is changing at quite a fast rate (though it has matured in recent months).
Dont get me wrong, we aren't doing wades of horrible, unintelligible code. We need to be sure of what happens when we call a function, so we make sure the signature is always correct.
def do_good_things(puppies): # "good things" is opinionated. Say what you're doing
"""give treats to puppies""" # doc string is wrong
pet(puppies)5 -
For those who are on my team, arguing on not putting comments in their code:
How much ever (un)readable your code is, any peer / reviewer / future team member can only understand what that code snippet is doing, but not why was it written in the first place or what the hell you were thinking while writing that logic. So, it'll be awesome if you write that as comments or at least link to the story/design doc which warranted that code.3 -
Most of the code I write are adopted from SO answers and dev blogs, am I a terrible coder or not even one?