[英]What is the best way to visualize my small c programs using some type of diagrams?
I want to learn how can I visualize my small c programs using some type of diagrams . 我想学习如何使用某种类型的图可视化我的小型c程序。 My programs generally include (3 or 4 functions) (some loops) (basic i/o (printf scanf)), and basic calculations. 我的程序通常包括(3个或4个函数)(一些循环)(基本I / O(printf scanf))和基本计算。 I do not want to visualize everything about my program(name of vars, type of vars) , but I want to create some type of diagram which will help other person to understand how it works .Instead of showing 150-250 lines of code I want to show 1-2 page schema. 我不想可视化我程序的所有内容(变量名称,变量类型),但是我想创建某种类型的图来帮助其他人理解它的工作原理,而不是显示150-250行代码想要显示1-2页架构。
Things I want to show (which I do not know how to show): 我想展示的东西(我不知道如何展示):
Also, I am looking for agreed and standart way of doing this . 另外,我正在寻找达成共识的标准方式。
基本上,选择正确的图表类型取决于您要显示的内容,但是如果您希望其他人“了解它的工作原理”,我相信流程图将满足您的需求。
UML was all the rage a decade ago. UML在十年前风靡一时。 It defines a bewildering number of diagram types, one of which is the "Activity diagram". 它定义了数量惊人的图类型,其中之一就是“活动图”。 It is a standard for drawing diagrams that show the things you want to show. 它是用于显示要显示的内容的绘图图的标准。 See http://en.wikipedia.org/wiki/Activity_diagram for an example and links. 有关示例和链接,请参见http://en.wikipedia.org/wiki/Activity_diagram 。
I would definitely prefer code or pseudo-code over a diagram though. 我绝对会喜欢代码或伪代码而不是图表。 I think most people who are used to reading code would. 我认为大多数习惯阅读代码的人都会这样做。
如果您可以访问Visual Studio 2010,则某些版本会附带大量工具来执行此操作,这是概述某些功能的早期文章之一。
You can compile the program with gcc's gprof profiling options and then convert the output of the run to a visual call graph using a tool like Gprof2Dot . 您可以使用gcc的gprof分析选项来编译程序,然后使用Gprof2Dot之类的工具将运行的输出转换为可视调用图。
While this isn't quite the level of detail you're hoping for it's probably the best you can do. 虽然这并不是您希望的详细程度,但它可能是您可以做到的最好的。 I've always found it to be a useful way of getting to know an unfamiliar code base. 我一直发现它是了解陌生代码库的有用方法。
There are many software visualization tools available. 有许多可用的软件可视化工具。 Check http://en.wikipedia.org/wiki/Software_visualization for a summary. 检查http://en.wikipedia.org/wiki/Software_visualization以获得摘要。 I like Enterprise Architect from Sparx Systems. 我喜欢Sparx Systems的Enterprise Architect。 It's under $200 and is a full-featured UML tool that allows round-tripping your code and models. 它的价格在200美元以下,并且是功能齐全的UML工具,可以往返处理您的代码和模型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.