其他人的代码...... [英] Other peoples code...

查看:66
本文介绍了其他人的代码......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

今天我感到有点绝望,所以我寻求指导或其他方式来缓解痛苦。

这是关于我的一个项目最近被分配到。它主要由三个DotNetNuke模块组成(这不是问题)。这些模块是学生们早期写的。



我已经在这里发布了一些内容: http://www.codeproject.com/Feature/WeirdAndWonderful.aspx?msg=4473067#xx4473067xx [ ^ ]



我正在努力弄清楚这些模块中发生了什么。我阅读的越多,我就越觉得对OOP缺乏了解就会让他们像疯了一样传播代码而没有任何关系。大量的类,重定向,自制的会话管理器(在三个级别继承,只有一个const字符串,用于更改密钥)。只有自动生成的评论(或者我不会说的语言评论)。



感觉就像穿过无限的树状视图,只要我尝试就会在我脸上爆炸弄清楚发生了什么。 10分钟后我完全迷失了,缺乏结构使我无法写下图表或其他任何简化理解。



特别是SQL部分是万圣节版本一个醉酒的疯子。

如上面提到的链接所示,几乎不可能理解在没有调试器填充常量的情况下触发的SQL ...是的,调试器...



搜索示例。它会触发用于填写搜索表单的相同页面,将搜索参数写入会话对象,重定向然后执行一些魔术。

页面是使用多个对象创建的HTML和JavaScript。

我发现超过15个类使用标记创建Google-Map ...当然是过时的API。它基本上传递一个StringBuilder来添加行,这使得几乎不可能看到结束括号的位置以及它们如何匹配...



我是否提到过使用用于创建HTML的自定义令牌?超过50个和模板存储在哪里解析HTML?所有人都使用传阅的XML阅读器来阅读价值......



我一直都是OOP的忠实粉丝,我觉得自己在使用它时非常可靠,特别是关于特定问题的结构和封装。但是这些东西让我疯狂......



有没有人给我一些提示或知道如何让这个更容易一点?

通常情况下,我试着用是的,有趣的东西来解决这些问题......让我们做吧!方式,但这次我几乎无法容纳自己...



如果您有任何意见或想法,我会很高兴听到他们的意见;)



有美好的一天

Andy







更新

有些日子过去了,因为我们决定将所有内容放在桌面上并进行整理。幸运的是,它并没有太糟糕,我们终于同意将当前项目废弃并完全重做是个好主意。如果你不想听我的意见,这是一个很好的机会,因为它让我们有机会将项目升级到今天的标准。它仍然是一个DotNetNuke项目,但仅用于显示结果或输入搜索参数。

过时的GoogleMaps API部分也将被替换,我们将牺牲SQL常量混乱到代码恶魔,所以我可以看到地平线上的银线;)



照顾好人们,感谢所有参与此旅程的人;)

干杯

Andy

Hi all,
I feel a little bit desperate today, so I seek for guidance or another way to relief the pain.
It's all about a project I was recently assigned to. It mainly consists of three DotNetNuke modules (that's not the problem). Those modules have been written by students in their early time.

I already posted a little bit of it here: http://www.codeproject.com/Feature/WeirdAndWonderful.aspx?msg=4473067#xx4473067xx[^]

I am trying for days to figure out what's going on within those modules. The more I read the more I get the feeling that some lack of understanding for OOP made them spread code like mad without any relation. Tons of classes, redirects, self-made session-managers (inherited in three levels with only a const string for the key to change). Only auto generated comments (or comments in a language I do not speak).

It feels like going through an infinite tree view that explodes right in my face whenever I try to figure out what is going on. After 10 minutes I am completely lost, and the lack of structure makes me fail to write down diagrams or whatever to ease understanding.

Especially the SQL part is a Halloween version of a drunk mad man.
Like shown in the above mentioned link it's nearly not possible to understand the SQL that is fired without the debugger filling in the constants... Yeah, the debugger...

The search for example. It triggers the same page that is used to fill out the search-form, writes search-parameters to a Session-Object, redirects and then does some magic.
The pages are created using several objects to write out HTML and JavaScript.
I found over 15 classes that create the Google-Map with the markers... of course for the obsolete API. It basically passes around a StringBuilder to add lines which makes it nearly impossible to see where the closing brackets are and how they match...

Have I mentioned the use of custom tokens for creating the HTML? Over 50 of them and templates stored wherever to parse out the HTML? All use a XML reader that is passed around for reading the values...

I was always a big fan of OOP and I consider myself quite reliable when using it, especially regarding structure and encapsulation of specific problems. But this stuff drives me insane...

Does anybody have a hint for me or knows about a way to make this one a little bit easier?
Normally I try to tackle such things in a "Yeah, something interesting... let's do it!" way, but this time I can hardly contain myself...

If you have any comments or ideas, I'll be happy to hear about them ;)

have a great day
Andy



Update
Some days passed by since we made the decision to put everything on the table and sort it out. Luckily it wasn't too bad at all and we all finally agreed that it would be a good idea to trash the current project and redo it completely. A great opportunity if you wan't to hear my opinion, because it gives us a chance to level the project up to today's' standards. It will still be a DotNetNuke project, but just for displaying the results or entering search parameters.
The obsolete GoogleMaps API part will be replaced too, and we will sacrifice the SQL constant mess to the code-devil, so I can see a silver line at the horizon ;)

