How do you navigate your code?


#1

I have wondered this for a long time, but been afraid to ask. Because it marks me out for what I am - an extremely amateurish coder! But I have to know. Once a file exceeds, say, 1000 lines, how do you find your way around???

I can’t survive without Fold-Navigator. It’s why I use Atom. But I notice that very few others use it: do you use some better package?

Or do you structure your code so well that you never get lost, even in a gigantic file?

Or do you only ever work on isolated segments of a file?

What’s your secret?


#2

I believe people use find and replace to go to specific sections. For example, you might know a function definition begins with function myFunction, so you would search for this in the find tool.

Alternatively, some people may use a minimap to jump places. But I think the general opinion is that the jumping around you do trying to get to the right location is quite wasteful and distracting.

If are trying to go to a variable or function definition, you could also see if there is a hyperclick package for your language. For example, I use js-hyperclick to go to these definitions, even when they are in different files.

Split panes can be used, even on the same file. If you’re reading one function, and it calls another, you can use this to look at the other function while seeing it being used in context and not losing your place.

Finally, Atom has bookmark support. I don’t use it, but it’s there. There are also community packages that make bookmarks better, if that’s what you want to use.


#3

symbols-tree-nav is useful for getting between sections of your code.


#4

Thanks for the insights. On reflection I think my real problem is that I am creating a very ambitious project but often go many months between writing a single line. So for me, just getting a feel for “what the hell is going on??” is crucial. it sounds like a more serious programmer would not have these big gaps, so the bigger problem would be more manageable, like “what exactly does this particular function do again?”

Thanks again.


#5

For a programmer of any level of seriousness or experience, good note-taking is essential. If you provide yourself with detailed documentation about your thoughts, then you don’t have to invent them a second time.