4 ms·
It's not logical, but it should be possible to do something trivial in a package. What's the alternative? Allow only packages with code over 100 lines? 1000 li
by gitgud 8y ago
It's not logical, but it should be possible to do something trivial in a package.
What's the alternative? Allow only packages with code over 100 lines? 1000 lines?
Packages are an excellent way to share code, regardless of complexity...
- krapp 8y ago>What's the alternative? Allow only packages with code over 100 lines? 1000 lines? The alternative is allowing packages with more than a single function. It's NPM and the javascript development culture which is enforcing the arbitrary limit of "no more than a single function per package." Sure, you can do trivial things in a package, but that calls into question the usefulness of enforcing that level of granularity versus having libraries of related functions, shallower dependency trees and less fragility.
- gitgud 8y agoWhat about libraries like npm packages like Lodash which contain a collection of small helper functions right? You might have to import everything from the package though... I suppose it's similar to the Unix philosophy, "do one thing and do it well". Also don't forget that people can repackage these fine grained tools into a single library package too.
- krapp 8y agoThat's fine. But the cultural acceptance of single-function libraries is still a problem. Before NPM, it wasn't even an issue - plenty of javascript libraries and jQuery plugins were being distributed that way. Why does a function to check if a number is even need its own namespace, and a dependency on another namespace which tests if it's a number at all, and a third to check if it's odd? What's the benefit to this? >I suppose it's similar to the Unix philosophy, "do one thing and do it well" Any philosophy can be taken too far.
- gitgud 8y ago> Why does a function to check if a number is even need its own namespace, and a dependency on another namespace which tests if it's a number at all, and a third to check if it's odd? What's the benefit to this? The benefit is modularity, separation of concerns and versioning but in this case it's ridiculous... Any philosophy can be taken too far That should be printed on my office wall!