J
jehugaleahsa
Hello:
I had an hour-long discussion with my boss today. Last night, right
before I dozed off, I realized some of his code resulted in duplicate
processing. I tried to explain it to him and he kept saying, "I'm
afraid to say it's 'OK' to change it because everything I did was for
a reason." Well, I know better.
My boss' old code is written in some cryptic C file with Oracle
precompiler macros barfed all over it. Once I figured out how to
ignore 90% of the macro junk, it has just been an effort to keep track
of all the global variables.
I was looking at some code yesterday, converting it to pseudo code,
and I came out with this:
foreach customer, contract in table1, table2:
if (customer is in history):
isCustomer = true;
if (contract is in history)
isContract = true;
process(isCustomer, isContract);
else
isContract = false;
process(isCustomer, isContract);
else
isCustomer = false;
isContract = false;
process(isCustomer, isContract);
Just looking at the pseudo-code, you should see why I almost flipped
my lid. You can easily rewrite that is this:
foreach customer, contract in table1, table2:
isCustomer = (customer in history);
isContract = (contract in history);
process(isCustomer, isContract);
It doesn't take a master refactorer to figure that one out. (AND it is
impossible for there to be a contract without a customer) Now, how do
I tell my boss, who thinks this code is exceptionally difficult, that
he made some obvious mistakes?
He is very arrogant about how he got his code to work. I am not
impressed. I don't want to hurt his feelings by pointing out (there
are many more) his obvious mistakes and inefficiencies.
There is just too much . . . to ignore!
I had an hour-long discussion with my boss today. Last night, right
before I dozed off, I realized some of his code resulted in duplicate
processing. I tried to explain it to him and he kept saying, "I'm
afraid to say it's 'OK' to change it because everything I did was for
a reason." Well, I know better.
My boss' old code is written in some cryptic C file with Oracle
precompiler macros barfed all over it. Once I figured out how to
ignore 90% of the macro junk, it has just been an effort to keep track
of all the global variables.
I was looking at some code yesterday, converting it to pseudo code,
and I came out with this:
foreach customer, contract in table1, table2:
if (customer is in history):
isCustomer = true;
if (contract is in history)
isContract = true;
process(isCustomer, isContract);
else
isContract = false;
process(isCustomer, isContract);
else
isCustomer = false;
isContract = false;
process(isCustomer, isContract);
Just looking at the pseudo-code, you should see why I almost flipped
my lid. You can easily rewrite that is this:
foreach customer, contract in table1, table2:
isCustomer = (customer in history);
isContract = (contract in history);
process(isCustomer, isContract);
It doesn't take a master refactorer to figure that one out. (AND it is
impossible for there to be a contract without a customer) Now, how do
I tell my boss, who thinks this code is exceptionally difficult, that
he made some obvious mistakes?
He is very arrogant about how he got his code to work. I am not
impressed. I don't want to hurt his feelings by pointing out (there
are many more) his obvious mistakes and inefficiencies.
There is just too much . . . to ignore!