view unix-phil-slides.ms @ 35:f11406a85319

some minor rework; new content in ch05
author meillo@marmaro.de
date Sat, 27 Mar 2010 14:27:36 +0100
parents faff9ea75591
children
line wrap: on
line source

.TL
\fR\s-6Why\s0\fP
.br
the Unix Philosophy
.br
.vs -4
\fR\s-6still matters\s0\fP
.AU
.ft R
.sp 1.2i
.ps 11
markus schnalke <meillo@marmaro.de>


.S "Goals of this talk
.I
Introduce the Unix Phil
.I
Show that most modern software is crap
.I
Explain why the Unix Phil leads to good/better software
.I
Convince you that good software is of matter
.sp 2
.I
Make you think


.S "Roadmap
.I
Background
.I
What is the Unix Phil?
.I
The Unix Phil after Gancarz
.I
Real world examples
.I
Final thoughts




.P "Background



.S "How I met the Unix Phil
.LP
First contact through dwm (suckless project)
.LP
``cat -v Considered Harmful''
.LP
``The Unix and the Echo''
.LP
``The Unix Programming Environment''
.LP
.sp 1
Better understanding through digging in the past


.S "Historical background
.LP
The late 60s and early 70s
.LP
Operating systems are complex
.LP
Brooks' ``The Mythical Man-Month''
.LP
MULTICS had just failed
.LP
A lot of different hardware
.LP
Limited computing power
.LP
Textual input and output (line printers)


.S "Everything is a file
.LP
Is the(?) basic concept in Unix (and even more in Plan9)
.LP
Made simple operating systems possible
.LP
It is not covered by the Unix Phil
.br
The Unix Phil is on a different level
.LP
.sp 2
Unix is mainly two things:
.I
An operating system (system calls)
.I
A toolchest (coreutils)



.P "What is the Unix Phil?



.S "What is the Unix Phil *itself*?
.LP
``The Unix philosophy is a set of cultural norms and philosophical
approaches to developing software based on the experience of
leading developers of the Unix operating system.''
(wikipedia)
.sp 2
.LP
How the inventors of Unix write software.
.LP
Common things of classic Unix tools.
.sp 2
.LP
Difficult to define


.S "Unix Phil vs. SW dev processes
.LP
The Unix Phil
.I
much: *what* to program
.I
few: *how* to program

.LP
Software developments processes:
.I
few: *what* to program
.I
much: *how* to program

.sp 2
.LP
Extreme Programming is like the Unix Phil
but with more *how* than *what*,
and with formalisms





.S "What is the Unix Phil?
.I
Doug McIlroy (1978)
.I
Mike Gancarz: ``The Unix Philosophy'' (1994)
.I
Eric S. Raymond: ``The Art of Unix Programming'' (2003)
.sp 2
.I
Richard Gabriel: ``Worse is Better'' (1989)


.S "Doug McIlroy
.LP
This is the Unix philosophy:
.I
Write programs that do one thing and do it well.
.I
Write programs to work together.
.I
Write programs to handle text streams, because that is a universal interface.


.S "Mike Gancarz: ``The Unix Philosophy''
.I
Small is beautiful.
.I
Make each program do one thing well.
.I
Build a prototype as soon as possible.
.I
Choose portability over efficiency.
.I
Store data in flat text files.
.I
Use software leverage to your advantage.
.I
Use shell scripts to increase leverage and portability.
.I
Avoid captive user interfaces.
.I
Make every program a filter.
.sp 1
.LP
Plus ten lesser tenets




.P "The Unix Phil after Gancarz



.S "Small is beautiful
.LP
Small software is easier to understand, write, maintain
.LP
Less lines of code contain less bugs
.LP
Monsters are large


.S "Make each program do one thing well
.LP
Programs with many functions are large
.LP
One thing is easier to understand
.LP
Often straight forward to implement
.LP
Toolchests
.LP
Reusable


.S "Build a prototype as soon as possible
.LP
Shows the quality of the design
.LP
Shows the problems of the software
.LP
The best way to shape a software
.LP
Users find bugs
.LP
Incremental development


.S "Choose portability over efficiency
.LP
(Originates in a lot of incompatible hardware in history)
.LP
Use is most important
.LP
Availability
.LP
Only needs to be fast enough


