Code should comment every line of codes?

Hi

I am totally noob in coding..
So i will require my developer to comment on the codes..
Normally how many lines of codes with one comment is consider reasonable?
note: for objective-c (iphone app)
royalgoldleafAsked:
Who is Participating?
 
DmitriyCommented:
I think the more code comments the merrier. The issue here is readability of comments.  I think 1 comment per line is an overkill, so a summary of what is being done in the function plus any tricky spots should be commented, but the rest should assume that the reader knows basic programming.
0
 
Daniel Van Der WerkenIndependent ConsultantCommented:
Code should be self documenting.  Therefore, you might do:

bool isFileLoadComplete = false;  // does Objective=C have bools?  LoL

int numberOfLinesInFile;

char* applicationTitle;

etc.

That said:

If the person reading you code can easily figure out what's going on, then documenting it is redundant and unnecessary.  However, if you're doing something that's complex or crazy, you need to document it.  If you set up some weird array to have passed back by a function, you'd want to document the array structure and what each element means, etc.

I would have your programmer use good, descriptive variable names and document functions and tricky areas well just like Dmitriy suggests.


0
 
jacekmalinowskiCommented:
Description for each class and comment for each method in each class is enough.
Comments format could be prepared for DoxyGen (Source code documentation generator tool).
http://www.stack.nl/~dimitri/doxygen/

DoxyGen can generate nice documentation of Objective-C projects.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.