Flickr Badge

Saturday, June 10, 2006

On program optimisations

Programs should be written for people to read, and only incidentally for machines to execute. -Abelson and Sussman, Structure and Interpretation of Computer Programs

This famous quote by Abelson and Sussman sums up what software development should be about. Computers will execute anything that you throw at them, but not everything is easy for humans to read and understand. Many bugs are caused by programmers not being able to fully understand the code and design. It is strange how many programs are written to be efficient for the computer to run, but are highly inefficient when it comes to programmer understandability. This is exactly the opposite of what it should be. If there is one principle that drives the design of a software system it is to write programs that others will find easy to read and understand. Only make optimisations where it is absolutely required, and keep these optimisations to a minimum.

Premature optimization is the root of all evil (or at least most of it) in programming. - Tony Hoare, and repeated by Donald Knuth in Computer Programming as an Art, 1974 Turing Award lecture

This post is a part of the selected archive.

No comments: