• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Which is easier to read:

Train

Lifer
Another coder at work has been going through my app and changing this:

ProductItem productItem = new ProductItem(pd.RGB, pd.Name, index, pd.ProductGroup, "User Defined");

With this:
ProductItem productItem
= new ProductItem
(pd.RGB
, pd.Name
, index
, pd.ProductGroup
, "User Defined"
);

And its driving me nuts. Am I the only one who thinks breaking every method or constructor call down to one param per line is a waste?
 
One param per line is a waste of screen real estate. Get a style guide and stick to it. If there is no style guide, then it's your code, and he should keep to your conventions when modifying it.
 
ive used one param per line when setting up fairly lengthy calls (i.e. when it wraps to 1 or more lines) but not for ALL calls.
 
sometimes I do something like

Blah = new Longblahwithlotsofstuff(thing1 thing, thing2 thing
thing3 thing, thing4 thing);

Where thing3 is lined up with the parenthesis.
 
Option 1 is much easier to read.

I've used similar to Option 2, but only ever in very long SQL queries.

For general programming, Option 2 is a waste of time and screen space.

Maybe he works under the Peter Principle.
 
I only break method signatures to preserve width restrictions, then I simply wrap and indent by the normal amount.
 
Originally posted by: drebo
Option 1 is much easier to read.

I've used similar to Option 2, but only ever in very long SQL queries.

For general programming, Option 2 is a waste of time and screen space.

Agreed.
 
If I do something like option two it looks like:

ProductItem productItem = new ProductItem(pd.RGB,
pd.Name,
index,
pd.ProductGroup,
"User Defined");

Where the first char of each arg is aligned. This is for functions with 7 or more args. I don't waste my time with 5...
 
I like to maintain 80-character (or depending on the project style restraints, sometimes 60 or 70) width. I wrap parameters to maintain that width... I don't believe in using one style in all cases. It also varies by language.
However, my default is no wrapping.
 
Originally posted by: degibson
I like to maintain 80-character (or depending on the project style restraints, sometimes 60 or 70) width. I wrap parameters to maintain that width... I don't believe in using one style in all cases. It also varies by language.
However, my default is no wrapping.

Get a wider monitor 😉

techfuzz
 
Get this guy something else to do. Maybe he can work on the database or the Reports.
 
Back
Top