Ask HN: Do senior engineers have a mental model before coding?
TL;DR: different people have different programming styles and you might not be programming the way they expect you to; but that might not be the problem. The problem might be that you&#x27;re focusing on the part of the interview that the interviewer doesn&#x27;t care about and that makes it so that the interviewer gets frustrated and doesn&#x27;t see your skill.<p>--<p>When I was younger, I got a chance to work on a game with a friend of mine. My friend was an incredibly skilled programmer, probably one of the best programmers who built things people used or could use, that I knew at the time.<p>I was a competition programmer.<p>We were both learning HTML5 at the time, and we both took on the task in very different ways. I believe we were writing Nibbles (Snake) or something like it, as a learning exercise, each.<p>I learned the basics: arrays, function creation, etc, and then went really fast at building the whole program without testing it, connecting all the pieces together in ways that I assumed would work. In the programming competitions I took part in, 3 people shared one computer, all doing different problems at the same time, so most of us wrote our code on paper before we put it in to the computer.<p>After my whole code for snake was written or at least as much as I wanted to have for a prototype (it&#x27;s been many years since we did this, so I don&#x27;t remember a lot), I started trying to run it. It didn&#x27;t work, of course, or did messy things, and so I spent a bunch of time going through and fixing the bugs that were in my code.<p>My friend went a completely different approach. Of course I don&#x27;t remember specifics, but it was something like this:<p>* he got a pixel drawing in a canvas<p>* he got a pixel moving on the canvas<p>* he got apples appearing on a canvas<p>* he got a chain of pieces of the snake following<p>* he got collision working<p>Of course, this is probably not what actually happened; but, this is basically what I remember about how he coded. He was very slow, methodical, and had a step-by-step process of how the whole code would work.<p>In the end, I think he had his program working before I did and much better; but, if you looked at just the start, you might assume he&#x27;s not skilled.<p>--<p>Let&#x27;s fast forward to today and a different person.<p>I was talking directly to a senior engineer at my company the other day. Very skilled, very, very skilled. We were talking about how we do things. It came out that I design systems and draw pictures to get flow and layout down. I like to work on weird, pie-in-the-sky, robust systems that tend to take a drawing to figure out later, because they&#x27;re powerful and do powerful things; and, the goal of those systems tend to be to pre-emptively be ready for v-next and handle all of the requirements as cleanly as possible, and future requirements as cleanly as possible.<p>He greatly prefers to start hacking on a solution quickly and get something building and then work in the nuance and ugly later, refactoring whole sections over time to get a better and better solution.<p>When I remark on a dangerous test case or scenario area that I&#x27;m worried about when it comes to the upcoming solution, he&#x27;s always thought of that problem area ahead of time, too; but, from what he tells me about how he works, he starts hacking basically right away; and, I don&#x27;t think he does the crazy designs as his first version, either.<p>--<p>I&#x27;m not sure where I&#x27;m going with this; but, I think I want to say that this:<p>&gt;  I ran node in console after small changes and additions to print, test, debug.<p>is not a sufficient reason to think you&#x27;re not senior; but, this:<p>&gt; I didn’t have a mental model of the subtask<p>might be. Please notice that I reduced what I said down to a very, very narrow statement. If you eventually have a mental model, then I think you&#x27;re fine here.<p>--<p>I&#x27;m going to add some more. This might be an interviewing problem, and I think it may be important to get a feel for what sort of interview it is, even asking them. If you&#x27;re adding a bit, printing, testing, adding a bit, printing, testing, you might be adding a bit to things that your testing partner doesn&#x27;t think matters. Did the interviewer expect the code to compile and run proper tests? Or were they just trying to understand your thinking process? If the interview only cares about your thinking process, then they probably don&#x27;t care if you don&#x27;t write the code to get the substring you need exactly right, or they might not care if you get rounding wrong, or output formatting wrong, because that&#x27;s not the part of the problem you&#x27;re being asked to solve.<p>You get better at this by interviewing more and practicing asking questions.<p>--<p>You mention this:<p>&gt; The feedback was you can’t do this when compiling time is long and development will be slow<p>While this is true, for most of the work I do, I could write a small program on the side that tests the design I&#x27;m going for that compiles quickly and then inject that code into the larger code base and test the rigging. Maybe that&#x27;s not how it is for the job you&#x27;re looking at.<p>I&#x27;ve said a lot, I hope this helps.