How many characters per line do programmers typically prefer?

Same here… intended and indented (muhaha) line breaks are indeed much nicer than automatic wrapping or scrolling.

Another case where I’d usually have a break is longer chains… I’d even choose the syntax accordingly to better reflect the structure, e.g. consider this jQuery chain

$('#foo')
    .show()
    .css({
        width: $(window).width()
    })
    .click(function() {
        alert('bar');
    });

which is much nicer to read IMHO than

$('#foo').show().css('width', $(window).width()).click(() => alert(bar));

But this is quite harmless, of course… when it comes to, say, ORM querybuilder chains you’re rather lost w/o line breaks (just like with SQL, obviously).

This all being said, I do like and overuse the ternary operator. :-)

1 Like