Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

You are writing a style guide and you are at the chapter about breaking long lines.

What would be the best examples of long lines to demonstrate your rules of breaking long lines.

The examples should be in a c-like syntax. I think it is best to keep the examples more or less language agnostic. You can use language specific features for extreme long lines like the many modifiers in java, the implements clause or the throws clause.

Note: this is not about the rules of how to break long lines. This is about collecting the best examples for the rules of how to break long lines. I have prepared a question for the rules, but i wanted to collect the best examples first.

Please not break your long line, at least not much. just break it as much so that it is readable in this website. You can break your long line to your hearts content in this question once we have a good set of example lines.

One example per answer please.

share|improve this question
add comment

2 Answers

One type of line to handle it the long chain:

var x = whatever.Thing.OtherThing.GetMyThing().With(thisThing).Somethingy.GetNode().Something().Foo.Bar;
share|improve this answer
add comment

Here's one line of Java from my hard drive:

private static void extractIndex(Connection conn, String indexName, String tableName, SortedMap<Integer, IndexColumn> columnList) throws SQLException {
share|improve this answer
    
I've seen way longer, somewhere around 8 parameters (several of which where generics) and threw about 5 exceptions. –  TheLQ Sep 3 '10 at 11:10
    
@TheLQ, please post an example here then :-) –  finnw Sep 3 '10 at 12:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.