Kernighan and Pike were right: Do one thing, and do it well

<p>In October 1984 two ideologues published a radical manifesto&hellip; sort of.&nbsp;<em>Program Design in the UNIX Environment</em>, by comp-sci legends Brian Kernighan and Rob Pike, articulated a pattern for software architecture that both men had already spent years fighting to preserve.</p> <p>&nbsp;</p> <p>Rob Pike and Brian Kernighan</p> <p>Admittedly, as far as manifestos go, it&rsquo;s about as spicy as you&rsquo;d expect from two Canadian engineers. Its most pointed jab is this memorable line from the abstract:</p> <blockquote> <p>Old programs have become encrusted with dubious features.</p> </blockquote> <p>The crux of the paper is often summed up by the acronym DOTADIW, &ldquo;Do One Thing And Do It Well&rdquo;. Unix and its descendants are full of programs that embody this mantra:&nbsp;<code>ls</code>&nbsp;just lists files,&nbsp;<code>cat</code>&nbsp;just outputs file contents,&nbsp;<code>grep</code>&nbsp;just filters data,&nbsp;<code>wc</code>&nbsp;just counts words, etc. Each program has a few options that change its behavior, but not too many. For example:&nbsp;<code>wc</code>&nbsp;can be configured to count lines or words, but it can&rsquo;t count the number of paragraphs or the occurrences of a specific phrase.</p> <p>The power of Unix, as championed by Kernighan and Pike, was the ability to chain these simple programs together to create complex behaviors. Why add regex matching to&nbsp;<code>wc</code>&nbsp;when&nbsp;<code>grep</code>&nbsp;already does that? To count the number of functions in a rust file you could run:</p> <p><a href="https://medium.com/source-and-buggy/do-one-thing-and-do-it-well-886b11a5d21">Click Here</a></p>