Hacker News new | past | comments | ask | show | jobs | submit login

Nah I didn't think that at all, it was clear from the way you said "minimal commenting". I just have an axe to grind when it comes to comments of the form

    // assign the integer value 10 to the variable x
    x = 10



At least it's better than:

    // set the variable x to 10
    x = 12;


  sFile = "filename.xml";
then later

  sFile = File.ReadAllText("filename.xml");


I think you've forgotten a leading zero ;)


What's really annoying is that most of the time you see this kind of comment there is no explanation why 10 was chosen.


And that's what comments really need to do: tell 'why.'



That's why you should use constants. Still self documenting without the need for comments (usually).


    const TEN = 12;


    #define true false


In our embedded systems class we were required to define all of our constants, just to add another level of description to operations. It definitely helped to navigate spaghetti code.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: