Ask HN: Programming Without Files and Folders

2 points by valty ↗ HN
I hate having to organize code. It's annoying to move functions into their own files and then decide on a hierarchy to group them in folders.

What are my options?

6 comments

[ 3.1 ms ] story [ 28.8 ms ] thread
You can put it all in one big file that will ensure no one contributes or tries to maintain the code.

I think your best option is not to swim against the current. The vast majority of developers organize code in files and folders because people can easily understand hierarchies. Developer tools (IDEs and editors) have good search and fuzzy find built-in so you don't have to click through folder hierarchies to find a file, or find where a function gets defined.

Guess I have to write a new IDE :D
Use Lisp or Smalltalk?

They have an "image" which contains everything (including the system-provided libraries), in a single file, and rely on the development environment to navigate to classes,functions, etc.

I'm trying to think of a middle-ground. Plain text and files are really great in so many ways. I think _folder hierarchies_ are the problem.

Maybe a virtual file-system...

With VS Code fuzzy filename search (CTRL-P) and project-wide text search (CTRL-SHIFT-F) you could probably get away with dumping all your files into a single directory. I find myself using these tools to navigate my projects more than the folder tree.

However, it makes sense to have things like web site routes match your FS structure...

Vite has this concept of path aliases[1]. So you can give a folder an alias like `$data`. If you want to change that folder's location in the hierarchy later, it's just a matter of moving the folder and updating the alias. So you could start with all your folders in the project root and worry about the folder structure later.

[1]: https://dev.to/tilly/aliasing-in-vite-w-typescript-1lfo

Using, eg. C, it's fairly simple to have minimal structure: you can have every .h and .c file in the top-level project directory if you want (and that used to be common in the 80s). Now, you'd normally have at least a "src", and maybe a separate "include" hierarchy, and maybe split things up further for different modules.

Java, OTOH, enforces a lot of directory structure. It's a bit of a nightmare to use without an IDE or a fuzzy-find for that reason.

A fuzzy-find system could be more-or-less viewed as a virtual filesystem?