代码理解,逆向工程,最佳概念和工具。 Java的 [英] Code understanding, reverse engineering, best concepts and tools. Java

查看:198
本文介绍了代码理解,逆向工程,最佳概念和工具。 Java的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何程序员最苛刻的任务之一,架构师都在理解其他代码。

One of most demanding tasks for any programmer, architect is understanding other's code.

例如,我是承包商,雇用来快速救出一些项目。修复错误,计划全局重构,因此我需要最有效的方法来理解代码。什么是概念列表,它们的优先级和最佳工具?

For example, I am contractor, hired to rescue some project very quickly. Fix bugs, plan global refactoring and therefore I need most efficient way to understand the code. What is the list of concepts, their priority and best tools for this?

据我所知:反向代码工程创建对象模型(每个包创建图表不太方便),创建序列图(该工具以调试模式连接到系统并从运行时生成图表)。一些可视化技术,使用一些工具不仅可以使用 .java ,还可以使用 JPA 实现者,如 Hibernate 。为所有代码库生成图表,但添加一些类,然后添加它使用的类。

Of what I know: reverse code engineering to create object models (creating of diagram per package is not so convenient), create sequence diagrams (the tool connects in debug mode to the system and generates diagrams from runtime). Some visualizing techniques, using some tools to work not just with .java but also with e.g. JPA implementors like Hibernate. Generate diagram for not all the codebase, but add some class and then classes used by it.

Sparx Enterprise Architect是逆向工程还是远离它的最先进技术?还有其他更好的工具?理想情况下,该工具会让我理解代码,好像我自己编写代码一样:)

Is Sparx Enterprise Architect state of the art in reverse engineering or far from that? Any other better tools? Ideally would be that tool makes me understand the code as if I wrote it myself :)

推荐答案

这本书面向对象的重组模式详细论述了这一点。不幸的是,没有附加银弹: - )

The book Object-Oriented Reengineering Patterns deals with this in detail. Unfortunately there is no silver bullet attached :-)

然而,它列出了许多用于接管遗留代码的有用技术。简而言之

However, it lists a lot of useful techniques for taking over legacy code. In brief


  • 至少采访一些原始开发人员(如果他们还在)约


    • 开发历史:阶段,发布

    • 当前状态

    • 团队社会结构,政治,动态:何时和为什么人们加入和离开

    • 错误:典型的,最简单的,最难的

    • 代码质量:最干净/最丑陋的部分

    • 配置数据:表单,内容和用法

    • unit / integration / manual / ...测试用例和数据

    • SCM分支结构和用法

    • 文档:记录在哪里,是最新的

    • 外部接口联系人

    • interview at least some of the original developers (if they are still around) about
      • development history: phases, releases
      • current state of affairs
      • team social structure, politics, dynamics: when and why did people join and leave
      • bugs: typical, easiest, hardest
      • code quality: cleanest / ugliest parts
      • configuration data: form, content and usage
      • unit / integration / manual / ... test cases and data
      • SCM branch structure and usage
      • documentation: what is documented where, is it up to date
      • contact persons for external interfaces

      • 主要功能

      • 典型用例

      • 用法轶事

      • 好/坏,缺失/多余功能

      • main features
      • typical use cases
      • usage anecdotes
      • good / bad, missing / superfluous functionality

      • 获得类层次结构,接口的高级视图

      • 如果需要,可以进行多个会话

      • 识别大型结构(这些通常包含重要功能)

      • 寻找设计模式

      • 检查评论(他们可以揭示了很多,但可能也有误导性)

      • get high level view of class hierarchies, interfaces
      • take multiple sessions if needed
      • identify large structures (these often contain important functionality)
      • look for design patterns
      • check comments (they can reveal a lot, but may be also misleading)

      • 只记录特定类型文档的可用性,例如规范,UML图,Wiki,Javadoc等。

      • 是否有用,为什么(不是)

      • 是最新的

      这篇关于代码理解,逆向工程,最佳概念和工具。 Java的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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