问题描述
您好:
我今天和老板进行了一个小时的讨论。昨晚,在我打瞌睡之前,确认了他的一些代码导致重复
处理。我试图向他解释,他一直说,我是
害怕说它''''''''''''''''''''''''''''''''''' >
a reason。嗯,我知道的更好。
我的老板''旧代码是用一些带有Oracle的隐藏式C文件编写的
预编译宏在它上面完全禁止。一旦我弄清楚如何忽略90%的宏观垃圾,它就是努力跟踪所有全局变量的价值。
我昨天看了一些代码,把它转换成伪代码,
我就出来了:
foreach customer ,表1中的合同,表2:
if(客户在历史中):
isCustomer = true;
if(合约在历史中)
isContract = true;
process(isCustomer,isContract);
else
isContract = false;
process(isCustomer,isContract);
else
isCustomer = false;
isContract = false;
进程(isCustomer,isContract);
只要看一下伪代码,就应该明白为什么我差点翻转
我的盖子。您可以轻松地重写这个:
foreach客户,table1中的合同,table2:
isCustomer =(历史客户);
isContract =(历史上的合约);
流程(isCustomer,isContract);
它不需要主重构来计算一出。 (并且没有客户的合同是不可能的b $ b)现在,怎么办
我告诉我的老板,他认为这段代码非常困难,
他对如何让他的代码工作非常傲慢。我不是给b $ b留下深刻印象。我不想通过指出(那里还有更多)他明显的错误和低效率来伤害他的感受。
太多了。 。 。忽略!
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!
推荐答案
你介于摇滚和硬地之间。如果是我,我会浪费更多的时间在它上面。我会发表评论说Boss说一个电话
比两个更好,然后他不知道为什么,但他是老板。我会留下
然后继续前进。
PD
You are between a rock and hard place. If it were me I would waste no
more time on it. I would put a comment in saying "Boss said one call
is better then two he does not know why, but he is boss" I would leave
there and move on.
PD
同意但重新说出来,以防万一他再次看到它再次获得
。如果时间允许的话,也可以清理任何明显的问题/效率,如果你没有问他就能做到这一点。只要确保你不会意外地将事情搞砸了。无论如何,试着习惯这个。你可能
从不喜欢它,但是你会在你的职业生涯中处理它。
相信我,现实世界中的大多数程序员都会写这种类型的代码和
往往更糟糕。
Agreed but re-word it so he won''t take exception in case he ever sees it
again. Time permitting, also clean up any obvious problems/inefficiences if
you''re in the position to do so without asking him. Just make sure you don''t
botch things up by accident. In any case, try to get used to this. You may
never like it but you''ll be dealing with it for the rest of your career.
Believe me, most programmers in the real world write this type of code and
often much worse.
这篇关于我的老板是一个屁股(但我不想伤害他的感情)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!