14

Rant much...
I just started working on project after a group of students.
The project has various of bugs (ofcourse) and not catched exceptions.
I found variables like 'abcd' or shorts of classes like 'rrms'.
I would be fine with all of that but there is one thing is just making me crazy:
THERE IS NO SINGLE FUCKING COMMENT IN WHOLE SOLUTION (three projects and about few hundred files with javascript and cs).

Imagine freaking pure react (no jsx) full of null arguments and multiple custom control written like 'var gl= GreenLabelled(null,null,text,5)' (a button ) with again, NO FUNCKING SINGLE COMMENT.

I just cannot stand it. Just spent 3hrs to wrapp my head around events in this react classes...

Comments
  • 0
    Hmm some friends of mine who are in uni have been doimg a react project, coincidence?
  • 5
    You're overREACTing *giggles*
  • 1
    This fucking blows. A colleague recently said "I don't really see the point of comments"... What the hell. Try deciphering some ancient piece of code that someone else or even you wrote ages ago when you had all the concepts in your head and now it's just a piece of magic that does *something*.
    Moreover: comments help you find those assumptions and can actually improve the code itself (by forcing you to explain a function or param name you will become aware of it's ridiculousness for instance)
  • 0
    Why are you all such in love with comments? Documentation, that's all fine and good, but comments? Maybe write easy to understand code instead.

    You know what really grinds my gears?

    /**downloads an image from a given source and posts the result into a callback
    */
    public void execute(Src Src, Callback callback){
    //start of download
    ...
    }
  • 1
    @JacksOnF1re isn't this a perfect comment? I mean the method name is not really helping. "execute"... Does not sound like something image or download related...
  • 2
    @siljamicke in my opinion it is clearly not. It's a documention that does not help you in any way.

    Let's suppose you write the code in this way, without any doc and comment:

    public void downloadImage(Url source, IDownloadFinishedCallback callback) {...}

    Now you have no doc and no comment and it is even more clear what this method does and expects, directly from source.

    Comments and sometimes documentations should (in my opinion) be used as last resort.
  • 1
    Code should be like a joke if you have to explain it, it's probably bad.
  • 0
    @JacksOnF1re ah, I thought the method name in your example couldn't be changed. You're right, self-explanatory code is great, and commenting can be a pain in the *$$. Sometimes though, there are examples of code that should not explain itself. For instance mathematical functions can sometimes benefit from compact conventional mathematical notation, accompanied by some more verbose interspersed commenting explaining what the code does, much like how mathematical text reads.
  • 1
    Oh come on. Sometimes, actually most time we are creating complicated logic. Writing that as clear as possible is great, that's a good goal and if that covers it: perfect!

    But: context. Context is lost over time, rationalizations about why a certain choice was made is lost over time. Sometimes an API displays unexpected behavior. Sure the best thing is fixing that but sometimes you don't have that option. Leave a short "Hey don't fall into this beartrap" comment is perfectly good and useful.

    Placing comments that essentially duplicate the text below? Useless.
  • 1
    @maticko exactly. So stop explaining what your code does, explain how and why, when that is relevant and valuable.
Add Comment