3 ms·
Eh the insanely small size of individual modules (6 lines, I've seen!) creating huge nested node_modules is it's own type of hell. Seems like some programmers l
by MichaelGG 12y ago
Eh the insanely small size of individual modules (6 lines, I've seen!) creating huge nested node_modules is it's own type of hell. Seems like some programmers love ceremony and boilerplate, no matter the language.
- woah 12y agoWhat's the boilerplate involved with nested node_modules? Theoretically, it's a waste of hard drive space, but that's rarely a concern.
- iends 12y agoAre you also loading multiple versions of the same library in memory, or multiple versions with only a small minor version difference? There are also legacy windows bugs that make long file names not work when you have a bunch of nested node_modules folders.
- MichaelGG 12y agoJust the tend to take a simple function, then ship it as a package. There's overhead in having a manifest, a folder, a separate code file, tests maybe, readme.md, etc. (Or in some cases, an meme-related animated gif that's referenced in the readme, that's larger than the rest of the package combined. Neato!) It's obviously dumb from a technical perspective to break out individual functions (or even 20-100 line code files) into separate modules. But I think some folks really enjoy it. Just like the Java or C# folks that put every single type definition into its own file. So you get some lame IHasFoo with a single bool property - so really 1 or 2 lines of actual code. Along with comments and a file header etc. Same for groups of enums, etc.
- TheAceOfHearts 12y agoWhy not make lots of simple single-purpose modules? My policy is that if I find myself doing something over three times and it's easily isolated and contained, I'll make it into a module. Then I can write a few tests for that code, I know it'll always work, and I won't have to think about it again. Even if it's something that's not hard, you don't want to stop focusing on your main task to implement some helper that you've already done before. There's also a really strong argument when it comes to browser support: supporting and testing lots of things on old browsers is hard. But if you break stuff out into small modules you can test it easily in isolation and know it works in all your test browsers.