Okay, I'm getting bored waiting for Ilja's promised next post in the "code vs. design" thread, so I'd like input on another process/people/practices issue: line lengths. Ilja is quite busy right now. I'm pretty confident, he'll come back at some time. Don't worry
1. Do you prefer to have a line length limit or not?
2. If yes, what are your minimum, maximum, and preferred line length limits?
3. Why?
Best practices (
Sun conventions, etc) advocate for 80-characters lines. Personally, I don't really have a preference as long as the code is readable. In some cases, you might need to write lines longer than 80 characters. Trying to make my code fit within 80 characters lines is not really my primary concern. Sometimes it is not even possible due to the length of the method and class names that you have to use (third-party libraries, etc).
Again, you can use code beautifiers for doing that for you, but none of these tools has really satisfied me as of today. For instance, when I use
Checkstyle, I usually deactivate LineLength during development and then when I'm done I reactivate it just to have a feeling of how much longer my lines are
The bottom line is that fixing the length of the lines in your code is more a matter of personal preference or corporate policy. I think there are many things that much more important to check regarding the quality of your code than check if the lines are too long or not.
[ May 26, 2004: Message edited by: Valentin Crettaz ]