olivlawolivlaw

From books

Writing good code is not just making it work, but finding the most efficient recipe, like a chef searching for the best method, not just one that works.

Donald Knuth · The Art of Computer Programming · 19681 minute read

A good program doesn’t just work; it uses the most efficient method, like a chef choosing the optimal recipe

Knuth carefully analyzed thousands of different ways to sort or search data, measuring exactly how many steps and how much memory each method uses. Some recipes look simple but become very slow with much more data. Other, more complicated-looking recipes stay fast even with millions of entries.

Knuth teaches us that a method that works is not enough. When packing for a trip, you could just throw clothes randomly into the suitcase. It works, but it takes long to find something. A better method is to roll each item and layer them. This is the difference between a slow program and a fast one, especially when you have a lot to do.

Why it matters His books remain, decades later, a standard reference for software engineers.

Just worksMaximumefficiency
Comparing a simple program with an optimized one

← Back to the feed