Understand: Detailed efficient code static analysis artifact (a) turn

Before using a Windows system, has been with the insight to see the code source is very convenient, but years ago switched to mac below, although many things are convenient, but not a static code analysis tool, very lucky, some time ago to find a specific source insight software yet powerful code static analysis tool, called artifacts -Understand. The software has a powerful code static analysis capabilities, and can draw various flowcharts, unfortunately, we did not find the Windows version, only to see mac and Linux versions, so Windows system using a friend's sorry.

Too busy, no time detailed study about the use of, simply understand a bit, because the software can help you quickly analyze the structure of the code flow, so I share in advance to everyone, and we hope to study together, learn together , below I make a preliminary explanation for this software, a detailed explanation will follow, because the software is in English so there are problem areas we hope to point out that I will promptly correct.

As the installation is very simple, this is not to say, direct access to project configuration to explain.

Import project

Import Project There are two ways, one is from the menu bar click on File-> New-> Project, the other is click on the middle of the following interface New Project

Once clicked, will enter into the following interface, you can change the project name for the project name you want to import in order to find later, you can import your projects being developed directly after your code changes, the project will be automatically updated, allowing you to quickly develop, you do not need to import every time.

After the change of name and click Next to enter the following interface, this interface is to allow you to choose you want to import project which contains several languages, note that there are two modes in C / C ++ later, the following notes, which includes Strict mode and Object-C Object-C ++, as well as Web comments, see for yourself just fine, this will not explain,

Then click Next to enter the following interface:

In this interface, click on the "Add a Directory", that is, add the path you want to import the project, when clicked, will pop up the following interface, then there is a wonderful pop-up screen will be blocked on the map interface, then you have to move the open interface, then the following interface will appear:

Click on the button with three dots behind the choice you want to join the project folder, open the folder where do, as long as the points open the folder click the button:

此时只需要点击OK即可,界面会跳转到如下界面:

此时有两个选项,一个是立即分析代码,一个选择配置,对于我们来说只需要默认即可,然后点击OK按钮,此时软件开始分析代码,分析完成后会出现如下界面:

左侧会出你的项目结构,中间出现你项目的名称,此时你可以操作左面项目来查看相关代码,如下图所示:

这么多类和方法如何快速定位,那肯定是搜索,该软件针对不同位置,不同属性有不同的搜索方法,下面介绍搜索功能。

搜索功能

1.左侧项目结构中搜索:在这个搜索中你可以快速搜索你要查看的类,快捷键,鼠标点击左侧上面项目结构窗口,然后按command + F键会出现如下图所示的搜索框,在框中输入你想要的类回车即可

2.类中方法搜索:将鼠标定位到右侧代码中,点击command + F,会弹出搜索框,输入方法回车即可:

3.在文件中搜索:也就是全局搜索,快捷键F5或者去上面菜单栏中的search栏中查找,输入你想要的类或者方法,回车查找,下面会列出所有使用的地方:

4.实体类查找:软件菜单栏search中最后一项–Find Entity,点击输入你要查找的实体类,回车查找:

快速搜索是软件快速使用必备的技能,包括我们常用的idea一样,快速定位类,方法,常量等,可以快速帮助我们解决问题。

上面我介绍改软件时提到可以绘制流程图等功能,下面就针对这个功能介绍一些一些图形的绘制功能,帮助你快速分析代码。

项目视图

项目视图包含很多的功能,能够自动生成各种流程图结构图,帮助你快速理清代码逻辑、结构等,以便快速理解项目流程,快速开发,视图查看方式有两种,一种是鼠标点击你要查看的类或者方法等上面,然后右键弹出菜单,鼠标移动到Graphical Views,然后弹出二级菜单,如下图所示:

另一种方式是点击要查看的类或者方法,然后找到代码上面菜单栏中的如下图标:

然后点击图标右下角的下拉箭头,弹出如下菜单,即可选择查看相关视图:

层级关系视图分类:

1.Butterfly:如果两个实体间存在关系,就显示这两个实体间的调用和被调用关系;如下图为Activity中的一个方法的关系图:

2.Calls:展示从你选择的这个方法开始的整个调用链条;

3.Called By:展示了这个实体被哪些代码调用,这个结构图是从底部向上看或者从右到左看;

4.Calls Relationship/Calledby Relationship:展示了两个实体之间的调用和被调用关系,操作方法:首先右键你要选择的第一个实体,然后点击另一个你要选择的实体,如果选择错误,可以再次点击其他正确即可,然后点击ok;

5.Contains:展示一个实体中的层级图,也可以是一个文件,一条连接线读作”x includes y“;

6.Extended By:展示这个类被哪些类所继承,

7.Extends:展示这个类继承自那个类:

结构关系视图分类:

1.Graph Architecture:展示一个框架节点的结构关系;

2.Declaration:展示一个实体的结构关系,例如:展示参数,则返回类型和被调用函数,对于类,则展示私有成员变量(谁继承这个类,谁基于这个类)

3.Parent Declaration:展示这个实体在哪里被声明了的结构关系;

4.Declaration File:展示所选的文件中所有被定义的实体(例如函数,类型,变量,常量等);

5.Declaration Type:展示组成类型;

6.Class Declaration:展示定义类和父类的成员变量;

7.Data Members:展示类或者方法的组成,或者包含的类型;

8.Control Flow:展示一个实体的控制流程图或者类似实体类型;

9.Cluster Control Flow:展示一个实体的流程图或者类似实体类型,这个比上一个更具有交互性;

10.UML Class Diagram:展示这个项目中或者一个文件中定义的类以及与这个类关联的类

11.UML Sequence Diagram:展示两个实体之间的时序关系图;

12.Package: show to all entities declared in a given package name

13.Task: display parameters of a task, call entity

14.Rename Declaration: show all entities of the entity to be renamed

As more views, so eleven pasting the code, mainly to make their own debugging view showing the structure and roles of the various functional view of Practice makes perfect, more than a few will be operating, so no longer do too much explanation . The final hope this software will help you quickly develop speed reading someone else's or your own code.

1
Note: The original article, please indicate the source.

Article title: Understand: Detailed efficient code static analysis artifact (a)

Author: Mo Siang

Published: April 30, 2016 - 22:25

Last Updated: May 2, 2016 - 16:18

Original link: http://www.codemx.cn/2016/04/30/Understand01/

Guess you like

Origin www.cnblogs.com/idyllcheung/p/11622475.html