DEV Community

Code navigability?

stereobooster on March 08, 2020

What is navigability? I made up this word in the same manner as read-ability. If readability β€œis the ease with which a reader can unders...
Collapse
 
jonrandy profile image
Jon Randy πŸŽ–οΈ

The word already exists - Navigability

Collapse
 
stereobooster profile image
stereobooster

Yes, I saw this word. But according to oxford dictionary navigability - ​the degree to which a river, lake, etc. is wide enough for ships and boats to sail on. I wasn't sure if I can reuse it here

Collapse
 
jonrandy profile image
Jon Randy πŸŽ–οΈ

Yes, in that usage, it is the degree to which a river etc. can be navigated - i.e. how easy it is for the ships captain to navigate their way through. It's exactly the word you need - but you're using it in the sense of how easy some code is to navigate by someone who is reading it

Collapse
 
sargalias profile image
Spyros Argalias

My favourite solution is to have component based folders if possible.

Foo/
Foo.js
Foo.scss
Foo.test.js

I've worked on codebases where file "type" organisation is used. It's also fine, but since related files are scattered in multiple places it just takes a bit longer to find them, create them, and also make sure you've done all necessary changes each time.

For searching, I just use the IDE to search by filename.

Collapse
 
yuanhao profile image
YuanHao Chiang • Edited

+1

We also recently started putting all files in one folder, especially JS and CSS files. We started off with a different folder for all of the CSS. Finding the right CSS file is particulartly tedious.

Collapse
 
niorad profile image
Antonio Radovcic

There is the bookmark functionality in most editors, where you can keep important positions in files. I do this while working on a certain feature and remove them when I’m done. I like to have long files rather than lots of files, and this makes jumping around easier.

Collapse
 
emptyother profile image
emptyother

I prefer more files over longer files. Its easier to merge. The syntax colorizer and other editor tools (and partial builds) are faster. And its faster to reason about as a whole.

But cant avoid the large files, so one thing ive always wanted in editors are the ability to drag a single block of code into its own virtual editor. A kinda focus mode. No accidentally scrolling away. And a search that only find text within that block of code.

Collapse
 
louy2 profile image
Yufan Lou

But cant avoid the large files, so one thing ive always wanted in editors are the ability to drag a single block of code into its own virtual editor. A kinda focus mode. And a search that only find text within that block of code.

Emacs narrowing welcomes you.

Collapse
 
stereobooster profile image
stereobooster

I prefer more files over longer files. Its easier to merge. The syntax colorizer and other editor tools (and partial builds) are faster.

This seems like tool issue. There are editors which can be really fast (something native instead of electron based). There are projects like tree sitter which can help here.

Bigger number of file require context switch when jumping between files while reading files.

A kinda focus mode

Nice idea)

Thread Thread
 
niorad profile image
Antonio Radovcic

I didn't even thing about the colorizer since I'm using a B/W color-scheme. But yes, usually it's not a problem even with VSCode. Only when opening compiled/minified files by accident.

Collapse
 
stereobooster profile image
stereobooster

Indeed bookmarks is one more navigation pattern known since printed media

Collapse
 
louy2 profile image
Yufan Lou

I'd love to see data flow or call graph visualization showing the composition of an endpoint in one swoop.

Haskell has Hoogle which finds functions by signatures.