简体   繁体   English

使用某些类型的图可视化我的小型C程序的最佳方法是什么?

[英]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): 我想展示的东西(我不知道如何展示):

  • Inputs and Outputs (printf, scanf) 输入和输出(printf,scanf)
  • Loops 循环
  • Control Statements 控制声明

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.

相关问题 在调试时可视化DataTable的最佳方法是什么? - What is the best way to visualize a DataTable while debugging? 在Windows中对程序进行基准测试的最佳方法是什么? - What's the best way to benchmark programs in Windows? 用C ++编写控件以便可以被C ++和C#程序使用的最佳方法是什么? - What is the best way to write a control in C++ so that it can be used by C++ and C# programs? 同一台机器上的两个程序相互通信的最佳方法是什么 - What is the best way for two programs on the same machine to communicate with each other 跨程序发送自定义ACS声明的最佳方法是什么? - What is the best way to send custom ACS Claims across programs? 转换列表的最佳方法是什么<string>列出<type>在 C# 中 - What is the best way to convert List <string> to List<type> in C# 在 c# 中处理原始类型多态性的最佳方法是什么? - What is/are the best way to handle primitive type polymorphism in c#? C#确定继承接口类的最佳方法是什么? - C# What is the best way to determine the type of an inherited interface class? 在C#中的项目中使用图像文件的最佳方法是什么 - What is best way to use image files in my project in C# 使用C#Entity Framework控制我传递到表中的数据类型的方法 - Way to have control over what data type I pass into my tables using C# Entity Framework
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM