The length of a line of PHP code?
Posted: Mon May 25, 2009 7:49 am
Hi,
I often find people and websites suggesting to use a max length of 80-100 for a line of code. Traditionally, the max length has been 80 characters, which was invented by COBOL around 1960 as far as I know. However, nowadays people have widescreen monitors and high resolution monitors, so, it makes me think about what is the "best" choice for a maximum length limit.
This is kind of blurry, because if you use a larger font or a larger font size - obviously you will run out of horizontal space sooner. So, I'm not sure what should be the limit of line height...
What are you thoughts on this?
Here's what I have been thinking:
- Coders have at least 1024 px in horizontal direction
- Coders use fixed-width fonts
- Coders use at most 14pt font size?
I've been trying to determine a good max line length and I usually come up with something like 80-100 characters/line.
However, this is not quite simple... netbooks are 20% of the laptop market - and they have smaller screens. What about people who have bad vision? They might use larger font sizes. To make matters worse, almost every single editor has sidebars, which take up some horizontal space.. so, it's pretty much impossible to find a good maximum limit, or is it?
I know that most editors have that "wrap overlong lines" feature, but if I have plenty of comments in my code, it may look bad if the editor wraps the lines based on the length..
I often find people and websites suggesting to use a max length of 80-100 for a line of code. Traditionally, the max length has been 80 characters, which was invented by COBOL around 1960 as far as I know. However, nowadays people have widescreen monitors and high resolution monitors, so, it makes me think about what is the "best" choice for a maximum length limit.
This is kind of blurry, because if you use a larger font or a larger font size - obviously you will run out of horizontal space sooner. So, I'm not sure what should be the limit of line height...
What are you thoughts on this?
Here's what I have been thinking:
- Coders have at least 1024 px in horizontal direction
- Coders use fixed-width fonts
- Coders use at most 14pt font size?
I've been trying to determine a good max line length and I usually come up with something like 80-100 characters/line.
However, this is not quite simple... netbooks are 20% of the laptop market - and they have smaller screens. What about people who have bad vision? They might use larger font sizes. To make matters worse, almost every single editor has sidebars, which take up some horizontal space.. so, it's pretty much impossible to find a good maximum limit, or is it?
I know that most editors have that "wrap overlong lines" feature, but if I have plenty of comments in my code, it may look bad if the editor wraps the lines based on the length..