TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How to learn to create/draw mental models for programming?

86 点作者 neogenix将近 5 年前
I've been programming all my life and creating drawings/diagrams of anything comes very natural to me. While this happens all the time in my head, I still grab a pen and paper sometimes when the mental overhead becomes too much. Currently, I'm struggling with a junior colleague. He comes from a different background (sales). Adjusting existing code, fixing and improving features is not a problem for him, but as soon as something becomes more complex he struggles a lot - even simply drawing it on a paper completely blocks him. I'm looking for advice or resources that can help him improve this skill.

18 条评论

codingdave将近 5 年前
First, I&#x27;d stop trying to make him draw - not everyone draws out their systems to think them through. I&#x27;d ask him to think about the most complex process he had in his prior role, and teach it to you - pay attention to how he is teaching it. Is he drawing it? Talking about it? Writing it down in a flowchart? With bullet points?<p>Next, ask him to add a new piece of work into that process, and see how he approaches it.<p>Finally, whatever he does, use the techniques he used to describe his old work to help him envision your code.<p>It is far easier to adapt pre-existing ways of thinking and working to a new topic than to ask someone to tear down years of habits and rebuild from scratch.
评论 #23599543 未加载
评论 #23599323 未加载
评论 #23599050 未加载
评论 #23599057 未加载
jakevoytko将近 5 年前
Your junior colleague is trying to solve a few problems at once. This is overwhelming them, and likely frustrating them. They&#x27;re trying to simultaneously solve, &quot;Why do I need to represent data visually?&quot;, &quot;What data am I trying to present?&quot;, &quot;How can I represent this visually?&quot;, &quot;How do I map these things in code to this thing on paper?&quot; without understanding any pre-existing solutions to these questions.<p>In comparison, you have a mapping from &quot;I have a problem&quot; to &quot;this type of diagram will help me solve it.&quot;<p>At my first job out of college, my boss was obsessed with diagrams. He made sure that every person on the project could reproduce the system diagram. This means that I was personally given multiple years of instruction on how to visually represent data by someone who was very patiently correcting me. Are you willing to give someone that type of attention?<p>If you want them to learn the skill in a useful time horizon, and they&#x27;re willing to improve, you&#x27;re going to have to practice with them. Pick a thing they know well. Walk through an explanation of the system with them as you diagram it. Then have them draw the system while explaining it and having access to your diagram. Then have them reproduce the diagram without looking at it. This is the beginning - you&#x27;ll need to do this a lot before they start to internalize a thing you&#x27;ve practiced for years. Over time, you&#x27;ll realize that you can leave out some of these steps, and over time, they&#x27;ll have enough bootstrapping that they can produce novel types of diagrams themselves.
rathereasy将近 5 年前
Many of my former students had wildly inaccurate mental models so I built a platform that focuses on addressing that particular issue: <a href="https:&#x2F;&#x2F;wakata.io" rel="nofollow">https:&#x2F;&#x2F;wakata.io</a><p>It teaches JavaScript, but most mainstream programming languages have the same semantics. It&#x27;s particularly challenging because building a good mental model of programming takes a lot of time and effort.
评论 #23601291 未加载
alfonsodev将近 5 年前
I came across @mappletons[1] profile, she is behind the illustrations of egghead.io and has a blog and newsletter about visual metaphors for explaining tech concepts, highly recommended.<p>[1] <a href="https:&#x2F;&#x2F;twitter.com&#x2F;Mappletons" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;Mappletons</a>
sagunsh将近 5 年前
When I was a junior, I had similar problems. I can think of ideas, even solve problems and fix bug but when it comes to building something bigger, I was afraid. My problem the entire time was if soemthing goes horribly wrong. What if the data we are collecting is not stored? What if the code I am pushing is not properly documented? For me it was the fear of making mistake.<p>In case of simple bug fixes and minor feature addition, my supervisor would be checking everything so I didn&#x27;t have to worry. For builidng something bigger, no one would be checking everything line by line. I was own my own and afraid to push my code. My team helped me overcome that fear by showing it&#x27;s okat to make mistakes and nothing happens if you do that. Make mistake, test code, fix bug... it is an iterative process and nothing to worry.
tobr将近 5 年前
Diagrams of system architecture usually mystify me. A common issue is that it’s unclear what the various boxes and lines and arrows represent.<p>Consider that it might be that your way of drawing diagrams only make sense to you; unless you are able to state clearly what a diagram illustrates, you might just be confusing your colleague by using drawings.
评论 #23607803 未加载
nurettin将近 5 年前
I have experience teaching complex software to uninterested field personnel, so allow me.<p>Draw a state machine, send it a few events, let him follow it with his finger. For a state machine, all he needs to do is to keep the last state in his head.<p>There is a rare case that this doesn&#x27;t work. But that is not your fault.
yboris将近 5 年前
I&#x27;ve been surprised there isn&#x27;t more of &quot;Call graph&quot; automatic generation for code. I would have thought having a visual representation of which functions call which functions can <i>in some cases</i> help tremendously.<p>I started working on <i>TypeScript Call Graph</i> to see if it&#x27;s useful -- an experiment of sorts [1]<p>Could anyone chime in about call graphs and whether they are useful?<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;whyboris&#x2F;TypeScript-Call-Graph&#x2F;pull&#x2F;1" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;whyboris&#x2F;TypeScript-Call-Graph&#x2F;pull&#x2F;1</a>
评论 #23603623 未加载
bryanrasmussen将近 5 年前
Are you sure it is just because he is junior (I mean that may very well be the thing but maybe not?) in my case I am not a visual thinker, in high school they tested my understanding of visual relations and I was in the lowest 3% of the population, understanding of written text I was in the highest percentile of the population (since then I believe visual has improved and textual degraded by all the stupid things I&#x27;ve done)<p>At any rate I have always struggled to draw or diagram a solution to a problem. I like to write out a paragraph describing it.
评论 #23603796 未加载
xtiansimon将近 5 年前
Unless you&#x27;re following a regimented and formalized diagram paradigm, drawing is no different than writing. You have to be comfortable with failure and starting over.<p>I love drawing, but also struggle to make my diagrams relevant and useful in tech applications (software).<p>On the other hand, diagrams in software have a long and rich tradition. One of the topics I discovered which was fascinating and highly informative was a course on Business Process Management from TU Delft on Edx (though I can&#x27;t seem to find it now).<p>I was amazed to discover business concepts diagramed and executable! How&#x27;s that for formalized.<p>Besides that, it might just be a case of visual literacy. Katy Borner of Indiana University [3] had a great MOOC, Information Visualization at Edx (though, again, it&#x27;s not available now).<p>[1]: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Business_process_management" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Business_process_management</a><p>[2]: <a href="http:&#x2F;&#x2F;ebooks.iospress.nl&#x2F;book&#x2F;challenging-the-chain-governing-the-automated-exchange-and-processing-of-business-information" rel="nofollow">http:&#x2F;&#x2F;ebooks.iospress.nl&#x2F;book&#x2F;challenging-the-chain-governi...</a><p>[3]: <a href="https:&#x2F;&#x2F;info.sice.indiana.edu&#x2F;~katy&#x2F;" rel="nofollow">https:&#x2F;&#x2F;info.sice.indiana.edu&#x2F;~katy&#x2F;</a>
gentryb将近 5 年前
I&#x27;ve personally found that sometimes using a tool like PlantUML[1] or others (lot DOT graphs) to sometimes be easier to create visualizations with. It seems to allow me to focus more on various pieces as the big picture is built. It also seems to provide a great way of ensuring various parties thinking is similar. There are many more diagram types than many realize.<p>[1]: <a href="https:&#x2F;&#x2F;plantuml.com" rel="nofollow">https:&#x2F;&#x2F;plantuml.com</a>
jcutrell将近 5 年前
Think of your experience and context as “ground floor.” You have a lot of it, which makes your starting point much higher than your colleague’s. Some things you are likely naturally taking for granted, he may have no context for. You can’t fake “taking for granted.”<p>Your goal should not be to help him do something that is hard. It should be to understand how to make it easy.<p>So, perhaps guide him towards the path of least resistance. He is likely not wanting to draw the wrong thing either; tell him to treat the first version as a draft and make him promise he will throw this one away.<p>Maybe draw something out for him and be willing to make mistakes in front of him, so he doesn’t feel self conscious about getting it perfect on the first shot.<p>Lower the stakes, focus on smaller problems, and find a shared vulnerability.
gitgud将近 5 年前
When I&#x27;ve taught friends to code I start with a program flow chart to describe the logic of the program.<p>Then when things get bigger than a single file&#x2F;class I introduce the dependency diagram, which helps figure out which components depend on what... This helps you separate concerns logically<p>Some good tools which help:<p>- <a href="https:&#x2F;&#x2F;code2flow.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;code2flow.com&#x2F;</a><p>- <a href="https:&#x2F;&#x2F;draw.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;draw.io&#x2F;</a>
karmakaze将近 5 年前
I used to always make pictures and I still do make a fair amount but it tends to be higher-level system or data&#x2F;process flows.<p>When it comes to getting a handle on complexity, I find it better to list all the dimensions of variability and decide how they relate. Any before-and-after (but not necessarily during) invariants are gold. Then I can choose where&#x2F;when to deal with which dimension(s) while other parts are agnostic to those.
kd5bjo将近 5 年前
For myself, a quick debriefing after something doesn’t turn out the way I’d liked seems to speed the process of learning from experience. It’s basically just taking a moment to answer a few questions:<p>- What did you set out to do?<p>- What actually happened?<p>- Knowing what you do now, what would you have done differently?<p>- How does that generalize to a wider class of situations?
thenonameguy将近 5 年前
<a href="https:&#x2F;&#x2F;c4model.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;c4model.com&#x2F;</a>
评论 #23599134 未加载
评论 #23599054 未加载
serverQuestion将近 5 年前
When starting to program so much abstractions take place. So explaining code paths step by step really helps. Plus writing it out, makes it easier to tackle it step by step. Then taking this flow and explaining it to my senior give me great points to ask questions.
ltr_将近 5 年前
generally a person that does not do programming have less friction with the topic if you approach him with a functional style. for example, try to get a proof of concept or a big picture of the problem in excel and build up from there. it does not have to be something complex, replace services and databases with simple rows.<p>As a programmer also I recommend to learn category theory, which is known for its diagrams (drawing!), its hard for a while, but when you get to adjunctions I found it makes easy to navigate any problem and as a consequence, you can explain&#x2F;reason about it better.