{
    "href": "/post/2020/10/20/rob-pikes-rules-of-programming/",
    "relId": "2020/10/20/rob-pikes-rules-of-programming",
    "title": "Rob Pike's Rules of Programming",
    "author": "pmjones",
    "tags": [
        {
            "href": "/tag/programming/",
            "relId": "programming",
            "title": "Programming",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        }
    ],
    "created": "2020-10-20 14:37:35 UTC",
    "updated": [
        "2020-10-20 14:37:35 UTC",
        "2020-10-24 14:23:22 UTC",
        "2020-10-24 14:23:42 UTC",
        "2020-10-24 14:23:48 UTC",
        "2020-10-24 14:23:57 UTC",
        "2020-10-24 15:40:26 UTC"
    ],
    "markup": "markdown",
    "html": "<blockquote>\n<ol>\n<li>\n<p>You can't tell where a program is going to spend its time. Bottlenecks occur in surprising places, so don't try to second guess and put in a speed hack until you've proven that's where the bottleneck is.</p>\n</li>\n<li>\n<p>Measure. Don't tune for speed until you've measured, and even then don't unless one part of the code overwhelms the rest.</p>\n</li>\n<li>\n<p>Fancy algorithms are slow when n is small, and n is usually small. Fancy algorithms have big constants. Until you know that n is frequently going to be big, don't get fancy. (Even if n does get big, use Rule 2 first.)</p>\n</li>\n<li>\n<p>Fancy algorithms are buggier than simple ones, and they're much harder to implement. Use simple algorithms as well as simple data structures.</p>\n</li>\n<li>\n<p>Data dominates. If you've chosen the right data structures and organized things well, the algorithms will almost always be self-evident. Data structures, not algorithms, are central to programming.</p>\n</li>\n</ol>\n<p>Pike's rules 1 and 2 restate Tony Hoare's famous maxim \"Premature optimization is the root of all evil.\"</p>\n<p>Ken Thompson rephrased Pike's rules 3 and 4 as \"When in doubt, use brute force.\".</p>\n<p>Rules 3 and 4 are instances of the design philosophy KISS.</p>\n<p>Rule 5 was previously stated by Fred Brooks in The Mythical Man-Month. Rule 5 is often shortened to \"write stupid code that uses smart objects\".</p>\n</blockquote>\n<p>Copied from <a href=\"http://users.ece.utexas.edu/~adnan/pike.html\">http://users.ece.utexas.edu/~adnan/pike.html</a>.</p>\n"
}
