Cookie Notice

As far as I know, and as far as I remember, nothing in this page does anything with Cookies.


Reading Beautiful Code, Chapter One ...

This is Brian Kernighan's chapter, on Regular Expressions. This amuses me, because Regular Expressions are widely considered to be an ugly thing. More than just ugly, too. "Some people, when confronted with a problem, think 'I know, I'll use regular expressions.'" wrote Jamie Zawinski. "Now they have two problems." I'm not there. I can read Perl-style regular expressions,

(I'll drop into an aside here and complain. Why is it that Perl has begun to complain when I write something like this:
my $foo = '' ;
print "XXX" if $foo =~ m{xxx}mx ;

Seriously, if a string has nothing, it clearly will not have the string xxx in it. '' should no more pop up an error than 'aaa' should.)

This chapter focuses on an implementation of a regular expression engine written by Rob Pike for the book The Practice of Programming. Chosen because it's a clear usage of recursion that isn't Quicksort or walking a tree. If I was Norm MacDonald, I'd note that programmers love recursion like Germans love David Hasselhoff. I suppose I might anyway.

But it's clear that Kernighan is fairly uncomfortable with the concept of beauty as applicable to computer science. He says "elegant" and "novel" and "compact". Those are three common metrics for beauty, but then, the standard of beauty would be Ingrid Bergman. She's beautiful, true, but hardly the only standard.