4 ms·
It's not. Not to that degree. Unix frequently espouses "do one thing", but how much "one thing" is is always open to interpretation. And it's never been quit
by faho 8y ago
It's not.
Not to that degree.
Unix frequently espouses "do one thing", but how much "one thing" is is always open to interpretation.
And it's never been quite as small as e.g. left-pad. It's more something like `printf` or `cat`, which do "print a formatted string" and "concatenate files" as their "one thing", respectively.
Let me reiterate: The problem isn't "single responsibility", the problem is "single responsibility for half a thing".
The pieces are just too tiny, which leads to an explosion of packages, which leads to packages being badly maintained.
- gkya 8y agoAdd to that the fact that while the Unix way works well for connecting certain types of programs through pipelines and/or shell scripts, those programs themselves are written usually in C or Perl, Python &c, which are languages that have big standard libraries. It might be reasonable to assume that while programs that conform to Unix philosophy may constitute useful building blocks for end user or sysadmin tasks, more complex programs, even those "building blocks" themselves are better off with languages that provide them with a rather large, well-though-out toolset that's built as an integrated whole, i.e. a standart library.
- AgentME 8y ago`cat` without any options support is possibly simpler than left-pad. I think the big difference is that very few people set their systems to trust and receive updates of `cat` directly from the developers of `cat` (and same for all the other standard tiny utilities). Instead, they rely on a Linux distribution to vet the developers' code and to regularly pull in updates. Maybe there's room for a similar model of distributions vetting code in the npm ecosystem.
- bmurphy1976 8y agoDo you really think cat is as simple as left-pad? https://github.com/freebsd/freebsd/blob/master/bin/cat/cat.c https://github.com/freebsd/freebsd/blob/master/bin/cat/cat.c Also, cat is kind of an important primitive for building a functional system that uses files as one of its core abstractions. It makes total sense that it would (a) exist and (b) be well maintained by an authoritative and reliable source. Left pad it is not.
- marshray 8y ago> `cat` without any options Interestingly, the `raw_cat()` function is 37 lines long. https://github.com/freebsd/freebsd/blob/e511976db9f51bae1a5986e1f1d7653d8f31fbae/bin/cat/cat.c#L299 https://github.com/freebsd/freebsd/blob/e511976db9f51bae1a59...
- kps 8y agoUNIX `cat`, unchanged from V2 through V6 until it was rewritten in V7, was 44 instructions.
- slavik81 8y agoThe core utilities are provided as a suite. The cat utility is one of a hundred others, all packaged together. Even without distributions, you'd only need to vet one organization for those basic utilities.