13

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.

Comments
  • 0
    //explains my usage of comments (it lets me think that I post a comment as a comment so is it a comment or it removed the comment so nobody will be able to read it I don't know why I write all of this comments are useless
  • 1
    If you need comments that badly something is really not ok with that code... I personally consider it to be code smell, unless you are writing a library for external use... But then again that is documentation not comments...
  • 0
    Try to describe what are you doing (especially if the code is particularly obscure) and *why* you're doing it that way. Just writing it down will often clear it up in your head while you're doing it, too.
  • 0
    @barptad well, I find myself using some external web APIs that can have breaking/major updates sometimes - It happens, it already happened, and at that time when I needed to update the project for the new API I thought "Fuck that would've been easier with comments and better separation of my functions".

    + As a student sometimes I need to explain to people what I did in this or that line - and I definitely can't remember the syntax / action of every function I've used / wrote , and it's worse with time - my first projects were shit, like everyone's first projects, but when you take them out later you wish you made comments, or at least that's what I noticed from me and some of my surroundings.

    But you may be true about me confusing Documentation and Comments, I didn't think about that earlier, I'll probably have to. Thanks for the advice ;)
  • 1
    @endor I'll definitely think more about that when writing comments from now on - thanks for the advice :) !
  • 1
    @AmineIzumi I do agree it might be hard in the beginning. However comments can be dangers to, since if you change your logic but forget to update your comments, now you are misleading yourself and others... If you have the time I highly recommend Clean code from Robert C. Martin a great book and can help a lot...
  • 0
    Commenting isn't really important if it's a fun, personal, standalone project but if you're working in a team or think you'd use your code later on, it's vital.

    I see so many rants about not being able to understand another developer's code or how some people write such shit, but I think with proper documentation a lot of blood could have been left unboiled.

    I recommend you get into the habit of leaving comments wherever you have a section of code that you had to think about to write, even in small one-time projects. It's a good trait to have if you ever plan on going further into large scale projects where teams and/or code reusability are necessary.
  • 2
    @charyas worked on a personal project for a while, used to know the code inside-out (small project), didn't bother leaving any comments.

    Went back to work on it after a 6 month break. From that day, I've learned to write my comments. Never again.

    It doesn't matter how familiar you are with your (own) code, good comments will save you worlds of trouble and wasted time - especially when you have to figure out the whole logic of some functions from scratch, or why you did things in a certain way.
Add Comment