Hacker News new | past | comments | ask | show | jobs | submit login

I've been wondering a lot recently if folders make projects better or worse.

For example, when I write a library its usually very simple. There's a single directory which contains all of the source files. When people use the library they:

"""

import lib

lib.run()

""""

Dead simple, no complex module paths to remember, no hierarchical folder structure forcing you to code based on a pattern rather than functionality. Pure bliss.

But on the other hand, I have projects that contain 100k lines of source code. I can't just leave it out in the cold. So poor baby gets a couple of folders.

But I do hate it. I hate writing the code. I hate reading it. I hate finding it 6 months after the fact.

That's probably just the nature of the job. It is work at the end of the day. Maybe its just doomed to be hard.




I'm not plugging the language, but I've come to appreciate OCaml's module system with no imports and (mostly) globally unique module names. No circular dependencies allowed either. You can have multiple modules within a file (which is also a module named after the file name).

I structure larger projects as libraries with minimal dependencies that depend on one another, and dump all my modules with descriptive file names under the same directory within the library.

I vaguely remember reading something that hinted at Facebook doing something similar with their React components.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: