了解其他人的代码 [英] understanding other persons code

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

问题描述

我有一些C ++的经验,我有这样的任务。

阅读其他人的代码(他用C ++实现了一些项目)

和可能是理解它,它是如何构成发生的事情

那里等等。

你有一些tipps如何处理这样的任务?

什么是确保你很好理解的好方法

其他人写的是什么?



例如,我开始添加评论/解释他的

代码,以前不存在。



谢谢。

解决方案

为了理解别人的代码,你需要做RE(逆向工程),即为了发现制造过程中涉及的概念而进行详细拆解或分析。



维基百科:

逆向工程是发现技术的过程设备,物体或系统的原理通过分析其结构,功能和操作来实现。它通常涉及将某物(机械设备,电子元件,计算机程序或生物,化学或有机物质)分开并分析其工作原理详细地用于维护,或尝试制作一个新的设备或程序来做同样的事情而不使用或只是复制(不理解)原件。

逆向工程起源于商业或军事优势的硬件分析。目的是从最终产品中推断设计决策,对原始生产中涉及的程序几乎没有或没有额外的知识。随后研究相同的技术应用于le gacy软件系统,不是用于工业或国防目的,而是用于替换不正确,不完整或不可用的文档



简要说明:

通过逆向工程,研究人员可以收集记录技术或系统组件操作所需的技术数据。在逆向工程软件中,研究人员能够检查系统的强度,并在性能,安全性和互操作性方面确定其弱点。逆向工程过程使研究人员能够了解程序的工作原理以及程序的哪些方面导致程序无效。创建更好的设计和现有产品的互操作性通常从逆向工程开始。一些UML图是可取的。

例如:类图,序列图等。

关于UML,请看这里:http://en.wikipedia.org/wiki/Unified_Modeling_Language





逆向工程包括以下步骤:

* 观察并评估使设备工作的机制。 />
* 解剖并研究机械设备的内部工作原理。

* 将实际设备与您的观察结果进行比较并建议改进。


这是一个大问题,不仅仅是因为你的代码阅读技巧,而是因为那些其他人经常真正编写不可读的代码。即使开发人员越来越好地相互隔离,通过与模块化和统一相关的各种(但缓慢)改进的技术,仍然需要阅读彼此的代码。对于监督开发和制定解决方案的人来说,这对于每个人来说都是非常重要的,因为在优秀的大团队中,应该实施软件评论。



作为主要问题仍然存在无法读取的代码,你应该从自己开始。这是一个简短的计划。



  1. 学习如何编写代码。在这个阶段,如果你不能阅读别人的代码就不在乎。
  2. 确保你的代码非常好,你可以理解你自己的代码。
  3. 确保您的代码非常好,其他具有足够资格的人可以理解您自己的代码。
  4. 成为具有高级开发技能的人。确保您的代码非常有价值,以便您可以教别人。到目前为止,不在乎你无法理解别人写的代码。
  5. 剩下的技能是学习如何阅读别人写的代码。这完全没问题。现在,确保您已经掌握了上述技能,然后开始在此CodeProject论坛上回答问题。你很快就能很快掌握这些技能。





祝你好运,

< DD> -SA


Hi, I have some experience with C++ and I have such task.
To read someone else''s code (he implemented some project in C++)
and probably understand it, how it is structured what happens
there etc.
do you have some tipps how to approach such task?
What is the good way to make sure you well understand
what someone other wrote?

e.g., for example, I started adding comments/explanations to his
code, which weren''t present before.

Thanks.

解决方案

In order to understand someone else''s code, you need to do RE (reverse engineering) ,i.e. disassemble or analyze in detail in order to discover concepts involved in manufacture.

Wikipedia:
"Reverse engineering is the process of discovering the technological principles of a device, object, or system through analysis of its structure, function, and operation. It often involves taking something (a mechanical device, electronic component, computer program, or biological, chemical, or organic matter) apart and analyzing its workings in detail to be used in maintenance, or to try to make a new device or program that does the same thing without using or simply duplicating (without understanding) the original.
Reverse engineering has its origins in the analysis of hardware for commercial or military advantage.The purpose is to deduce design decisions from end products with little or no additional knowledge about the procedures involved in the original production. The same techniques are subsequently being researched for application to legacy software systems, not for industrial or defence ends, but rather to replace incorrect, incomplete, or otherwise unavailable documentation"

In brief:
Through reverse engineering, a researcher can gather the technical data necessary for the documentation of the operation of a technology or component of a system. When reverse engineering software, researchers are able to examine the strength of systems and identify their weaknesses in terms of performance, security, and interoperability. The reverse engineering process allows researchers to understand both how a program works and also what aspects of the program contribute to its not working. The creation of better designs and the interoperability of existing products often begin with reverse engineering. It is desirable to do some of UML diagrams.
For example : a class diagram, sequence diagram and etc.
About UML, please see here:http://en.wikipedia.org/wiki/Unified_Modeling_Language


Reverse engineering consists of the following steps:
* Observe and assess the mechanisms that make the device work.
* Dissect and study the inner workings of a mechanical device.
* Compare the actual device to your observations and suggest improvement.


This is a big problem, and not just because of your code-reading skills, but because of those "other people" often really write unreadable code. Even though developers get isolated from each other better and better, through all kinds of ever (but slowly) improving technologies related to modularity and unification, reading the code of each other is still needed. It''s absolutely important for people supervising development and making solution, and for everyone, because in good big teams, software reviews should be practiced.

As the main problem is still existence of unreadable code, you should start from yourself. Here is a brief plan for you.

  1. Learn how to write code very well. At this stage, don''t care if you cannot read code of others.
  2. Make sure that your code is so good that you can understand your own code.
  3. Make sure that your code is so good that other people of enough qualification can understand your own code.
  4. Become a person with advanced development skill. Make sure that your code is so valuable that you can teach others. Up to this point, don''t care that you cannot understand code written by others.
  5. The remaining skill is learning how to read the code written by others. It''s perfectly OK. Now, make sure you already got the skills mentioned above and then start answering questions on this CodeProject forum. You well get this skills very, very quickly.



With you the best of luck,

—SA


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

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