发现现有项目的最佳方式是什么?
最近我接到的任务是发现一个我以前从未见过的 C# 解决方案,并给出重构它的建议。 我想我将使用 NDepend(有史以来第一次)来查看整体情况,并检查大量代码指标以找出可以重构的内容。 我认为 NDepend 非常擅长展示项目的结构。
我的问题是一个更普遍的问题:您认为发现您第一次看到的代码并需要了解其结构的最佳方法是什么? (不幸的是,没有逻辑设计文档,并且代码注释很差。)
recently I was given the task to discover a C# solution I have never seen before, and give suggestions on refactoring it. I think I will use NDepend (for the first time ever) to see the overall picture, and also to check a lot of code metrics to figure out what could be refactored. NDepend is pretty good at showing the structure of a project, I think.
My question is a more general one: what do you think is the best way to discover code that you are seeing the first time, and need to understand it's structure?
(Unfortunately there is no logical design documentation and the code is poorly commented.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 NDepend 代码发现变得更加容易。 该工具提供了一种自上而下的方法来处理程序集、命名空间和类之间的依赖关系和分层。 这是通过代码生成的一些图表和依赖关系矩阵来完成的。
您还将获得对层代码程序集的依赖关系,这对于了解代码的哪一部分执行什么操作非常有用。
此外,一些体积指标的图形表示(例如代码行数)有助于清楚地了解代码的工作量。
Code Discovery is much more easy with NDepend. This tool provides a top-down approach on dependencies and layering between assemblies, namespaces and classes. This is done with some graph and depednencies matrix generated from the code.
You'll also get dependencies on tier code assemblies, which is really useful to know which part of the code does what.
Also, some graphical representation of volume metrics such as # lines of code helps a lot to get a clear idea of where the effort where done on the code.
我经常使用 Reflector 来研究第三方程序集以及 .NET 程序集。 与其说是对阶级之间关系的鸟瞰图,不如说是对正在发生的事情的特写细节。
I frequently use Reflector to study third-party assemblies as well as .NET assemblies. Not so much for a bird's-eye view of the relations between classes, but a more for close-up detail of exactly what is going on.