.S "Store data in flat text files
.LP
(originally: ``Store numerical data in flat ASCII files'')
.LP
Binary data is machine-dependent
.LP
Human readable data is:
.I
As generic as possible
.I
Is very likely supported
.I
Many tools work on it (Unix toolchest)
.I
Directly editable by humans
.LP
Processing needs only to be fast enough


.S "Use software leverage to your advantage
.LP
What do we have computers for?
.LP
Make best use of computing power
.LP
Reduce development effort
.LP
Toolchests and a powerful shell


.S "Use shell scripts to increase leverage and portability
.LP
Was very important in history
.LP
High level languages
.LP
Prototyping
.LP
Quick hacks
.LP
Users are ``programmers''


.S "Avoid captive user interfaces
.LP
Don't assume the user to be human
.LP
Exclude the user whenever possible
.LP
Automate
.LP
How does it scale?
.LP
Bloat


.S "Make every program a filter
.LP
Programs transform data
.LP
Combine programs
.LP
Have one common interface
.LP
Toolchests



.P "real world examples


.S "find -printf
.LP
How to reformat the output of find(1) to have ``FILENAME PATH''
instead of ``PATH/FILENAME''?
.LP
The ``easy'' way:
\f(CWfind /dir -printf "%P %h\en"\fP
.LP
The ``good'' way:
.br
.CW "\s-1find /dir | sed 's,\e(.*\e)/\e(.*\e),\e2 \e1,'
.LP
The difference shows off when one wants, for instance,
the path to be manipulated further.
.LP
.sp 3
Source (in German):
.CW "\s-1http://debianforum.de/forum/viewtopic.php?t=117683


.S "Various
.LP
Who uses
.CW "grep -R
?
.sp 1
.LP
.CW "cat -v

.sp 1
.LP
Pagers are taken for granted

.sp 1
.LP
What about the readline?



.S "MH / nmh
.LP
A Mail User Agent (MUA)
.LP
Is a toolchest
.LP
Work with mails like with generic files
.LP
The only(?) MUA that follows the Unix Phil
.LP
Has a very special feeling


.S "uzbl
.LP
A web browser that adheres to the Unix Phil
.LP
A young project (about 1 year)
.LP
Central question:
.br
What is the one task a web browser covers?
.LP
Makes very visible use of software leverage
.LP
Suffers hard from our broken web





.P "Final thoughts


.S "Say no
.LP
In today's computer world, following the Unix Phil means often asceticism
.LP
One needs to abjure a lot of ``nice'' features
.LP
Actually, it is abjuring the *bad* features
.LP
Leads to a valuable attitude, IMO
.LP
.sp 2
Transfer it to your everyday life


.S "Avoid complexity
.LP
Avoid complexity first and foremost
.LP
Complexity is the ``boss enemy'', software developers fight against
.LP
Strive for simplicity, clarity, generality
.LP
.sp 2
Transfer it to your everyday life


.S "Good solutions
.LP
We don't need just solutions, we need good ones
.LP
Today, we can make almost everything possible,
but we still cannot make it good
.LP
.sp 2
Transfer it to your everyday life


.S "Live it
.LP
The Unix Phil is more than just a few guidelines
.LP
You cannot follow only some of the tenets
.LP
To understand the Unix Phil, you need to engage with it
.LP
.sp 4
.ce
.B
It's a philosophy \(en live it!





.P "References


.S Literature
.I
``\fBThe Unix Philosophy\fP''
by Mike Gancarz
.br
Go and get it!
.I
``\fBThe Unix Programming Environment\fP''
by Kernighan and Pike
.br
A Bible for Unix-lovers.
.I
``\fBThe Mythical Man-Month\fP''
and ``\fBNo Silver Bullet\fP''
by Fred Brooks
.br
About complexity in software development.
.I
``\fBThe Practice of Programming\fP''
by Kernighan and Pike
.br
How good code should look like.
.I
``\fBcat -v Considered Harmful\fP''
by Pike and Kernighan
.CW \s-2http://harmful.cat-v.org/cat-v/\s+2
.br
A must-read.


.S
.LP
This talk was prepared using tools of the Heirloom project:
.CW \s-2http://heirloom.sf.net\s+2
.LP
The slides macros are based on
.br
.CW \s-2http://repo.cat-v.org/troff-slider/\s+2
.sp

.LP
The slides are available on my website
.CW \s-2http://marmaro.de/docs\s+2
and on
.CW \s-2http://ulm.ccc.de/ChaosSeminar/\s+2
.sp
.LP
See my paper on the topic, too.

.sp 2
2010-03-08