|
I think that's the most stupid code I refactored today!
But barely, and there is a lot more!
public XYZ()
{
_xyz = "0 , 0 , 0";
string[] parts = _xyz.Split(',');
Double.TryParse(parts[0], out x);
Double.TryParse(parts[1], out y);
Double.TryParse(parts[2], out z);
}
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
public void WriteCode(ICodeContent ctx)
{
throw new BrainNotFoundException();
}
Super Lloyd wrote: A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
Where the work stops. Right?
Bob Dole The internet is a great way to get on the net.
2.0.82.7292 SP6a
|
|
|
|
|
You nailed it!
Both remarks!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Super Lloyd wrote: public XYZ() { _xyz = "0 , 0 , 0";... Looks like someone was planning on getting a string feed and forgot to feed the string or forgot to stop destroying the string.
So what did you do to refactor it? Change code to x=0;y=0;z=0;? And keep _xyz = "0 , 0 , 0";? Remove _xyz = "0 , 0 , 0"; and verify the split causes at least 3 parts? Add error checking on the tryparses? Remove XYZ and all references?
|
|
|
|
|
I got rid of the '_xyz' string, it was only used internally (in addition to x,y,z double) and parse every now and then, to get the value of 'x,y,z'
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
|
Ho... I'm learning new power pattern every day!!!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|