Hacker News new | ask | show | jobs
by IshKebab 372 days ago
The "unix philosophy" is a useless philosophy - perhaps worse than useless even - because "one thing" is not well defined, so in practice it adds nothing and just leads to arguments.

You could say that Eclipse does "one thing" - being an IDE platform - but I don't think anyone thinks that's what the Unix devs meant. Similarly I don't think they meant for people to write libraries that contain one 11-line function.

The actual advice should be something like "programs/libraries shouldn't try to do too much or too little". How do you know how much is too much or too little? Like so many programming guidelines the answer is you need taste and experience.

3 comments

I feel like "do one thing and do it well" is an oversimplification:

(i) Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new "features".

(ii) Expect the output of every program to become the input to another, as yet unknown, program. Don't clutter output with extraneous information. Avoid stringently columnar or binary input formats. Don't insist on interactive input.

(iii) Design and build software, even operating systems, to be tried early, ideally within weeks. Don't hesitate to throw away the clumsy parts and rebuild them.

(iv) Use tools in preference to unskilled help to lighten a programming task, even if you have to detour to build the tools and expect to throw some of them out after you've finished using them

---

[1] https://archive.org/details/bstj57-6-1899/page/n3/mode/2up

I agree with that. And like most rule of thumbs, it's very useful to go beyond the prescriptive part and ask yourself "why". And as qsort described, doing "one thing well" enables you to have desirable traits (easy testability, low cost refactoring, etc.).
> because "one thing" is not well defined

That's what a philosophy is, gives you some general guideline and you have to use your thinking to figure out how to apply it in specific circumstances. It does not substitute that thinking neither does it prevent stupid choices, it helps guide you in a higher/strategic level. It is not responsible for people making stupid decisions.

Sure but my point is that the Unix philosophy is so ambiguous that it leads to more confusion than it helps.

Stating it in a way that makes the ambiguity obvious - "don't make your program do too much" - reveals how little value it contains.

If you consider it from the point of view of how "clear is the scope?" Then it makes more sense.

Libc implementations have a very clear scope, clear enough that you can point to the specification. That is their 'one thing' do what that spec says.

Eclipse however, doesn't have that singular goal. You would be hard pressed to say how many of Eclipse's tentacles is a clear push towards being an ide. What should a completely finished version of Eclipse that met all it's goals look like?

Similarly the one thing could be "be a c preprocessor" or be a full "c compiler" these are both "one thing"s even while one is a subset of the other.

The intention of "do one thing, and do it well" is not to limit the scope but to show the boundary of the scope and to commit to doing everything within that boundary

By making your one thing "a full c compiler" you should be committing to doing everything that someone making a c preprocessor is doing, and to the same standard. The Unix philosophy should be considered a warning not to neglect components because you are working on a larger system.

You can't do everything, but you don't have to. If others are following the same principles then many of the parts of what you need will be done to a high standard by others.

> Libc implementations have a very clear scope, clear enough that you can point to the specification. That is their 'one thing' do what that spec says.

No you can't get out of it my just saying the "one thing" is to do what the spec says. Who decided what's in the spec?

Would Eclipse be fine if someone just wrote a spec for it?

It doesn't matter who decided what's in the spec. What matters is that you decided to implement it to a high standard. It's usefulness to others will be related to what they think of the spec. Nobody has to use your tool, but it's good for everyone to know exactly what the tool is.

Eclipse would be fine if it had a spec, committing to implementing that might be a task to arduous for some. A full spec would also lay bare what its goal is. Which in turn might lead to people deciding the tool they need is not this one. But yes, if was clear what it should be doing and it did that well then everyone benefits.

So the Unix philosophy doesn't apply if you have a written specification for you program? That's a pretty out-there view. I don't see why having a spec is related to what the Unix philosophy is trying to achieve.