Click here to Skip to main content
14,388,839 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
Rage22-Oct-19 0:04
professionalRage22-Oct-19 0:04 
GeneralRe: Beyond meat? Pin
ZurdoDev22-Oct-19 2:14
professionalZurdoDev22-Oct-19 2:14 
GeneralRe: Beyond meat? Pin
Rage22-Oct-19 2:16
professionalRage22-Oct-19 2:16 
QuestionRe: Beyond meat? Pin
ZurdoDev22-Oct-19 2:18
professionalZurdoDev22-Oct-19 2:18 
AnswerRe: Beyond meat? Pin
Rage22-Oct-19 2:25
professionalRage22-Oct-19 2:25 
GeneralRe: Beyond meat? Pin
ZurdoDev22-Oct-19 3:27
professionalZurdoDev22-Oct-19 3:27 
AnswerRe: Beyond meat? Pin
Dan Neely22-Oct-19 3:43
MemberDan Neely22-Oct-19 3:43 
GeneralLong Lines Pin
PeejayAdams21-Oct-19 5:44
MemberPeejayAdams21-Oct-19 5: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 Pin
F-ES Sitecore21-Oct-19 5:53
mveF-ES Sitecore21-Oct-19 5:53 
GeneralRe: Long Lines Pin
PeejayAdams22-Oct-19 0:03
MemberPeejayAdams22-Oct-19 0:03 
GeneralRe: Long Lines Pin
Rage22-Oct-19 0:05
professionalRage22-Oct-19 0:05 
GeneralRe: Long Lines Pin
CodeWraith21-Oct-19 6:01
MemberCodeWraith21-Oct-19 6:01 
GeneralRe: Long Lines Pin
Richard MacCutchan21-Oct-19 7:00
mveRichard MacCutchan21-Oct-19 7:00 
GeneralRe: Long Lines Pin
CodeWraith21-Oct-19 8:42
MemberCodeWraith21-Oct-19 8:42 
GeneralRe: Long Lines Pin
Brisingr Aerowing21-Oct-19 14:25
professionalBrisingr Aerowing21-Oct-19 14:25 
GeneralRe: Long Lines Pin
Roger Wright21-Oct-19 18:57
professionalRoger Wright21-Oct-19 18:57 
GeneralRe: Long Lines PinPopular
jsc4221-Oct-19 6:07
professionaljsc4221-Oct-19 6:07 
GeneralRe: Long Lines Pin
AFell221-Oct-19 6:23
MemberAFell221-Oct-19 6:23 
GeneralRe: Long Lines Pin
PeejayAdams22-Oct-19 0:06
MemberPeejayAdams22-Oct-19 0:06 
GeneralRe: Long Lines Pin
BryanFazekas22-Oct-19 2:08
MemberBryanFazekas22-Oct-19 2:08 
GeneralRe: Long Lines Pin
Chris Losinger21-Oct-19 6:07
professionalChris Losinger21-Oct-19 6:07 
GeneralRe: Long Lines Pin
OriginalGriff21-Oct-19 6:25
mveOriginalGriff21-Oct-19 6:25 
GeneralRe: Long Lines Pin
  Forogar  21-Oct-19 6:53
professional  Forogar  21-Oct-19 6:53 
GeneralRe: Long Lines Pin
dandy7221-Oct-19 10:40
Memberdandy7221-Oct-19 10:40 
GeneralRe: Long Lines Pin
bjongejan21-Oct-19 23:07
Memberbjongejan21-Oct-19 23: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.