Wayne Werner
Wayne Werner

Reputation: 51847

How wide should VB code get?

In times past, most people coded on a terminal that was 80 characters wide. In many languages this has become, if not holy then close to it.

But now many people have 20"+ monitors (or dual monitors), so screen real estate isn't as prime as it once was.

So my question is this: in Visual Basic code, should code be limited to 80 characters, should there be no limit, or is it really a subjective thing, dependent on where you work and your own preferences?

Upvotes: 3

Views: 665

Answers (8)

barlop
barlop

Reputation: 13780

A problem is sometimes people may code in a window that isn't full screen, and then have to scroll, or the code wraps automatically.

Having to scroll left and right to read code is horrible.

I've had the issue with comments in code.. either limiting them in number of char wide.. or putting them in a different file!

Upvotes: 0

Catharsis
Catharsis

Reputation: 476

I'm going to go against the grain here, but I say don't limit yourself. If you are abbreviating class/function/variable names for the sake of saving space, you are just taking your code one more step away from being quickly grok'd. I think everyone should hop on the widescreen bandwagon anyway.

Upvotes: 0

jamone
jamone

Reputation: 17421

Approximate 80 characters is what I'd recommend. What I do with the extra monitor realistate is have 2 code files side by side. And the 2nd screen gets all the toolbars, property windows, and a 3rd code or interface layout window.

Upvotes: 1

tathagata
tathagata

Reputation: 488

Humans read and comprehend fastest, when there are 40-70 characters per line of prose (approx. 10 words per line). I think something similar will apply to code.

Upvotes: 4

A. Levy
A. Levy

Reputation: 30606

I think it is subjective, but not completely. Limiting code to 80 characters will make it more readable. This is the reason that newspapers have their articles in columns. It is easier to read text if it doesn't get much longer than 70 characters or so. I believe that people have done usability studies on this, but I don't have the references to back that up.

So, again, it is subjective, and situation-dependent, but longer lines are harder to read. So I try to stay within 80 characters even though I don't have to do so.

Upvotes: 9

Jeremy Kemball
Jeremy Kemball

Reputation: 1275

I know a number of people who are remarkably fastidious about 80 character lines. As an arbitrary standard it's not bad, but if nobody is nagging you make it whatever length you feel comfortable with.

Upvotes: 1

StingyJack
StingyJack

Reputation: 19479

Subjective, but within some constraints (for example, if everyone is issued a monitor with size X). We use 110 characters, and it works for us even though some of us use widescreen monitors rotated to portrait.

Upvotes: 1

Jason
Jason

Reputation: 52533

Do what is most comfortable and works best for you. This is pretty much a universal truth for everything.

Upvotes: 1

Related Questions