Hacker News new | ask | show | jobs
by josephg 1774 days ago
Yes this. With I often think about questions like:

- Is this code useful in other contexts? Are there other contexts where I might want this? (Or someone else might want this?)

- Modules have a clear API boundary

- Modules can be described independently of the code which uses them

- Modules can (and should) have their own testing suite, independent of the test suite of the containing module

There's lots of examples; but you can kind of spot code like this in your projects. It has a property of being disentangled. "This just solves this one specific problem I have with strings / event emitters / random numbers / my database, separate from anything else I'm trying to do". "I kinda want to just document this code separate from the documentation of everything else". "I don't want to pull that whole library in, but can I just steal these 3 functions for this other project?"