take care people and thanks to all those who participated in this journey ;)
Cheers
Andy

推荐答案

hoernchenmeister写道:
hoernchenmeister wrote:

我已经提到了重新设计的问题,但我的上级对此并不太满意。金钱花了,我想把它扔掉会因此而变得邪恶。

I already mentioned the "redesign" question, but my superior wasn't too happy about it. Money was spent and I guess throwing it away would be something "evil" because of that.

也许你的上司不明白如何对金钱负责。 花钱不是一个有效的论据。我希望你自己理解。比如说,有两种选择:

Maybe your "superior" does not understand how to be responsible for money. "Money spent" is not a valid argument. I hope you understand it yourself. Say, one has two options:

  1. 丢掉腐烂的代码,这样就承认钱花在了无所事事上;承认他们迷路了。
  2. 假装合理地花钱(也许是为了保护做出决定的人的权威),强制使用它,并且由于它,浪费更多的钱,你的和其他人的工资,涉及未交付产品的成本,提供不工作的解决方案和处理后果。



现在想想,谁真的在浪费钱?



这是你应该意识到的:



首先,工程师最重要的品质之一是理解反模式,识别和预防或克服它们的能力。在这一刻,我们可以谈论被称为组织的反模式类:

http://en.wikipedia.org/wiki/Anti-pattern#Organizational [ ^ ]。



哪一个?这是一个问题。这可能只是无能,你需要测试这个人在技术上是否有资格作出有问题的决定(是的,你需要,你)。或者(或与上述相结合),可能是这种反模式,与花钱问题密切相关:道德风险:将决策者与他的后果隔离开来或她的决定:

http://en.wikipedia.org/wiki/Moral_hazard [ ^ ]。



现在,你能做什么?可以有选择。你应该彻底思考,不要立即跳到结论。你需要测试这个人是否有能力倾听人们并做出高质量的决定(是的,你需要,你,没有其他人)。如果你清楚而毫无希望地找出一个反模式,上面讨论过的或者他们绝望的结果,而且你非常肯定你不能期待更好的事情,如果你认为自己是一个有尊严的体面的工人,你将需要做最后一步,...... 摆脱这个人。



怎么样? 1)你可以等待,看看会发生什么;世界如果远非完美,但最终会发生正确的事情;这个人可能会失败而离开公司;它真的发生在现实生活中。 2)自己离开这个团队或这个公司。这可能是一个艰难的决定,但替代方案非常有趣:考虑如果你准备好浪费你的生活多年在垃圾桶上,只会降低你的技能和声誉,或者你更愿意成长和移动转发。



最后注意:如果您决定在噩梦般的工作或道德条件下等待和工作,请自觉地做。怎么样?尽量利用这段时间为自己工作,而不仅仅是为了公司。首先,尝试利用这段时间学习一些非常有用的东西。例如,了解如何不编写类似的代码







在下面的评论中,请注意与Ron讨论。他的建议非常好,这是另一个真正的选择。您可以选择重写代码,并在地下执行此操作。我试着解释为什么这是一个很好的决定。



-SA


And now think, who is really wasting money?

Here is what you should realize:

First of all, one of the most important qualities of an engineer is understanding such thing as anti-pattern, ability to identify and prevent or overcome them. At this moment, we can talk about the class of anti-patterns called "organizational":
http://en.wikipedia.org/wiki/Anti-pattern#Organizational[^].

Which one? This is a question. It could be just incompetence, and you need to test this person for being technically qualified for making the decisions like the one in question (yes, you need to, you). Alternatively (or in combination with the above), it could be this anti-pattern, closely related to the issue of "money spent": moral hazard: "Insulating a decision-maker from the consequences of his or her decision":
http://en.wikipedia.org/wiki/Moral_hazard[^].

Now, what can you do? There can be options. You should think thoroughly and not jump to conclusion right away. You need to test this person for ability to listen to people and to make quality decision (yes, you need to, you, nobody else). If you clearly and hopelessly identify one of the anti-pattens, those discussed above or close in their hopelessness, and you are quite positive that you cannot expect something better, and if you consider yourself a decent worker with dignity, you will need to make a last step and… get rid of this person.

How? 1) You can wait and see what tends to go on; the world if far from perfect, but ultimately right things happen; this person may appear unsuccessful and leave the company; it really happens in real life. 2) Leave this team or this company yourself. It might be a difficult decision, but the alternative is quite interesting: consider if you are ready to waste years of you life on trash and only lower your skills and reputation, or you would prefer to grow and move forward.

Last note: if you make a decision to wait and work in a nightmare working or moral conditions, do it consciously. How? Try to use this time working for yourself, not just for company. First of all, try to use this time for learning something really useful. For example, learn how not to write similar code.



Please also pay attention for out discussion with Ron, in the below comments. His advice is very good, this is another real option. You can choose to rewrite the code anyway, and to do this underground. I tried to explain why it can be a good decision.

—SA


这篇关于其他人的代码......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