TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How do you visualize code?

160 pointsby otrasover 3 years ago

49 comments

juancnover 3 years ago
I just don&#x27;t visualize it much.<p>I do visualize dataflow, and tend to encapsulate responsibility boundaries, so as to be able to assert properties of a bunch of code and not have to think about the internals. But other than big block analysis I just don&#x27;t break it down that much.<p>I&#x27;ve been coding for 37 years, 23 of those professionally (it&#x27;s not bragging, just to establish that I&#x27;ve read and written a lot of code), at this point I just kind of read the code a bit like prose, or more like a &quot;Choose your own adventure&quot; book.<p>I do like to have the ability to navigate symbols and do typed searches of a code base, I also appreciate typing and mutability properties of things (everything is assumed mutable unless proven otherwise, which complicates concurrency analysis).<p>It&#x27;s my experience that most coders think similarly, and you can usually assume quite a bit about how something is structured once you grasp the style of the programmers that built it, this also means that sometimes you can even predict the kinds of bugs they will tend to have. We&#x27;re not all so unique after all.
zbyover 3 years ago
In &#x27;Why we talk&#x27; (<a href="https:&#x2F;&#x2F;www.amazon.com&#x2F;Why-We-Talk-Evolutionary-Evolution&#x2F;dp&#x2F;0199563462" rel="nofollow">https:&#x2F;&#x2F;www.amazon.com&#x2F;Why-We-Talk-Evolutionary-Evolution&#x2F;dp...</a>) Dessalles arguments that we have two modes of talking - the first one is visual and probabilistic, the second one is topological - that is concerned about zero one questions - like if something is inside or outside of something. The first one is about imagining situations and judging their salience (or improbability). The second is about argumenting - simplifying the information so that you can &#x27;proove&#x27; stuff. The point is that visuals are too rich and there can be too many ways to imagine things - so it is hard to convince someone that a particular scene is wrong or right. When you simplify things to the topological level of question if something is inside something or outside - then you can use inference to arrive at some logical conclusions, with steps so obvious that it is hard to argument against them.<p>Programming is mostly about logic - that is why it is hard to visualise. I think this is the problem with &#x27;visual programming languages&#x27; (like <a href="https:&#x2F;&#x2F;enso.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;enso.org&#x2F;</a> - which, disclosure, is in my investmet porfolio) - and also here. This is kind of surprising - because we naturally expect the visuals to be as rich as the logic. But we need to carefully think about what is complementary here.
评论 #29985170 未加载
mr_tristanover 3 years ago
I find that programming languages are themselves a great reference... for the logic of a single thread. The moment you start doing concurrent development, or hell, even basic event-driven code, it gets much harder to &quot;just read along&quot;. This is where I would kill for visualizations to help out.<p>Like, if you fork your process at a point, vertically split the text into two columns with a line saying &quot;new thread over here&quot;. And then highlight any points of synchronization.<p>I think when people think of visualizations, it&#x27;s &quot;everything is a 2D graphic&quot;. When really, there could be new ways to laying out and navigating text-based source.
评论 #29985881 未加载
teunispetersover 3 years ago
Aphantasia. I don&#x27;t do &quot;visual&quot;<p>I have an odd form though, I do maps of relationships - including obligations and expected deliveries. Works largely for people and places too. And yeah, including likelihoods of delivery or accuracy of result.<p>So I have a default rule of &quot;always check inputs&quot;. One can always take a section of the map and - like algebra - substitute a variable for a block, and keep that separate to keep problems more manageable.<p>When I&#x27;m reading code, I&#x27;m building a map in my head of how it does things.<p>I&#x27;m not very effective at communicating such maps, so I have difficulty writing or speaking some of the time, but it&#x27;s no barrier with programming.
评论 #29985146 未加载
评论 #29986791 未加载
tyingqover 3 years ago
I know it&#x27;s filesystems and not code, but the SGI Irix &quot;fsn&quot; file system navigator, featured in Jurassic Park, seems worth mentioning:<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fsn_(file_manager)" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fsn_(file_manager)</a>
评论 #29988734 未加载
ethbr0over 3 years ago
As a fractal mental miasma of equations. Doesn&#x27;t everyone?<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=GIKfEAF2Yhw&amp;t=30s" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=GIKfEAF2Yhw&amp;t=30s</a>
评论 #29983313 未加载
评论 #29982359 未加载
评论 #29982351 未加载
DrBoringover 3 years ago
I still support a full stack web app that I wrote for a client 10 years ago.<p>Whenever I revisit a section of code that I haven&#x27;t looked at since then, I always have to re-learn the code&#x27;s logical structure and function. I&#x27;m sure most developers have experienced this.<p>I wonder if, 10 years ago, I were to have routinely viewed my code in a visual manner like in the article, would today&#x27;s relearning process take less time and frustration.<p>Sort of like when you revisit an old beloved vacation spot. Even though those memories have aged, the layout of the spot is relatively the same. You quickly remember where things are located.<p>I also wonder what value a code visualization like this would have for a new developer working with the code.
danielodievichover 3 years ago
In couple of my previous jobs I often needed to quickly understand large, disparate codebases, without having them compile.<p>I&#x27;ve used Source Insight (<a href="https:&#x2F;&#x2F;www.sourceinsight.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.sourceinsight.com&#x2F;</a>) to do this with great success. SI builds the typical tree of nodes and dependencies, except it can do so without having to compile anything, and can do so with multiple languages. It also has absolutely superb code&#x2F;fuzzy search experience.<p>Really old school tool, for a while it was site licensed at Microsoft, ran by just a few devs here in Issaquah, WA.
adonovanover 3 years ago
The challenge of becoming a programmer is that of learning to flip between all these different mental visualizations and more, unconsciously and without effort, just as the challenge of becoming a musician is that of seeing melody, harmony, intonation, progression, rhythm, phrasing, dynamics, and so on, without effort, as each moment demands.
yborisover 3 years ago
For <i>TypeScript</i> I created a visualization of function calls - a function call graph:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;whyboris&#x2F;TypeScript-Call-Graph" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;whyboris&#x2F;TypeScript-Call-Graph</a>
评论 #29982201 未加载
评论 #29982168 未加载
todd8over 3 years ago
I have been intrigued by the idea of visual coding tools for <i>many</i> years, but these kind of tools have always disappointed me. They remind me of the system used to teach small children to program in the programming language Scratch, see [Scratch].<p>I prefer to &quot;visualize&quot; my code as manipulating a set of logical assertions that characterize the state of the computation, ultimately reaching the point where the state of the computation&#x27;s properties satisfy the requirements. Somewhat like that explained in [Gries1987] and [Dijkstra1976]. Visual tools are just too coarse to capture the details necessary to ensure correctness or real-life requirements.<p>While UML diagrams sometimes help to make sense of a complex set of OO Class relationships, this is far from how I normally work with the meaning of code in my head while programming.<p>[Scratch] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Scratch_(programming_language)" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Scratch_(programming_language)</a><p>[Gries1987] <a href="https:&#x2F;&#x2F;www.amazon.com&#x2F;Science-Programming-Monographs-Computer&#x2F;dp&#x2F;0387964800" rel="nofollow">https:&#x2F;&#x2F;www.amazon.com&#x2F;Science-Programming-Monographs-Comput...</a><p>[Dijkstra1976] <a href="https:&#x2F;&#x2F;www.amazon.com&#x2F;Discipline-Programming-Edsger-W-Dijkstra&#x2F;dp&#x2F;013215871X&#x2F;ref=sr_1_4?keywords=Edsger+Dijkstra&amp;qid=1642528263&amp;s=books&amp;sr=1-4" rel="nofollow">https:&#x2F;&#x2F;www.amazon.com&#x2F;Discipline-Programming-Edsger-W-Dijks...</a>
评论 #29983580 未加载
zokierover 3 years ago
Code Bubbles (from 2010) is the most convincing code visualization tool that I can recall: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=PsPX0nElJ0k" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=PsPX0nElJ0k</a><p>Shame it never grew beyond a research prototype.
ogogmadover 3 years ago
Slightly tangential: This is how I visualise how the behaviour of the QR algorithm varies over all possible PSD matrices: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;QR_algorithm#Visualization" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;QR_algorithm#Visualization</a><p>In this case, it&#x27;s less important to understand the convoluted structure of some code, than to understand how a simple but opaque algorithm behaves in general.
mikewarotover 3 years ago
For me, Pascal is a pretty good 2d <i>map as software</i> experience. Begin&#x2F;End pairs along with indenting 2 spaces each time make it easy to understand and provide landmarks that are easy to spot. I imagine this is true for most languages.<p>The only thing better would be if I could compile it to an abstract syntax tree I could manipulate, change the name of a routine, etc... then reverse back to updated code.
kgilpinover 3 years ago
AppMap (<a href="https:&#x2F;&#x2F;appland.com&#x2F;docs&#x2F;how-to-use-appmap-diagrams.html" rel="nofollow">https:&#x2F;&#x2F;appland.com&#x2F;docs&#x2F;how-to-use-appmap-diagrams.html</a>) is an open source tool we created to record and visualize code execution. It currently includes interactive dependency graph and trace views, and works with Node.JS (+TypeScript), Ruby, Java, and Python.
RobertRobertsover 3 years ago
I found it odd that the drawing were confusing until I added my own personal imaginary time component.<p>Spacial memory include how I &quot;feel&quot; about something as much as the logic of what it is. When I misplace something I &quot;feel&quot; like I put that object (keys, book, etc...) in some place, despite it not being there.<p>So, like the idea of &quot;I remember putting my keys here&quot;, there is a timeline.<p>The images of the boxes &quot;main&quot; and &quot;counter&quot; with all the lines was confusing, but if I had drawn them myself, I would have tiny timeline&#x2F;memory of each line movement from one to another. Just the same as I recall (vaguely sometimes) why I wrote a piece of code or structured my files some way.<p>So, to change the thought from &quot;what a mess of lines between the boxes&quot; to &quot;these lines really mean something to me&quot;, I would either have to have drawn them myself, or have some time component (ie, lines drawn during actual demo of code being run) to represent &quot;how I visualize&quot; the actual logic&#x2F;code&#x2F;system.
pbiggarover 3 years ago
With Darklang we&#x27;re trying to break up the &quot;file&quot; concept of code and organize the code as you think about the architecture (think about the diagram you would draw if you were to whiteboard the architecture to a new coder on your project).<p>The first version of it isn&#x27;t great, but it is a bit different than the default:<p><a href="https:&#x2F;&#x2F;twitter.com&#x2F;tarngerine&#x2F;status&#x2F;1254276194402545664" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;tarngerine&#x2F;status&#x2F;1254276194402545664</a> <a href="https:&#x2F;&#x2F;twitter.com&#x2F;_paulshen&#x2F;status&#x2F;1321511924807331841" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;_paulshen&#x2F;status&#x2F;1321511924807331841</a><p>Here&#x27;s what we actually want it to be like though: <a href="https:&#x2F;&#x2F;twitter.com&#x2F;paulbiggar&#x2F;status&#x2F;1322221106779049984" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;paulbiggar&#x2F;status&#x2F;1322221106779049984</a>
pnathanover 3 years ago
One of my professors in grad school was really into code visualization and we dabbled through a survey of the code viz approaches back then (~10 years ago now, geez).<p>I do not visualize code. I did, once, in a way, but that faded...<p>Any serious attempt to view code in a true multimodule&#x2F;multithread&#x2F;dynamic&#x2F;static way to really _see_ the whole thing in toto takes us out of the Euclidian space we all wander in, to the _different_, tree based, non-linear space of a turing machine simulating some aspect of an extended lambda calculus (how extended? depends on your language). Code flows into and out of data, closing, suspending, and continuing, on one or more processors on one or more computers, through dizzying heights of dependencies, libraries, networks, and languages.<p>A Riemannian&#x2F;Euclidian space is simply not the model needed to break into actual code viz.
plutonormover 3 years ago
I think it&#x27;s madness that we don&#x27;t work like this. We would greatly increase productivity. Unfortunately, like most new ideas, few people see the potential.
评论 #29982411 未加载
luguover 3 years ago
In a real world program, the number of branches is too high to be nicely represented in 3 dimensions: take whatever visualization approach you like (UML, drakon, visual flow, ...) and imagine how it scale to just a modest programs.<p>I guess the constructs of the programing language has to be designed to produce a visual representation: a strict hierarchy must be imposed to hide complexity.<p>At the end of the day, the question is: why using visualization? - if this is to use visual memory, can one trick the brain with colors, fonts and background images? - if this is to have 10,000 feet pictures, can statistics answer your questions?
holografixover 3 years ago
I’m not a professional software dev so apply many grains of salt.<p>I code with pen and paper beside me, specially when doing anything that involves another thread or these days a go-routine.<p>Drawing boxes and lines to symbolise go-routines and channels.<p>The hardest thing for me about software is understanding a large code base. Often I struggle to even understand where the “entry point” is, let alone the whole thing.<p>A viz tool that would sequentially build a function&#x2F;module&#x2F;file call walkthrough the code would be awesome. Bonus points if it can limit the depth so dependencies are not traversed etc<p>Edit: posted too soon by accident.
qwertyuiop_over 3 years ago
No love for UML ? <a href="https:&#x2F;&#x2F;www.omg.org&#x2F;spec&#x2F;UML&#x2F;2.5.1&#x2F;About-UML&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.omg.org&#x2F;spec&#x2F;UML&#x2F;2.5.1&#x2F;About-UML&#x2F;</a>
评论 #29982616 未加载
评论 #29983227 未加载
评论 #29983072 未加载
erwincoumansover 3 years ago
For run-time visualization, I use Chrome about:&#x2F;&#x2F;tracing it gives very good details, over a time horizon, synchronized over multilple threads&#x2F;processes. Zoom into nanosecond detail or zoom out over seconds or minutes overview.<p>I have my own simple C++ code to generate those traces (json data), there is also an official sdk for it (Perfetto is the new shiny way)<p>For static code analysis, I use Doxygen, it parses the headers, can make high level module diagrams and fine grained dependency graphs. It uses Graphviz&#x2F;dot for rendering the graphs.
评论 #29985417 未加载
dpeduover 3 years ago
I think of code as a series of nerve cells. Nerve cells have internal logic (the nucleus) and a connection to others (the axon). Nerve cells should all generally be about the same size; one being bloated is a sign of a code smell - an area that could be refactored into smaller chunks. Real nerve cells only have one axon but, in programming, a single connection to the rest of the code base just isn&#x27;t always realistic. However, a spaghetti mess of interconnection within a codebase is a code smell too.
评论 #29983546 未加载
goblin89over 3 years ago
When I have trouble juggling a complicated system in my head, I like to visualize it as documentation.<p>Thanks to automated documentation generators it’s possible to document various units directly in the code, but it doesn’t replace tying it all together in a cohesive knowledge base, nicely formatted in HTML. (There’s tooling that helps with that, too.)<p>To me, writing and updating how-tos, references, glossaries, organizing it in sections is a methodical activity that produces useful questions and helps me understand not just the responsibilities of different units do but also general background and the larger picture, while producing a concrete deliverable useful to future maintainers and operators as a side effect.<p>Illustrations can also be useful to include. There isn’t a one-size-fits-all approach and it really depends on what you are trying to illustrate—a high-level architectural overview may warrant a data flow or component dependency diagram, while a complicated communication between threads might call for a timeline view. (Again, thinking in terms of documentation is useful—consider future readers and future maintainers, what they would want to learn and how much of a pain would it be for them to update.)<p>I believe illustrations don’t work as well on lower levels though like individual code units. If a higher level diagram is not enough and you come up with one that has to change every time implementation changes, perhaps somewhere there’s coupling that could be loosened and cohesion that could be tightened. (That, or I might not have worked on sufficiently complex projects.)
beaconstudiosover 3 years ago
his example is literally just data flow programming: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=WjJdaDXN5Vs&amp;t=924s" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=WjJdaDXN5Vs&amp;t=924s</a><p>I&#x27;ve had a project related to this on the back burner for a little bit - data flow programming is really cool and helps with understanding code logic (and can be inherently reactive, which is IMO the future of programming) but it&#x27;s hard to scale up.
m3047over 3 years ago
&gt; This made me think about how I tend to visualize code, and it’s a little hard to describe.<p>This tells me someone is good at imagining castles in the air and that they have difficulty describing their vision. I can&#x27;t even tell if the castle is stable, shimmering, changing color or shape.<p>There is an analogy to at least some forms of meditation here: the vision is a distraction to suffer through (however pleasant the suffering) to return to the practice.<p>I recommend working on the problem and being able to articulate and understand the problem. Two people could see and enumerate a castle and a bridge (and little else) and agree on this vision. Then one could propose burning it down, while the other would propose a trebuchet or breaching mine. A breaching mine would be overkill for a castle made of wood, but stone don&#x27;t burn. We don&#x27;t even know if the bridge goes over the walls or even touches them.<p>I love interesting and entertaining mythologies and applaud them, but they&#x27;re not to be conflated with The Problem. Listen carefully to the mythologies of the people you work with, and watch carefully if they&#x27;re more interested in spinning a tale or working on the problem.
TOGoSover 3 years ago
Calling code on the left, function-being-called (or rather, its stack frame) on the right. Unless it&#x27;s asynchronous message-passing stuff in which case the parts are in disconnected spaces.<p>At my previous job there was a lot of code that abused a pub-sub system to effectively do buggy temporally-coupled RPC. This didn&#x27;t fit any paradigm I knew how to visualize (it went straight into the &quot;fucking mess, don&#x27;t try to understand it unless you&#x27;re going to fix it&quot; section of my mental library) and therefore I had a very hard time understanding what was going on, or getting much done at all, for that matter. I opened some tickets with suggestions for ways we could make it make sense but management deemed that type of work lower priority than chair-warming (this was last fall during the &#x27;employees should be in the office X hours per week&#x27; period; meanwhile I was living 300 miles away) so I gtfo.
pkdpicover 3 years ago
Love this question and Im forever inspired by the way engineers visualize their code especially when actually white-boarding (in the before time...). Was hoping to see more actual visualization examples in the article &#x2F; thread.<p>If anyone knows of a site or project dedicated to cataloging whiteboard visualizations point me in the right direction.
评论 #29986207 未加载
groby_bover 3 years ago
There&#x27;s also all kinds of probabilistic visualizations, which is maybe a third axis in that diagram. (I.e. call coverage, sampling profilers, various o11y approaches)<p>Research example: <a href="http:&#x2F;&#x2F;www.ijstr.org&#x2F;final-print&#x2F;apr2020&#x2F;A-Hybrid-Weighted-Probabilistic-Based-Source-Code-Graph-Clustering-Algorithm-For-Class-Diagram-And-Sequence-Diagram-Visualization.pdf" rel="nofollow">http:&#x2F;&#x2F;www.ijstr.org&#x2F;final-print&#x2F;apr2020&#x2F;A-Hybrid-Weighted-P...</a><p>I think that will be an important field especially for software running at a large scale - because it allows to get a better understanding of large systems. It&#x27;s also a loss of fidelity that has strong implications for individual interactions.<p>(And yes, I know o11y is already a large tool there. I&#x27;m just thinking we&#x27;ve merely scratched the surface of probabilistic views)
exodustover 3 years ago
I don&#x27;t use visualisation tools but I sometimes need to write in plain English the code&#x27;s intention.<p>When my brain is in a feedback loop from the complexity, writing simple descriptions can bring calm and help me grasp the required logic. It&#x27;s usually a last resort.<p>I&#x27;m making a web game currently, as a side project for work. The complexity has snowballed because of all the timers, sequences and rapidly changing conditions. Honestly, visualization tools would get in the way and just add more complexity. Something else to maintain and update, no thanks!<p>It&#x27;s a personal thing, but something about boxes joined to other boxes with lines, is very much not how I see code or programming logic at all. I leave that to managers who use those tricks to show other managers how the tech stack is organised.
lelandbateyover 3 years ago
You can visualize the actual execution of software at a very low level using the &quot;graph views&quot; built into &quot;binary code analysis tools&quot; (decompilers&#x2F;disassemblers) like IDA Pro, Ghidra, and Radare2. Many of these tools can generate absolutely HUGE graphs showing the control flow of raw assembly, though they&#x27;re frequently so large that they&#x27;re more overwhelming than helpful. Hence why most of the time they are used to generate graphs of small and complex sub-sections of software.<p>Here are some example images showing control-flow graphs by different disassemblers&#x2F;binary code analysis tools:<p>[0] Ghidra control flow graph, relatively zoomed in: <a href="https:&#x2F;&#x2F;i.stack.imgur.com&#x2F;eYEVh.png" rel="nofollow">https:&#x2F;&#x2F;i.stack.imgur.com&#x2F;eYEVh.png</a> Taken from this stackoverflow: <a href="https:&#x2F;&#x2F;reverseengineering.stackexchange.com&#x2F;a&#x2F;20792" rel="nofollow">https:&#x2F;&#x2F;reverseengineering.stackexchange.com&#x2F;a&#x2F;20792</a><p>[1] Radare2 showing control flow graphs in ascii in the terminal: <a href="https:&#x2F;&#x2F;monosource.gitbooks.io&#x2F;radare2-explorations&#x2F;content&#x2F;intro&#x2F;visual_graphs.html" rel="nofollow">https:&#x2F;&#x2F;monosource.gitbooks.io&#x2F;radare2-explorations&#x2F;content&#x2F;...</a><p>[2] IDA Pro control flow graph, relatively large and zoomed out: <a href="https:&#x2F;&#x2F;i.stack.imgur.com&#x2F;cjZBP.png" rel="nofollow">https:&#x2F;&#x2F;i.stack.imgur.com&#x2F;cjZBP.png</a> From this stackexchange: <a href="https:&#x2F;&#x2F;reverseengineering.stackexchange.com&#x2F;q&#x2F;15847" rel="nofollow">https:&#x2F;&#x2F;reverseengineering.stackexchange.com&#x2F;q&#x2F;15847</a><p>[3] Defcon talk by Chris Domas where they demonstrated automate code generation which would cause various binary code analysis tools to generate control-flow graphs which formed specific shapes, shapes meant to offend or demoralize researchers examining the code (quite entertaining): <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=HlUe0TUHOIc" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=HlUe0TUHOIc</a>
xwdvover 3 years ago
I don’t visualize code, I <i>feel</i> it, underneath my finger tips. I’m what they call a vimmer. Right now, when I think of a location in a code base where I want to go, I can feel the nerves in my hand anticipating the movements and keystrokes I’ll need to execute in order to get there, and the subsequent commands needed to make the edits I want. There’s little reason to look at the screen if all these moves are done perfectly, the screen is only there to provide context. The physical structure and layout of a project is irrelevant when you have powerful tools. It might as well be a flat file in my mind. All that matters is the anchor points. The words to search for, the phrases to find. This is the highest level of coding.
austincheneyover 3 years ago
Here is my dumb army guy approach to programming anything. It doesn&#x27;t work for everybody.<p>1. Think about the problem.<p>2. Form a tentative plan (the visual part).<p>3. Write a rough draft of code (the code doesn&#x27;t have to work yet).<p>4. Test it and make it work (minimum viable effort).<p>5. Refactor. Polish the code and eliminate tech debt.<p>Think about the problem. Get a solid vision for what you want done. Once you have solid emotional confidence about that end state balance it against what you have. With that you know what you are missing. That stuff that is missing is the work you must perform.<p>When you think functionally everything is an input and an output depending upon context. This allows thinking about the flow control directly without worry for the composition. If you have been programming for more than a couple of days the leet code of loops and conditions are completely ignored from planning as implied tasks much like you don&#x27;t spend your time actively thinking about breathing when planning your day. Now you have a plan. Plans often fail as soon they become necessary, so the plan itself is irrelevant. What&#x27;s important is the planning, the thought exercise not the product, the thinking about what needs to be done so you know what to do.<p>Programming then becomes a conceptually visual experience. Simply the write the code you see in your mind. The most important thing here is that you have a visualized a plan and know what you need to write. The code doesn&#x27;t even have to work at this point.<p>Then write the code. Test what you have written. Fix the code so that it solves the desired problem. Only then should you actively toil with composition. When composition is saved for last it becomes an exercise in refactoring.<p>Refactoring is a form of code polish. It allows cleaning away the rough spots from the rough draft in order to achieve conformance to code style, build rules, and validation criteria. Refactoring also allows the combining of similar mechanisms which increases simplicity and reduces tech debt.
dzyanisover 3 years ago
Sorry, I don&#x27;t have time to example all pros and cons but: - UML is complicated and nobody really knows that and it&#x27;s sad; - Simple tool like Miro, Dia is the easiest way but you have to keep it updating manually; - PlantUML was fine. We used it on a PHP project but it was once and many years ago; - DOT language can be a mediator between code and visualization (graphviz) but nobody really develops it. I didn&#x27;t find a library to parse it and language is full of problems like mixing visualization with representation, decomposition and etc. Huge potential but right now even XML is better.
kraftmanover 3 years ago
A long time ago I was thinking about this and how if you could better visualise the relationships between functions&#x2F;modules, it would be clearer to see where there are issues with coupling and cohesion. I think for the most part it could look fairly clean with nice heirarchical relationships, but then the links to common utility files could get a bit messy.<p>I took a stab at implementing it in Love2d but didn&#x27;t get far before getting distracted with UI design&#x2F;development: <a href="https:&#x2F;&#x2F;i.imgur.com&#x2F;kznL4.jpg" rel="nofollow">https:&#x2F;&#x2F;i.imgur.com&#x2F;kznL4.jpg</a>
hcsover 3 years ago
Ever since I saw the cover of Elements of ML Programming [1], which shows the book as charting a course across &quot;Logos Island&quot;, I&#x27;ve wondered what a <i>programming language</i> might look like as a navigable space. Perhaps something like walking through a syntax diagram, but that hardly captures it, especially when so much of the semantics of a language is in its standard libraries. Would a program be a path through the language world? Would we think of the world as containing all possible user-defined functions, and we&#x27;d edit our way across this space?<p>For a historical metaphorical discussion of visualizing programming, I enjoy this bit from Johan Georg Raeder&#x27;s 1984 thesis &quot;Programming in Pictures&quot; pp79-80 [2]:<p>&quot;What real-world metaphors can fit programming? To get a feeling for how immense our initial search space is, let us amuse ourselves with a few possibilities. Is a program like a road with intersections and forks where we have to make decisions depending on our current errand, and with roadside inns where we can spend computation time or, if we are careless, completely overflow our stack? Or shall we abolish the &#x27;meta-view&#x27; and, instead of seeing the program from the sky, put the programmer inside the program by presenting a view of a tunnel he&#x2F;she can drive through? At each intersection one might have to throw dice or make guesses to introduce some of the challenge, fantasy and curiosity found in computer games. Perhaps we should rather present programs as physical, three-dimensional objects that we can turn around and view from different angles and in different light so as to reveal the various facets of their structure. Can we present a program as a play with actors and objects on a stage?&quot;<p>See also Raeder&#x27;s &quot;Survey of Current Graphical Programming Techniques&quot; (1985)<p>[1] <a href="https:&#x2F;&#x2F;archive.org&#x2F;details&#x2F;elementsofmlprog0000ullm" rel="nofollow">https:&#x2F;&#x2F;archive.org&#x2F;details&#x2F;elementsofmlprog0000ullm</a><p>[2] <a href="https:&#x2F;&#x2F;archive.org&#x2F;details&#x2F;RaederProgrammingInPictures&#x2F;page&#x2F;n88&#x2F;mode&#x2F;1up" rel="nofollow">https:&#x2F;&#x2F;archive.org&#x2F;details&#x2F;RaederProgrammingInPictures&#x2F;page...</a>
kokaneeover 3 years ago
Whenever someone presents a flow diagram to describe software or infrastructure, I pretty much panic. It always seems like everyone in the room immediately understands this kind of thing, but to me every box and line and arrow looks like sheer ambiguity.<p>I tend to think in bulleted lists. Programs are a series of steps, often containing substeps and branches. Infrastructure allows data (requests) to traverse a series of steps as well. Each branch of steps and substeps looks like a bulleted list in my head.
评论 #29987346 未加载
leetroutover 3 years ago
From a previous posting here in HN code2flow<p><a href="https:&#x2F;&#x2F;github.com&#x2F;scottrogowski&#x2F;code2flow" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;scottrogowski&#x2F;code2flow</a><p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29496014" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29496014</a><p>A friend of mine sent me this a while back which is kinda related<p><a href="https:&#x2F;&#x2F;splootcode.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;splootcode.io&#x2F;</a>
memlayoutover 3 years ago
Seeing code visualized was really helpful when I first learning programming. My teachers would draw block diagrams of variables&#x2F;functions on the &quot;stack&quot; and the &quot;heap&quot;. Helped me create a mental picture of what the code I was wrote was doing under the hood.<p>I created <a href="http:&#x2F;&#x2F;memlayout.com" rel="nofollow">http:&#x2F;&#x2F;memlayout.com</a>, which tries to accomplish this.<p>Curious about what people think about it.
MaulingMonkeyover 3 years ago
Profiler flamegraphs can be a wonderful tool for understanding actual execution. It turns out that execution time is a useful proxy &#x2F; reasonable approximation for code&#x27;s importance to the overall application.<p>Bonus points for using an intrusive, explicitly annotated tracing API of some sort, which lets you capture enough parameter information to understand not just where, but what, the code is doing.
c3cover 3 years ago
I&#x27;m trying to build a tool just for that. On-demand code visualization: <a href="https:&#x2F;&#x2F;sourcespy.com" rel="nofollow">https:&#x2F;&#x2F;sourcespy.com</a>
AnIdiotOnTheNetover 3 years ago
I don&#x27;t really visualize &#x27;code&#x27; so much as I visualize data structures as arrangements of rectangular blocks of memory and arrows pointing to them. I find that once I understand how the data is supposed to move and transform, the code almost seems to write itself.
rdubs333over 3 years ago
I am working on a technology illustrated design system book that might help you visualize code. I am a visual designer that learned to code. Its a free ebook on Apple - <a href="https:&#x2F;&#x2F;mtrees.io" rel="nofollow">https:&#x2F;&#x2F;mtrees.io</a>
grimgrinover 3 years ago
does anyone here write code, align with having aphantasia, and have some form of an alternative answer to thread? alt.answer might end up being the same answers, idk what i&#x27;m saying, barely know what i&#x27;m asking
评论 #29984582 未加载
secretsatanover 3 years ago
Giant mechanical machines with cogs and conveyer belts, shunting items around.
jcelerierover 3 years ago
I draw graphs of it very akin to the schemas in the article
easton_sover 3 years ago
As a series of plumbing pipes.
bartimusover 3 years ago
Everything is a tree.