Editing for another book

Well, that's twenty-four patterns of design and thought, so it's time for another book. The title will be 24 Patterns for Clean Code. Don't worry that I'm out of material - there's hundreds of years' worth of material to write about. That said, I'm in transit, so this is it for

Patterns – Prototypes and Optimization

The hardest interview I ever had: someone told me to go up to a whiteboard and solve a programming problem, in code, optimally, on the first try. It's a basic fact of our field that we iterate toward the final product. Not unlike a sculptor bringing the David out of a piece of marble, we

Patterns – Logical Unity

It's amazing how often programmers forget the simplest rule of programming: 1=1. This is the principle of logical unity (or modularity - they're largely synonymous). Unity of Function If we adhere to the principle of top-down modular design, all our functions should be relatively small. At the bottom of the tree, every function serves one purpose and

Patterns: Shielding Inputs with const

One of the key worries I have heard from those ill-informed OOP programmers is that C cannot protect inputs you pass into functions. They use private fields and retrieval functions to ensure that the stored value is protected from unwanted modification. However, this concern is addressed by C's const keyword. Taking a const value There are times

Patterns: Boundary Check

A wise quote: When it goes without saying, someone should probably say it. This is one of the better known patterns out there, but it still bears repeating. The boundaries for integers When you're working with a range of integers (for example, human age range could be between 0 and 135), we have two obvious boundary points

Patterns: The If-Else Error Chain

In languages like Java, we have a standardized error-handling paradigm in the try-catch expression. Effectively, this hands all error-handling off to the computer, which monitors all code in the try loop for any and every kind of possible error. While we are able to restrict the range of errors in many cases, the fact