I tend to be a visual thinker. So if I can imagine the flow of data through a program I can understand what's happening in it better then if I was reading a text story (pseudo code) of what's happening.
Is there a way to visually represent the way variables and objects flow through and are changed by functions? Preferably something that works on the small scale, inside an individual function and a larger scale of the program as a whole.
For instance English classes used to teach sentence diagramming. Electrical Engineers have circuit diagrams. Is there an equivalent in Computer Science?
Diagramming Software Overview Diagramming Software support the creation of flowcharts, diagrams, and maps for org charts, seating arrangement for events or office planning, network diagrams, conceptual diagrams, or project ideation (e.g. Venn diagrams, cause-and-effect, testable models, mind maps etc).
Visio is best for drawing flowcharts or domain specific figures. I draw simple diagrams and drawings, I draw diagrams in the drawing tools available in Ms Word and Ms Power Point. On the other hand, I draw more complex diagrams and diagrams in specific graphic applications, such as Ms Visio and SmartDraw.
diagrams.net (formerly draw.io) is free online diagram software. You can use it as a flowchart maker, network diagram software, to create UML online, as an ER diagram tool, to design database schema, to build BPMN online, as a circuit diagram maker, and more. draw.io can import .vsdx, Gliffy™ and Lucidchart™ files .
I'm a haskeller, so I'll speak for pure functional programming. The first thing that comes to my mind is commutative diagrams. These can be used to describe how functions and structures interact with each other; however, they rather define invariants/laws than behaviour.
Another thing useful to know when thinking about evaluation of lambda calculus (or higher-level languages based thereon) are expression graphs, as used in graph reduction. They let you see the structure of your expression, including sharing. Of course, this only makes sense as long as the code is pure, i.e., no mutations happen.
A third kind of diagram, useful to visualize how data is passing though functions, are different kinds of data flow diagrams, like the ones used for arrows (which can be used for normal functions too, since (->)
is an arrow), or SICP's "Henderson diagrams". These show how individual functions are "plugged together". Another perspective on this are the diagrams used for drawing stream processing/pipe and filter style, like marble diagrams, which focus more on a notion of time (and, as opposed to arrow diagrams, do represent individual values).
There are some automated solutions. Both of these show you what's in the computer's memory at each step of the computation.
Python has the Python Tutor which is entirely online.
For Haskell, see ghc-vis. This one requires installation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With