Hacker Newsnew | comments | show | ask | jobs | submit login

I would rather support that, than most of the code I've actually been asked to support.



Is it really all that difficult to throw in a comment explaining what it is you're trying to do when it's not obvious to someone other than yourself?

-----


Eliminating _all_ comments is a little extreme, but if faced with the choice between excessively long names and insufficiently descriptive names, I'll go with excessively long every time.

I've spent way too many months digging around in Fortran code where every variable and function name was less than eight characters (actually the eight-character limit has been gone since Fortran 77, but some people still insist on writing Fortran 90 as if it were Fortran 4).

-----


Was the code commented in enough detail? At work, we comment heavily and tend to use short variable names (especially local variables) so I'd like to know of outside experiences with similar code.

-----


If your coding style works for your company, then I won't complain about it.

The code I'm talking about was incomprehensible on many levels -- most of the cryptically-named variables were global, and might have a comment explaining their meaning somewhere in the 200,000+ lines of code spread across 200 or so files, but it was often a struggle to find it. Other times, there would be no explanation at all. Even once you'd found out what it meant it was a struggle to keep it in your head and not confuse it with any of another bunch of similarly named variables (woe bedtide anyone who gets confused between nks, nqs and nkqs!)

This is all pretty typical of large scientific codes, though. Scientists are, as a class, the worst programmers on Earth.

-----


It appears to me that it's synchronizing inventory change records between a store front and the physical warehouse. I could be wrong, but I imagine it's something pretty similar to that. And, as much as I do shudder at this code, the names did give me a pretty good idea of the intent.

-----


This is however a major problem I have with comments: If it is obvious to me, my mind never ever spends a conscious second thinking about this. For me, the problem does not exist at all. So, tell me, how am I supposed to comment something which might be not obvious to someone else if I don't know it is there?

-----


I bet the real code had all the other problems of real code PLUS the absurdly long names.... At that rate, I'd worry about carpal tunnel syndrome.

-----


some letters + (In eclipse) Ctrl+Space, (in Vim) <C-p> or <C-n> in insert mode beat CTS with long names.

-----


Here here.

EDIT: Hear, hear.

-----


a) http://en.wikipedia.org/wiki/Hear,_hear

b) The little triangular "upmod" button is perfectly sufficient to express your agreement if you don't have anything else to add.

-----




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: