Does having to scroll horizontally make code less readable

coding-standards

Well, does it? Is it considered bad practice?

IMO, it is less readable. I hate having to scroll to the right, then back left, right, left, and so on. It makes coding more painful and confuses me sometimes.

For example, anytime I am coding a long string, I will do the following…

bigLongSqlStatement = "select * from sometable st inner join anothertable at" +
"on st.id = at.id" +
"and so on..." +
"and so on..." +
"and so on..."

Best Answer

Yes, indeed it does, in the literal sense as well as the general sense.

I like to do side-by-side code diffs, and too-wide lines make that harder:

http://i.stack.imgur.com/fWVuz.jpg

Languages like Scala with triple-quoted strings allow you to construct a string from many lines without the runtime expense, unsightly quotes and plus signs (as seen in your example) of joining together parts of a string.

Related Topic