[TUHS] Unix APIs: elegant or not?

Paul Winalski paul.winalski at gmail.com
Thu Nov 1 01:47:20 AEST 2018

On 10/31/18, Warren Toomey <wkt at tuhs.org> wrote:
>   The POSIX file API is a great example, but not of a deep
>   interface. Rather, it’s a great example of how code with a very
>   complicated interface may look deceptively simple when reduced to C-style
>   function signatures.

For me one of the most important software design principles is that
the simple and most common use cases should be the simplest for the
user to code.  It's OK if complicated things are complicated to code,
but simple things should be kept simple.

I've always thought that the UNIX file primitives very elegantly
adhere to this principle.  Reading a file in UNIX is a simple
open()/read().../close() sequence.  Contrast that with VMS's $QIO or
IBM OS access methods, where the full complexity is not only exposed
in the interface, it must be considered, set up, and controlled by the
user for even the simplest operations.  Multibuffered, asynchronous,
interrupt-driven I/O is more complicated (if not downright clumsy) in
UNIX than in VMS or OS/VS, but that's OK, IMO--it shifts the
complexity burden to those doing complex things.

-Paul W.

More information about the TUHS mailing list