Home > Articles > Programming

"The Best Programming Advice I Ever Got" with Mark Summerfield

  • Print
  • + Share This
Mark Summerfield, the author of Programming in Go: Creating Applications for the 21st Century, shares some of his best advice for improving your own programming.
Be sure to check InformIT for a new article every Wednesday. See more advice from other programmers here.

From the author of


Mark Summerfield

Job Experience:

I've worked in the software industry for many years, mostly as a programmer. I've been an independent author, programmer, and trainer since 2006.

Most Notable Achievement:

In the programming world I'm best known for my computer textbooks on general programming (Python, Go), and GUI programming (Qt, PyQt). In the applications world I'm best known for my open source DiffPDF application.

Most Frequently Used Programming Languages:

Python 3, Go, C++


Over the years I've tried several programming paradigms, including procedural, logic, object-oriented, functional, and mixtures of these.

All of them have informed my programming practice, particularly object-oriented programming. But it is two simple ideas—rather than particular paradigms—that have had a massive impact on how I program.

The first idea is refactoring. This means taking a function or method and making sure that it does just one specific thing. This often involves creating helper functions or methods to take over part of the work the original one did. Each helper should also be refactored so that it too does one specific thing. One advantage of doing this is that refactored functions and methods are smaller and easier to understand.

They are usually easier to test since they often require less state to be set up than larger more monolithic functions. And smaller functions and methods can be composed to produce new functionality, which is much nicer than copying out chunks of a larger function to make a new variant. I also find that refactored functions are easier to reason about.

The second idea is "TDD" (Test Driven Design/Test Driven Development).

This involves writing tests before writing an application (or before adding a new feature or doing a change). These tests will naturally fail since what they test hasn't been done yet. Then the implementation is done and is complete once the tests pass. This sounds like a lot of work if you're not used to it—but in fact it can save huge amounts of time.

This is because whenever a change is applied you can immediately run the test suite to see if it breaks anything. This makes it easy to spot problems long before they go into a release. A decent test suite is liberating, since it means that programmers can freely experiment with code improvements safe in the knowledge that the test suite will immediately reveal any significant behavior changes that result.

These ideas can be applied to any programming in any language. They've certainly improved my programming—as well as the maintainability of the programs I write.

  • + Share This
  • 🔖 Save To Your Account