|
Yes, you should do the latter, even though lowerBound and upperBound are only used once. The reason is maintainability. This shouldn't even be a question for anyone who has ever had to read and modify someone else's code.
|
|
|
|
|
I don't think it's necessary to add the extra variables to make the code readable. Just split the lines where it makes sense. That should be enough.
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());
|
|
|
|
|
I haven't read all the responses yet, by here's my take in general terms.
As devs, we sometimes encounter situations where competing priorities become evident.
Like when the ideal of simplicity, readability, and maintainability run counter to runtime efficiency.
I always bias my choices with empathy for the shmuck (fixer-person or enhancer-person) that comes later and must figure out what the I was trying to do.
Impossible-to-easily-parse code is a follow-on bug waiting to happen.
There is nothing more insidiously degrading to a codebase than cascading bugs due to ill-informed, shoot-from-the-hip changes because the code is too difficult to grok. And we all know it happens.
The kicker here is, unless it's message-loop-style code that runs continuously for the life of execution, it won't ever be an issue (AND, the compiler may even ultimately produce the same code.)
endRant
Cheers,
Mike Fidler
"I intend to live forever - so far, so good." Steven Wright
"I almost had a psychic girlfriend but she left me before we met." Also Steven Wright
"I'm addicted to placebos. I could quit, but it wouldn't matter." Steven Wright yet again.
|
|
|
|
|
Over the years, I've developed an attitude about this.
If I want others (including myself in a later incarnation) to stay away, PLEASE do not think this is easy by being ""readable"", I densify, (un)justly believing in more efficient code (from a compiler or machine viewpoint).
Intermediate stuff should be lighter, though.
|
|
|
|
|
Is comatose when your foot falls asleep?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I thort it's what hip hop hobbits do for 1np1rat1on
Message Signature
(Click to edit ->)
|
|
|
|
|
Yes, and walking on pins and needles is the (pedi)cure.
|
|
|
|
|
or something Italians with hairy feet do?
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
|
Great. Lately I've been dealing with a bit of restless leg syndrome (it's a real thing), and now you've just reminded me of it.
|
|
|
|
|
Easier to handle than a comanose
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
Hi All,
Just trying to see if the network is back. Issues my end!
|
|
|
|
|
I don't know - can I get back to you?
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
Barely. Thanks for asking.
"Five fruits and vegetables a day? What a joke!
Personally, after the third watermelon, I'm full."
|
|
|
|
|
phil.o wrote: Thanks for asking.
He wasn't talking to you silly.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Lights are on but nobody's home!
They call me different but the truth is they're all the same!
JaxCoder.com
|
|
|
|
|
Considering I left the house this morning without power, I suspect this to be the case right now since my neighbor kindly informed me that the power was back on. Good news is the fridge/freezer was already empty in advance of my vacation later this week.
|
|
|
|
|
Still picking up the lost tokens on my token ring network.
I'd rather be phishing!
|
|
|
|
|
I think I have one of them - purple and shaped like a pentagram? Do you want it back?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I'm sorry, but no-one is available to take your post at the moment. Please leave your email and bank card PIN after the tone ...
<Beep>
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Right, that's good, um do you need my details I was under the impression they were available after my Amazon incident...
|
|
|
|
|
Yes, it's just for security.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
We are sorry but all our agents are busy at the moment. Your call is totally unimportant as far as we are concerned, but we could play you some really annoying music if you like. Why not send us a postcard with your favourite tunes?
|
|
|
|
|
Ahh YES! normal service has been returned.
|
|
|
|
|
We've been trying to reach you regarding your car's extended warranty
|
|
|
|