The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: bakul@bitblocks.com (Bakul Shah)
Subject: [TUHS] Discuss of style and design of computer programs from a user stand point [was dmr note on BSD's sins]
Date: Fri, 05 May 2017 23:07:27 -0700	[thread overview]
Message-ID: <20170506060727.A00C0124AEFE@mail.bitblocks.com> (raw)
In-Reply-To: Your message of "Sat, 06 May 2017 12:16:53 +1000." <CAGfO01ytR+g09Mp+YQ3fR2j=QnHZsfcZM-xQQKr+NNvtESypcA@mail.gmail.com>

On Sat, 06 May 2017 12:16:53 +1000 Noel Hunt <noel.hunt at gmail.com> wrote:
> 
> What you call 'composability' is nothing more than the 'software
> tools' approach.

Composable components can have a much tigher coupling.  vi,
rsync, git and gdb are s/w tools but they are not composable
in the sense of sed, grep, uniq, awk, head, tail, tr, sort,
ls, find etc.

> I recall reading an interview with Dennis Ritchie, but can no
> longer find it, where he talks about this approach versus the
> monolithic program model, as for example demonstrated by
> 'perl', which does everything. Dennis remarked that the
> 'tools' approach required careful thought (which programs to
> use, how to connect them with pipes) and so was more difficult
> to use, hence the popularity of 'perl'.

This is the "modularity" approach, where one program does one
thing well rather than doing everything (e.g IDE). But
moudlarity does not necessarily give you composability.

Also, it is not enough to have composable components; you need
a language/environment in which they can be used.

> A most beautiful example of this approach is from Doug McIlroy
> in his critique of Donald Knuth's solution to a problem posed
> by Jon Bentley in his 'Programming Pearls' column:
> 
>     Read a file of text, determine the n most frequently used
>     words, and print out a sorted list of those words along with
>     their frequencies.
> 
> Donald Knuth wrote a long, beautifully crafted program in some
> pseudo-code.  Doug McIlroy provided an alternative solution:
> 
> tr -cs A-Za-z '\n' |
> tr A-Z a-z |
> sort |
> uniq -c |
> sort -rn |
> sed ${1}q
> 
> This is real genius.

Indeed. 

Note that a similar approach was implemented by Iverson in
APL. In fact a shell pipeline has a lot in common with array
programming!

Iverson in essence built a whole workshop with a set of simple
but powerful standard tools (functions and higher order
functions).  The same has been carried on in follow on array
languages such as j and k and q languages.  Many of these
array functions are directly applicable to stream processing.
In contrast unix shells provide a very shallow glue layer.

> On Sat, May 6, 2017 at 1:37 AM, Bakul Shah <bakul at bitblocks.com> wrote:
> 
> > I think the key issue is not as much minimalism as composability. BSD
> > often prioritized convenience over composability. Each command doing one
> > thing well and doing line oriented makes them more composability. You can
> > always package up convenient combinations in a script. Plan9 has lc which
> > prints like unix ls -C but it is an rc script. Trying to achieve
> > composability can result in leaner systems.


  parent reply	other threads:[~2017-05-06  6:07 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-05 15:20 Clem Cole
2017-05-05 15:37 ` Bakul Shah
2017-05-06  2:16   ` Noel Hunt
2017-05-06  2:40     ` Toby Thain
2017-05-06  6:07     ` Bakul Shah [this message]
2017-05-06 22:11       ` Steve Johnson
2017-05-06 23:35         ` Larry McVoy
2017-05-07  4:06       ` Dan Cross
2017-05-07 13:49         ` [TUHS] Discuss of style and design of computer programs from a user stand point Michael Kjörling
2017-05-06  2:02 ` [TUHS] Discuss of style and design of computer programs from a user stand point [was dmr note on BSD's sins] Doug McIlroy
2017-05-06  5:33   ` Steve Johnson
2017-05-06  9:18     ` [TUHS] Discuss of style and design of computer programs from a user stand point Michael Kjörling
2017-05-06 13:09       ` Nemo
2017-05-06 13:44         ` Michael Kjörling
2017-05-06 14:40       ` Larry McVoy
2017-05-06 15:09         ` [TUHS] Discuss of style and design of computer programs from a Corey Lindsly
2017-05-06 15:20           ` Michael Kjörling
2017-05-06 15:24             ` Larry McVoy
2017-05-06 15:51               ` Michael Kjörling
2017-05-06 15:53                 ` Larry McVoy
2017-05-06 20:00             ` Steve Nickolas
2017-05-06 21:45               ` Michael Kjörling
2017-05-07  7:42                 ` Stephen Kitt
2017-05-06 15:23           ` ron minnich
2017-05-06 15:44             ` Michael Kjörling
2017-05-06 18:43         ` [TUHS] Discuss of style and design of computer programs from a user stand point Dave Horsfall
2017-05-06 19:50           ` Bakul Shah
2017-05-07  1:15             ` Warner Losh
2017-05-07  1:42               ` Noel Hunt
2017-05-07 13:54                 ` Michael Kjörling
2017-05-07 14:58                   ` arnold
2017-05-07 16:33                     ` Michael Kjörling
2017-05-07 15:13                 ` Warner Losh
2017-05-06 16:40       ` Kurt H Maier
2017-05-06 14:16     ` [TUHS] The Elements of Programming Style (book) - was Re: Discuss of style and design of computer programs Toby Thain
2017-05-06 13:30 [TUHS] Discuss of style and design of computer programs from a user stand point [was dmr note on BSD's sins] Doug McIlroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170506060727.A00C0124AEFE@mail.bitblocks.com \
    --to=bakul@bitblocks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).