31.07.2015 Views

Steven Pinker -- How the Mind Works - Hampshire High Italian ...

Steven Pinker -- How the Mind Works - Hampshire High Italian ...

Steven Pinker -- How the Mind Works - Hampshire High Italian ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Thinking Machines 91ual, The Elements of Style). They give advice on what makes a programwork powerfully, run efficiently, and evolve gracefully. One of <strong>the</strong>ir maximsis "Replace repetitive expressions by calls to a common function."For example, if a program has to compute <strong>the</strong> areas of three triangles, itshould not have three different commands, each with <strong>the</strong> coordinates ofone of <strong>the</strong> triangles embedded in its own copy of <strong>the</strong> formula for <strong>the</strong> areaof a triangle. Instead, <strong>the</strong> program should have <strong>the</strong> formula spelled outonce. There should be a "calculate-triangle-area" function, and it shouldhave slots labeled X, Y, and Z that can stand for any triangle's coordinates.That function can be invoked three times, with <strong>the</strong> coordinatesfrom <strong>the</strong> input plugged into <strong>the</strong> X, Y, and Z slots. This design principlebecomes even more important as <strong>the</strong> function grows from a one-line formulato a multistep subroutine, and it inspired <strong>the</strong>se related maxims, allof which seem to have been followed by natural selection as it designedour modular, multiformat minds:Modularize.Use subroutines.Each module should do one thing well.Make sure every module hides something.Localize input and output in subroutines.A second principle is captured in <strong>the</strong> maximChoose <strong>the</strong> data representation that makes <strong>the</strong> program simple.Kernighan and Plauger give <strong>the</strong> example of a program that reads in a lineof text and <strong>the</strong>n has to print it out centered within a border. The line oftext could be stored in many formats (as a string of characters, a list ofcoordinates, and so on), but one format makes <strong>the</strong> centering child's play:allocate eighty consecutive memory slots that mirror <strong>the</strong> eighty positionsin <strong>the</strong> input-output display. The centering can be accomplished in a fewsteps, without error, for an input of any size; with any o<strong>the</strong>r format, <strong>the</strong>program would have to be more complicated. Presumably <strong>the</strong> distinctformats of representation used by <strong>the</strong> human mind—images, phonologicalloops, hierarchical trees, mentalese—evolved because <strong>the</strong>y allowsimple programs (that is, stupid demons or homunculi) to compute usefulthings from <strong>the</strong>m.And if you like <strong>the</strong> intellectual stratosphere in which "complex systems"of all kinds are lumped toge<strong>the</strong>r, you might be receptive to Herbert

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!