Beyond the Buzzwords: More Practical Wisdom from ‘The Rules of Programming’ for the Modern Workplace

The image shows a collection of scrabble tiles with various words written on them. These words are likely used to create different phrases or sentences, as is typical in the game of Scrabble. Each tile has a single word printed on it, and these tiles appear to be arranged casually. The photograph is taken at an angle that captures the variety of letters available for use in this word-building activity. There are no people visible in the image.

This post is part of an ongoing series on the books that I have read as part of my continual professional development (CPD). All of my CPD posts are available at the following link: Continual Professional Development

It’s easy to get caught up in the latest trends and shiny new tools. However, some fundamental principles of software development remain timeless. I recently revisited Chris Zimmerman’s “The Rules of Programming,” a book packed with practical wisdom that resonates deeply with the challenges faced by teams today. This isn’t just a book about code; it’s a guide to better decision-making, more effective collaboration, and ultimately, more valuable software.

I’m constantly seeking out insights that can help organisations navigate the complexities of the modern workplace, and Zimmerman’s book delivers precisely that. This is the second in a series of posts exploring the key takeaways from this insightful read.

Focus on the Problem, Not the Solution

One of the most crucial lessons in “The Rules of Programming” is to resist the urge to prematurely generalize. It’s a temptation we all face: to create elegant, reusable components that might be useful in the future. However, this often leads to over-engineered code that’s difficult to understand, maintain, and adapt.

If you’ve got one use case, write code to solve that use case. Don’t try to guess what the second use case will be. Write code to solve problems you understand, not ones you’re guessing at.

- Chris Zimmerman, The Rules of Programming

This quote highlights the importance of a pragmatic, problem-solving approach. Instead of trying to anticipate every possible scenario, focus on delivering a solution to the immediate need. This approach ensures that the code remains focused, maintainable, and aligned with the actual requirements. It’s a powerful reminder that good software starts with a clear understanding of the problem at hand, not with speculative future needs. This is particularly relevant in today’s agile development environments where requirements are constantly evolving.

The Peril of Premature Generalisation

Building upon the previous point, Zimmerman strongly cautions against premature generalisation. The allure of creating reusable components can be strong, but it often comes at a significant cost.

Generalizing prematurely means you’re likely to write code that never gets exercised, and that’s bad. The less obvious problem is that generalizing prematurely makes it harder to adapt to unanticipated use cases. That’s partly because the generalized code you’re written is more complicated and therefore takes more work to adjust.

- Chris Zimmerman, The Rules of Programming

When you try to anticipate every possible use case, you end up with code that’s overly complex and difficult to modify. This complexity makes it harder to adapt to new requirements or unexpected scenarios. It’s a classic example of the “you don’t know what you don’t know” problem. It’s far better to build a solution that addresses a specific need and then iterate based on real-world feedback. This iterative approach allows for greater flexibility and adaptability.

The Hammer and the Nails Analogy

Zimmerman uses a powerful analogy to illustrate the dangers of over-generalisation:

When you’re holding a hammer, everything looks like a nail, right? Creating a general solution is handing out hammers. Don’t do it until you’re sure that you’ve got a bag of nails instead of a bag of screws.

- Chris Zimmerman, The Rules of Programming

This is a brilliant way of explaining the importance of choosing the right tool for the job.

Trying to solve every problem with a generic solution is often ineffective and can lead to suboptimal results. Sometimes, a simple, targeted solution is far more efficient and elegant than a complex, general-purpose one. This principle applies not just to code, but to all aspects of software development. It’s a reminder to avoid the temptation to apply a one-size-fits-all approach.

The First Law of Optimisation: Don’t Optimise!

Perhaps counter-intuitively, Zimmerman’s book advocates against premature optimisation. It’s a lesson that many developers struggle to internalise.

The first lesson of optimisation—don’t optimise. Make your code as simple as possible. Don’t worry about how fast it will run. It’ll be fast enough. And if not, it will be easy to make it fast.

- Chris Zimmerman, The Rules of Programming

The temptation to optimise code before it’s necessary is a common pitfall. Often, we spend time tweaking and refining code that doesn’t actually need it, diverting valuable resources away from more important tasks. It’s a reminder that clarity and maintainability should always be prioritised over micro-optimisations. If performance becomes an issue later, it’s much easier to identify and address the bottlenecks in a well-structured codebase.

The Illusion of Targeted Optimisation

Zimmerman further elaborates on the dangers of focusing on isolated performance improvements.

A one-stop optimisation plan of ’look for some bit of code that looks slow and make if faster,’ is not going to work. Your instincts are wrong about where the problem is, they’re wrong about what the data looks like, and they’re wrong about what the right fix will be.

- Chris Zimmerman, The Rules of Programming

Optimising code is not a guessing game. It requires a deep understanding of the code’s behaviour and the data it processes. Often, the performance bottlenecks are not where we initially suspect them to be. A targeted, data-driven approach is far more effective than blindly applying optimisation techniques. This requires careful profiling, analysis, and a willingness to experiment.

Do Less, Not Faster

The most effective way to improve performance is often to reduce the amount of work the code is doing.

The way to make code run faster is to do less, not to do the same things faster. Figure out what the code is doing that it doesn’t need to be doing, or what it’s doing multiple times that could be done once. Eliminate those bits of code and things will run faster.

- Chris Zimmerman, The Rules of Programming

This principle of “doing less” is a fundamental concept in software design. It encourages us to eliminate unnecessary complexity, redundant calculations, and inefficient algorithms. By simplifying the code, we can often achieve significant performance gains without resorting to complex optimisation techniques. This approach also improves the code’s readability and maintainability.

The Performance Obsession

Finally, Zimmerman offers a sobering perspective on the importance of performance.

Programmers worry too much about performance, full stop.

- Chris Zimmerman, The Rules of Programming

While performance is undoubtedly important, it shouldn’t be the primary driver of software development. An excessive focus on optimisation can lead to overly complex and difficult-to-maintain code. It’s crucial to strike a balance between performance and other factors, such as readability, maintainability, and time-to-market. Ultimately, the goal is to deliver valuable software that meets the needs of the users, and performance is just one piece of the puzzle.

Ready to Apply These Principles?

These quotes from “The Rules of Programming” offer valuable insights for anyone involved in software development and team leadership. By focusing on solving problems, avoiding premature generalisation, and prioritizing simplicity, we can build more robust, maintainable, and ultimately more successful software.

I help organisations like yours navigate these challenges and build high-performing teams. If you’re looking to improve your development processes, optimise your developer experience, or modernise your technology infrastructure, I’d love to hear from you.

Explore how I can help your organisation achieve its technology goals. Visit my website to learn more about my strategic strategic technology consultation services.. I offer tailored guidance to help you navigate the complexities of modern technology and achieve your business goals

We'll never share your name with anyone else.
We'll never share your email with anyone else.
Providing a subject can help us deal with your request sooner.
Please be as specific as possible; it will help us to provide a more specific response.
Un-checking this box will ensure that your data is deleted (in line with our privacy policy after we have dealt with your request. Leaving this box checked will auto enrol you into our email communications, which are used for marketing purposes only.