Notes 2021-09-02

Published on Thursday, 2 September 2021

Currently Reading

I am currently delving into "99 Bottles of OOP - 2nd Edition" by Sandi Metz. This book is a deep dive into object-oriented programming and provides practical techniques to improve code quality.

Notes on Flocking Rules

Flocking Rules

As I work through the book, I've been particularly fascinated by the concept of "Flocking Rules," which Sandi Metz uses to refine and simplify code. Here’s a quick summary of these rules:

  • Select the things that are most alike: Identify elements within the code that share similarities. This can be structural, functional, or conceptual.

  • Find the smallest difference between them: Pinpoint the minimal distinctions that separate these similar elements. This might involve differences in behavior, data usage, or outputs.

  • Make the simplest change that will remove that difference:

    • Parse the new code: Ensure the new code can be read and understood.
    • Parse and execute it: Check that the code not only makes sense but also runs correctly.
    • Parse, execute, and use its result: Integrate the code so that its output is utilized effectively.
    • Delete unused code: Remove any code that has become obsolete or redundant after these changes.

These rules offer a systematic approach to gradually refining a codebase, making it more maintainable and less complex over time. The insights from "99 Bottles of OOP" are proving invaluable as I strive to enhance my skills in software design and development.