Wow
-
Every once and a while I find a little gem in my own code. I encountered this one today:
if (new Project(pid).HasSubstatus)
useSubStatus = true;
else
useSubStatus = false;if (useSubStatus)
... -
Every once and a while I find a little gem in my own code. I encountered this one today:
if (new Project(pid).HasSubstatus)
useSubStatus = true;
else
useSubStatus = false;if (useSubStatus)
...Don't we all... I've today found (my code) that was something like:
set
{
if(value!=null)
{
DoSomething();
Trace.Write(value.ToString());
}
else
{
Trace.Write(value.ToString());
}
}:doh: Apart from ugly way to set boolean variable,
eggsovereasy wrote:
new Project(pid).HasSubstatus
this just screams "static method"*. :) *assuming the language supports it and there aren't any hidden side effects in Project constructor
[My Blog]
"Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe -
Don't we all... I've today found (my code) that was something like:
set
{
if(value!=null)
{
DoSomething();
Trace.Write(value.ToString());
}
else
{
Trace.Write(value.ToString());
}
}:doh: Apart from ugly way to set boolean variable,
eggsovereasy wrote:
new Project(pid).HasSubstatus
this just screams "static method"*. :) *assuming the language supports it and there aren't any hidden side effects in Project constructor
[My Blog]
"Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne MetcalfeYep, the double wammy!
-
Don't we all... I've today found (my code) that was something like:
set
{
if(value!=null)
{
DoSomething();
Trace.Write(value.ToString());
}
else
{
Trace.Write(value.ToString());
}
}:doh: Apart from ugly way to set boolean variable,
eggsovereasy wrote:
new Project(pid).HasSubstatus
this just screams "static method"*. :) *assuming the language supports it and there aren't any hidden side effects in Project constructor
[My Blog]
"Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe -
dnh wrote:
eggsovereasy wrote: new Project(pid).HasSubstatus this just screams "static method"
It is not a static method. ;)
*jaans
But it should be, so I can do: Project.HasSubStatus(projectId);
-
Every once and a while I find a little gem in my own code. I encountered this one today:
if (new Project(pid).HasSubstatus)
useSubStatus = true;
else
useSubStatus = false;if (useSubStatus)
...Maybe to determine whether "HasSubstatus" full loading of an object is required AND the object itself is not used anymore AND the useSubStatus is used later. Anyway, nothing justifies writing
if (new Project(pid).HasSubstatus)
useSubStatus = true;
else
useSubStatus = false;instead of
useSubStatus = new Project(pid).HasSubstatus;
:-)
Greetings - Gajatko