1 |
On 24/02/2014 01:12, Mick wrote: |
2 |
> On Sunday 23 Feb 2014 22:32:32 Alan McKinnon wrote: |
3 |
>> On 23/02/2014 20:18, Canek Peláez Valdés wrote: |
4 |
>>> I don't think forking would attract much developers. Writing something |
5 |
>>> new trying to follow "the*nix design principles", but being modern and |
6 |
>>> with the same features (all of them optional, of course) of systemd |
7 |
>>> will have more chances; although I think it will fail because most of |
8 |
>>> the people that can code "better" actually like the systemd design, |
9 |
>>> and would prefer to contribute to it. |
10 |
>>> |
11 |
>>> And if you found enough of this mythical good-coders, good luck |
12 |
>>> defining what it means "the*nix design principles". |
13 |
>> |
14 |
>> I've been wondering about this concept of "the*nix design principles"... |
15 |
> |
16 |
> Well, I'm no authority on this since I can't code, but here's a starter for |
17 |
> 10: |
18 |
> |
19 |
> http://www.faqs.org/docs/artu/ch01s06.html |
20 |
> |
21 |
> http://people.fas.harvard.edu/~lib113/reference/unix/co-unix4.html |
22 |
|
23 |
I really like documents like this, all airy-fairy and giving the |
24 |
impression that the whole design was worked out nicely in advance. It |
25 |
wasn't. the doc even quotes this fellow who had nothing to do with the |
26 |
doc itself: |
27 |
|
28 |
"Those who don't understand UNIX are doomed to reinvent it, poorly." |
29 |
--Henry Spencer |
30 |
|
31 |
Let me tell you how Unix was designed, how the whole thing took shape |
32 |
once K&R had gotten C pretty much stabilized. It is most apparent in IO |
33 |
error handling in early designs and it goes like this: |
34 |
|
35 |
We don't do error handling. We don't even try and deal with it at the |
36 |
point it occurred, we just chuck it back up the stack, essentially |
37 |
giving them message "stuff it, I'm not dealing with this. You called me, |
38 |
you fix it." |
39 |
|
40 |
Doesn't sound like good design does it? Sounds more like do whatever you |
41 |
think you can get away with. Good design in this area gives you |
42 |
something conceptually along the lines of try...catch...finally (with |
43 |
possibly some work done to avoid throwing another exception in the |
44 |
finally). Unix error "design" does this: |
45 |
|
46 |
exit <some arb number> |
47 |
and an error message is in $@ if you feel like looking for it |
48 |
|
49 |
Strangely, this approach is exactly why Unix took off and got such |
50 |
widespread adoption throughout the 70s. An engineer will understand that |
51 |
a well-thought out design that is theoretically correct requires an |
52 |
underlying design that is consistent. In the 70s, hardware consistency |
53 |
was a joke - every installation was different. Consistent error handling |
54 |
would severely limit the arches this new OS could run on. By taking a |
55 |
"Stuff it, you deal with it coz I'm not!" approach, the handling was |
56 |
fobbed off to a higher layer that was a) not really able to deal with it |
57 |
and b) at least in a position to try *something*. |
58 |
|
59 |
By ripping out the theoretical correctness aspects, devs were left with |
60 |
something that actually could compile and run. You had to bolt on your |
61 |
own fancy bits to make it reliable but eventually over time these things |
62 |
too stabilized into a consistent pattern (mostly by hardware vendors |
63 |
going bankrupt and their stuff leaving the playing field) |
64 |
|
65 |
And so we come to what "Unix design" probably really is: |
66 |
|
67 |
"You do what you have to to get the job done, the simpler the better, |
68 |
but I'm not *really* gonna hold you to that." |
69 |
|
70 |
I still don't like what Lennart has done with this project, but I also |
71 |
fail to see what design principle he has violated. |
72 |
|
73 |
|
74 |
|
75 |
-- |
76 |
Alan McKinnon |
77 |
alan.mckinnon@×××××.com |