Discussion in 'iOS Development' started by Steaps, Oct 26, 2009.
Just curious, do you comment your code?
I try to do as much as possible (especially when in team projects) time wasted figuring what is going on could be used doing something useful.
Yeah, in team code, it's basically necessary.
I do somewhat, because that is what I was taught in my computer programming class.
i don't code iPhone apps, but when i program, i try my best to put comments. It helps a lot when keeping track of things rather than tracing it all over again. Plus, when its a team project, its important for other members to at least get a hint on what that certain code segment does when reviewing it. When referring to programs i have done long ago, comments usually help make me understand it faster. It helps in debugging too!
I comment Please Register or Log in to view images because i have to remind myself what i was doing with my code. lol.
Please Register or Log in to view images
Commenting is very important for team projects, as mentioned above, as well as personal things - After staying up until 3-4 AM the previous night coding, upon reviewing the code later, you may think to yourself WTF is this. Commenting is a good habit and its best to do it while writing the code, not afterwards, as that way it is less of a chore, and it can slow down/organize your thought process which can cut down on time wasted debugging code with silly errors.
To put it simply, just do it.
Absolutely. It only takes a few conditionals and loops before I start to lose track of where I am at. Most of the stuff I code is open source and made for the benefit of others anyway.
Commenting helps out all parties involved. It is one of the first things taught in a programming class. Though I will never get used to flow-charts. Blegh.
If you don't comment, you're a fool. Team projects aside, when you go back to your code months later, without comments, you will need to figure out what it does. It's an enormous time waste to not comment code.
That said, I don't. I tend to use descriptive code. ex, [PTColor darkenColor:aColor byFactor:factor]; Although that is never a good enough excuse to not comment. The truth is that when I get coding, I want to finish the current method and add code later. I almost never go back and add comments.
Exceptions where I almost always comment include places where the I could very easily get mixed up. Most notably, when using switches to handle the button presses on UIAlertViews. I always comment which branch is the "Okay," and which branch is "Cancel." //Or whavever other options the alert may have.
did you just call yourself a fool?
Separate names with a comma.