Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I can't seem to find it in a google search, maybe I'm just recalling entirely the wrong terms.

In the early computing era there was a competition. Something like take some input and produce an output. One programmer made a large program in (IIRC) Fortran with complex specifications documentation etc. The other used shell pipes, sort, and a small handful or two of other programs in a pipeline to accomplish the same task in like 10 developer min.



The Knuth link in the sibling comment is an original, but you're probably thinking of "The Tao of Programming"

http://catb.org/~esr/writings/unix-koans/ten-thousand.html

"""“And who better understands the Unix-nature?” Master Foo asked. “Is it he who writes the ten thousand lines, or he who, perceiving the emptiness of the task, gains merit by not coding?”"""


There was also the "Hadoop vs. unix pipeline running on a laptop"-story a few years back, a more modern take: https://adamdrake.com/command-line-tools-can-be-235x-faster-...



Sounds like "Knuth vs McIlroy", which has been discussed on hn and elsewhere before, and the general take is that it was somewhat unfair to Knuth.

[1] https://homepages.cwi.nl/~storm/teaching/reader/BentleyEtAl8... [2] https://www.google.com/search?q=knuth+vs+mcilroy


This is the competition I was thinking of. I must have read it in a dead-image PDF version some other time on HN. This paper isn't the one I recall but the solution is exactly the sort I vaguely recalled.

I'm trying to copy-in the program as it might have existed, with some obvious updates to work in today's shells ...

  #!/bin/sh
  tr -cs A-Za-z '
  ' "${2:-/dev/stdin}" |\
  tr A-Z a-z |\
  sort |\
  uniq -c |\
  sort -rn |\
  sed ${1:-100}q
Alternately (escapes not yet tested) $ tr -cs A-Za-z \012 "${INPUTFILEHERE:-/dev/stdin}" | tr A-Z a-z | sort | uniq -c | sort -rn | sed ${MAXWORDSHERE:-100}q

Edited: Removed some errors likely induced by OCR / me not catching that in the initial transcription from the browser view of the file.


Just to be clear, it was not a competition. For more, please follow the links from some of the previous HN discussions, e.g. https://news.ycombinator.com/item?id=31301777.

[For those who may not follow all the links: Bentley asked Knuth to write a program in Pascal (WEB) to illustrate literate programming—i.e. explaining a long complicated program—and so Knuth wrote a beautiful program with a custom data structure (hash-packed tries). Bentley then asked McIlroy to review the program. In the second half of the review, McIlroy (the inventor of Unix pipes) questioned the problem itself (the idea of writing a program for scratch), and used the opportunity to evangelize Unix and Unix pipes (at the time not widely known or available).]


I was both of those developers at different times, at least metaphorically.

I drank from the OO koolaid at one point. I was really into building things up using OOD and creating extensible, flexible code to accomplish everything.

And when I showed some code I'd written to my brother, he (rightly) scoffed and said that should have been 2-3 lines of shell script.

And I was enlightened. ;)

Like, I seriously rebuilt my programming philosophy practically from the ground up after that one comment. It's cool having a really smart brother, even if he's younger than me. :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: