69 points · by dustinmoris · 4y ago · 32 comments
I work in a very iterative fashion, my favorite language is Ruby, which allows me to work as iteratively as my heart desires. Write one line of code, execute it, make sure it's doing exactly what I want it to be doing, then write another line of code.
In order for an iterative coding workflow to be fun, I can't be jumping all over the place, one line at a time only please. But golang refuses to make that fun for me. I can turn the linter off, but the compiler is constantly, noisily, judging me, and the core golang team absolutely refuses to let me turn inconsequential errors off.
So I'm constantly having to jump around the file to make the compiler happy with it's incessant complaints. I'm not using this variable, I don't have any new variables declared, so I gotta remove the ':' until it's time to add it back. Shut the heck up compiler! These are linting concerns!
I wish desperately for language makers to start caring about workflow. It always seems to never even bother rating any kind of concern at all. I wish I could just stop using languages that don't respect coders.
The Unix philosophy is fine for tiny systems, but absolutely terrible for building any nontrivial system, because it causes the complexity of the system to grow super-linearly with the number of features - O(n^2), in big-O notation, where n is the intrinsic complexity of the application (roughly, the features you want) and the big-O measures the total complexity of the application.
Why? Super quick breakdown: code has to be broken up into modules in order to prevent human brains from exploding, if the modules are too small then inter-module communication complexity dominates (because you then need a large number of modules to implement your features), if the modules are too large than intra-module implementation complexity dominates, and the Unix philosophy requires erring on the size of too-small modules.
For empirical evidence: none of the non-trivial applications you use daily (bash, firefox, chrome, windows, linux, macos, blender, krita, gcc, cargo, llvm, npm, node, vim, emacs, vscode, sublime - whatever you want) are composed of a collection of Unix utilities, or the equivalent (flat program hierarchy consisting of thousands of call sites to hundreds of tiny functions).
The evidence is very clear: the Unix philosophy does not work for anything but small systems.
A "text editor" in the Unix tradition edits text, nothing more - something like nano or pico, composed with other utilities for things like regexp matching (using grep externally) and shelling out to tmux or the X window manager for multi-window and tabs/split support. It certainly does not contain its own embedded scripting language.
Firefox is also definitely not a "does that one thing and does it well" tool - it's incredibly complex, at over 21 million lines of code, and contains its own cryptography, web rendering engine, PDF reader, developer console with its own IDE, remote development tools, tab system, UI toolkit, JS runtime, JS API implementation, and plugin API. It used to even be able to interact with FTP servers - and all this in a single, monolithic tool.
Firefox is exactly the opposite of the Unix philosophy is almost every way imaginable. Saying that it "does one thing and does it well" is about as true as saying that the Boost C++ libraries or the Windows OS "do one thing and do it well" - it's only true if you define that "one thing" to encapsulate all of the stuff that the tool happens to do, which is not the way that the Unix philosophy uses it.
I always found the SRP too vague to be useful for actual decision making, it seems to just lead to arguments where everybody (and nobody) is correct. "Unix philosophy" sounds like it is just about as vague, or am I just really missing something that everyone else gets?
"SRP mandates that you separate the rendering and business logic of the component. As a developer, having these living in different places leads to an administrative chore of chaining identical fields together. The greater risk is that this may be a premature optimisation preventing a more natural separation of concerns emerging as the codebase grows, and as components emerge that “do one thing well” and that are better suited to the domain model of the problem space."
Can't you justify anything that way? You called easily say that the rendering engine, JavaScript engine, etc should all be split up into programs that do that well.
I've built large platforms out of small, simple components. Works just fine.
The text editor I use daily is composed of small, simple components. Both internally, and by separating out many things most editors do internally: File selection, theme selection, and others is delegated to rofi, for example. Splitting into frames is delegated to my tiling wm. Separating this functionality out changes where the boundaries are, and how to reuse them, not the existence of them.
That logic that you stated is invalid; you strawmanned my argument.
My actual argument was that "none of the non-trivial applications you use daily (...) are composed of a collection of Unix utilities, or the equivalent", which still holds.
I guess that I could have added the qualifier "popular" to be more precise, but it's still roughly correct. Certainly, there does not exist a popular, featureful tool that is composed entirely out of Unix utilities or the equivalent.
> The text editor I use daily is composed of small, simple components.
Which, I notice, you didn't name. Why is that? Perhaps because it's not very popular, or because it's not a non-trivial piece of software?
The point stands - large systems aren't built using the Unix philosophy - or, none that are popular (I'm sure there exist large systems made using Unix tools, but no one uses them, because they're brittle and slow).
You made a logical leap to this:
> the Unix philosophy does not work for anything but small systems.
Which does not follow from the argument you made.
> I guess that I could have added the qualifier "popular" to be more precise, but it's still roughly correct. Certainly, there does not exist a popular, featureful tool that is composed entirely out of Unix utilities or the equivalent.
That is not relevant to the claim you made. You're now massively moving goalposts. Nothing in your original comment supports the notion that popularity was in anyway relevant to your argument, which in effect was largely implying that doing a single thing means doing a small, trivial thing. The fact that you're suggesting that a criteria would be that such a tool need be composed entirely of "Unix utilities or the equivalent" suggests you miss the point of arguing for such tools. Part of the point is to have composable, reusable tools, not to reject using additional code when building something else, but to avoid having to write the common parts over and over.
> Which, I notice, you didn't name. Why is that? Perhaps because it's not very popular, or because it's not a non-trivial piece of software?
I didn't name it because it doesn't have a name. It's my personal editor. I was able to put it together as easily as I did exactly because applying the Unix philosophy meant I did not have to write an editor from scratch, but could avoid writing large chunks of what people usually write, and instead write just the bits that are custom to how I want things to work This is a central part of the Unix philosophy: That providing reusable tools allows you to build on them without reinventing the basics. This goes to the point above that the Unix philosophy is not about avoiding custom code, but about avoiding custom code to do things that can be done with existing tools, and to maximise the ability to reuse tools it helps when your tools have a focus and provide a reasonable complete feature set.
The point is not for the tools to be small, but for them to be cohesive whichever size that requires.
Popularity is irrelevant to the claim I responded to. That you're now making an entirely different argument does not change that.
> The point stands - large systems aren't built using the Unix philosophy - or, none that are popular (I'm sure there exist large systems made using Unix tools, but no one uses them, because they're brittle and slow).
Here you are stating two entirely different arguments that are not remotely comparable.
A whole lot of large distributed systems are built using the Unix philosophy. I've built and worked on many over my career. The vast majority of my last 25 years have been spent building systems following those principles. That these platforms rarely get published is not proof of their non-existence.
Originally it's about avoiding the quadratic explosion of the number of things that must be implemented. The method is to replace M * N separate pieces of code with
- a single extra X thing
- M + N pieces of code
- a way to compose these M + N pieces of code to get the M * N you wanted in the first place
My personal set of properties might be more like:
Correctness Just-works Robustness Standards-compliance Performance Encapsulation
Who doesn't want to be an Epic Senior™?!
As the creator of BDD, I have great respect for Dan North's work.
However, like with all abstract "code quality" properties (modularity, predictability, robustness, encapsulation, etc) how can you quantify/measure how modular an application or how predictable a code base is?
It often comes down to a subjective "feeling".