Click here to Skip to main content
15,895,011 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
AnswerRe: Beyond meat? Pin
Rage21-Oct-19 23:04
professionalRage21-Oct-19 23:04 
GeneralRe: Beyond meat? Pin
ZurdoDev22-Oct-19 1:14
professionalZurdoDev22-Oct-19 1:14 
GeneralRe: Beyond meat? Pin
Rage22-Oct-19 1:16
professionalRage22-Oct-19 1:16 
QuestionRe: Beyond meat? Pin
ZurdoDev22-Oct-19 1:18
professionalZurdoDev22-Oct-19 1:18 
AnswerRe: Beyond meat? Pin
Rage22-Oct-19 1:25
professionalRage22-Oct-19 1:25 
GeneralRe: Beyond meat? Pin
ZurdoDev22-Oct-19 2:27
professionalZurdoDev22-Oct-19 2:27 
AnswerRe: Beyond meat? Pin
Dan Neely22-Oct-19 2:43
Dan Neely22-Oct-19 2:43 
GeneralLong Lines Pin
PeejayAdams21-Oct-19 4:44
PeejayAdams21-Oct-19 4:44 
Sometimes you find yourself writing a stupidly long line of code, in my case:
OutputImage(file, allFaces.Where(f => f.Proportion > double.Parse(ConfigurationManager.AppSettings["LowerBound"].ToString()) && f.Proportion < double.Parse(ConfigurationManager.AppSettings["UpperBound"].ToString())).ToList().OrderBy(f => f.Proportion).ThenByDescending(f => f.Rectangle.Height).FirstOrDefault());

That will auto-wrap on here but you get the idea.

Well, obviously I can shorten that line (but lengthen the code slightly) by splitting out the config setting retrievals:
double lowerBound = double.Parse(ConfigurationManager.AppSettings["LowerBound"].ToString());
double upperBound = double.Parse(ConfigurationManager.AppSettings["UpperBound"].ToString());

reducing the "offending" line to:
OutputImage(file, allFaces.Where(f => f.Proportion > lowerBound && f.Proportion < upperBound).ToList().OrderBy(f => f.Proportion).ThenByDescending(f => f.Rectangle.Height).FirstOrDefault());


But given that I'm not using those settings more than once, should I really be doing that? Two short-lived variables aren't going to make too much difference but I'm still doing it for cosmetic reasons and that can't be good ...

Either way, it's easy enough to split a method call where there are half a ton of arguments over several lines of text but what about when it's just one of the arguments that's causing the thing to scroll for miles? (Lambdas being a common cause of this).

Hardly a matter of life and death but I'd be interested to hear the thoughts of others on this.
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain

GeneralRe: Long Lines PinPopular
F-ES Sitecore21-Oct-19 4:53
professionalF-ES Sitecore21-Oct-19 4:53 
GeneralRe: Long Lines Pin
PeejayAdams21-Oct-19 23:03
PeejayAdams21-Oct-19 23:03 
GeneralRe: Long Lines Pin
Rage21-Oct-19 23:05
professionalRage21-Oct-19 23:05 
GeneralRe: Long Lines Pin
CodeWraith21-Oct-19 5:01
CodeWraith21-Oct-19 5:01 
GeneralRe: Long Lines Pin
Richard MacCutchan21-Oct-19 6:00
mveRichard MacCutchan21-Oct-19 6:00 
GeneralRe: Long Lines Pin
CodeWraith21-Oct-19 7:42
CodeWraith21-Oct-19 7:42 
GeneralRe: Long Lines Pin
Brisingr Aerowing21-Oct-19 13:25
professionalBrisingr Aerowing21-Oct-19 13:25 
GeneralRe: Long Lines Pin
Roger Wright21-Oct-19 17:57
professionalRoger Wright21-Oct-19 17:57 
GeneralRe: Long Lines PinPopular
jsc4221-Oct-19 5:07
professionaljsc4221-Oct-19 5:07 
GeneralRe: Long Lines Pin
AFell221-Oct-19 5:23
AFell221-Oct-19 5:23 
GeneralRe: Long Lines Pin
PeejayAdams21-Oct-19 23:06
PeejayAdams21-Oct-19 23:06 
GeneralRe: Long Lines Pin
BryanFazekas22-Oct-19 1:08
BryanFazekas22-Oct-19 1:08 
GeneralRe: Long Lines Pin
Chris Losinger21-Oct-19 5:07
professionalChris Losinger21-Oct-19 5:07 
GeneralRe: Long Lines Pin
OriginalGriff21-Oct-19 5:25
mveOriginalGriff21-Oct-19 5:25 
GeneralRe: Long Lines Pin
  Forogar  21-Oct-19 5:53
professional  Forogar  21-Oct-19 5:53 
GeneralRe: Long Lines Pin
dandy7221-Oct-19 9:40
dandy7221-Oct-19 9:40 
GeneralRe: Long Lines Pin
bjongejan21-Oct-19 22:07
bjongejan21-Oct-19 22:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.