Introduction to Smalltalk Best Practice Patterns

1416355200

A pattern is a decision recommended by experts to solve recurring problems in software engineering. For example, delegating work to one of many possible objects is a pattern, and even though the actual objects and messages being passed around will differ on each implementation, they have several constant qualities.

Smalltalk Best Practice Patterns, by Kent Beck, is written under the premise that problems in software development are universal: we all have to name variables, functions and classes, relate entities, cope with change, and so on. Patterns offer an approach refined through experience to solve these problems.

Some of the key benefits of understanding and using them:

  • Read and understand code more quickly

    When you identify a pattern in the code you’re working on, it’s easier to understand why it’s written like it is. If you know what to expect you can understand the system faster.

  • Make everyday development decisions with confidence

    Kent Beck suggests attempting to back up every line of code you write with a pattern. He mentions that at first it will slow you down, but as you practice and internalize them, you’ll gain your old speed with the added benefit of writing much cleaner code.

  • Common language and values for code reviews

    If your team is familiar with patterns, you can use them as reference in code reviews and suggest legitimate improvements for existing code.

  • Describe a system with fewer words

    Patterns carry meaning. If you communicate with patterns and your audience understands them, you can say more with fewer words. For example, think of how many more words you’d need to describe “a broken computer” without using the word “computer”. Each pattern embodies a concept.

  • Clean up complex systems

    When you’re working on a system for the first time, you can use patterns to clean the code to make it readable and more understandable. Kent beck mentions he used this approach to clean code and at the same time understand the system. Once he went through the system and understood what needed to change, the code was already clean to make changes without much effort.