Comment by hliyan
1 year ago
When you have a good mental model of the code base you're working on (and the libraries you use), you don't really need a lot of IDE features, and IDE features can sometimes hamper the formation of such a model. Let me explain:
Twenty years ago, my IDE was two terminal windows running VI, vertically tiled. On the left, I open header files, and on the right, source files (I was a C++ programmer). When I wanted to look up method signatures or member names, I would quickly look it up from the relevant header file. This could take anywhere between 5-60 seconds.
If you remind me that IDE features could improve this by a factor of 10x, you're absolutely right. But if we apply Amdhal's law to developers, their biggest time waste is often not the physical act of coding, but fixing logical and structural issues in their programs. And the best way to prevent such high level issues is for the programmer to have a good mental model of the code base.
So, the possession of a good mental model of your code base obviates the necessity (but not the convenience) of IDE features such as autocomplete/intellisense. But at the same time, reliance on such features hampers the formation of a good mental model.
My current compromise is to rely more on the "Go to definition" function than auto-complete.
I’m not a developer but someone who is curious about development, can you explain what it means to have a good “mental model of the code”. Does that mean where you understand all code and what it does?
That's at the deepest level. I'd say you can stop one level up: knowing which function serve which purpose, which functions call which functions, which objects maintain which state etc. If you can trace any input/request from the event handler all the way to the database and back, then that's a very good start.
Yeah I think that's correct. It's the combined effect of being able to read the syntax of whatever language it is (Ie understanding code at a small-scale, which is different for all langs), and also to be able to understand/imagine the overall behaviour of it: at a larger-scale, which I think is largely language-independent. I think of it as similar to imagining how to do something or imagine how something works. The analogy could range from as simple as 'how to make a cup of tea' (a small script, or single method say) all the way up to 'how a car engine works'-level like big codebases (kernel, llvm, code-for-whole-app kinda thing).