|
I love them when other do them.
Be excellent to each other. And... PARTY ON, DUDES!
Abraham Lincoln
|
|
|
|
|
Those that explain the bad code, or those to comment out the bad code ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb
|
|
|
|
|
Well, both are better then not.
Be excellent to each other. And... PARTY ON, DUDES!
Abraham Lincoln
|
|
|
|
|
Yeah, that would slow things down. Using a to do list would help to remember to clean up such things. It is like a comment, but looks like //TODO: Remove this after testing. Then you can see the to so list in Visual Studio
Just because the code works, it doesn't mean that it is good code.
modified 24-Sep-13 16:11pm.
|
|
|
|
|
Yep - I do it all the time - so they show up in the VS "Task List".
The only instant messaging I do involves my middle finger.
|
|
|
|
|
Thanks
-Amit Gajjar
|
|
|
|
|
You should have decreased the value.
|
|
|
|
|
To 4'999??? or to 1??
The signature is in building process.. Please wait...
|
|
|
|
|
Maybe by twenty-five to fifty percent; you need to leave some.
|
|
|
|
|
In this case I don't need it at all.. It was there for debugging, because without the sleep, debugging just went too fast.
The signature is in building process.. Please wait...
|
|
|
|
|
No you need to leave some delay in for a development holiday. When Boss Man says the app is too slow, tell him you'll have a look, spend two days faffing, reduce the wait by 20% and tell him you've optimised the code. Simples.
speramus in juniperus
|
|
|
|
|
I guess you are doing the same
Thanks
-Amit Gajjar
|
|
|
|
|
vonb wrote: To 4'999??? or to 1?? Silly, to -1.
(Incidentally, sleeping for 0 cycles has "special behaviour")
|
|
|
|
|
Exactly. You understand the meaning of this valuable coding practise described in
"Real World Software Development - Volume I: Coding Patterns" by W., T., and F.
|
|
|
|
|
Hmmm... is this dumb or brilliant?
if ((logicalTabs ? tabs_General1.cbException.Focused : tabs_General1.cbJobStatus.Focused) &&
e.KeyCode == Keys.Up)
{
as opposed to:
if (( (logicalTabs && tabs_General1.cbException.Focused) ||
(!logicalTabs && tabs_General1.cbJobStatus.Focused) ) &&
e.KeyCode == Keys.Up)
{
I can't decide now.
Readability contrasting with good practice?
|
|
|
|
|
Second one. I think in first case, it is easy for someone to incorrectly infer the condition.
"Bastards encourage idiots to use Oracle Forms, Web Forms, Access and a number of other dinky web publishing tolls.", Mycroft Holmes[ ^]
|
|
|
|
|
The second one is a lot easier to read - you have to stop and think about the first one.
The only instant messaging I do involves my middle finger.
|
|
|
|
|
I prefer the first method, but for readability would split it into two separate statements by using an extra variable:
bool focused = logicalTabs ? tabs_General1.cbException.Focused : tabs_General1.cbJobStatus.Focused;
if (focused && e.KeyCode == Keys.Up)
{
|
|
|
|
|
..and what if another condition needs to be added?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
if (e.KeyCode == Keys.Up)
{
bool focused = logicalTabs ? tabs_General1.cbException.Focused : tabs_General1.cbJobStatus.Focused;
if(focused )
{
}
}
I think it would be also a choice...
Life is all about share and care...
public class Life : ICareable,IShareable
{
// implements yours...
}
|
|
|
|
|
The first is nasty. Embedding one ternary expression in a second or an if results in hard to read code. I'd say it's a tossup between the second and putting the ternary in a temp. Mostly that comes down to if the temp has any intrinsic meaning on its own (regardless of if it's used in a second place).
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
bool rightFocus = logicalTabs ? tabs_General1.cbException.Focused : tabs_General1.cbJobStatus.Focused;
bool keyUp = e.KeyCode == Keys.Up;
if (rightFocus && keyUp){
}
This is much easier to work with later on imo.
.
|
|
|
|
|
Only use a ternary where you can't use an if ; why the elephant would you ever use one in an if ?
|
|
|
|
|
Doing so is very iffy.
Keep Clam And Proofread
--
√(-1) 23 ∑ π...
And it was delicious.
|
|
|
|
|
Maybe it's just my brain but the ternary expression is clearer for me That being the case I'd never write it this way in code. Complex conditions would most likely be moved into variables like someone has answered already, i.e.:
bool tabsAreLogical = logicalTabs ? tabs_General1.cbException.Focused : tabs_General1.cbJobStatus.Focused;
if(tabsAreLogical && e.KeyCode == Keys.Up) {
}
This makes it easier to read/change later, as well as making the condition reusable later in code.
|
|
|
|