From the course: Learning SOLID Programming Principles

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Modifying a class and fixing bugs

Modifying a class and fixing bugs - Python Tutorial

From the course: Learning SOLID Programming Principles

Modifying a class and fixing bugs

- [Instructor] The idea of a class that's closed to modification, sometimes leads to arguments among team members over how to implement bug fixes. I'm going to suggest that a class should be closed even to bug fixes. Really? What is a bug fix? It's a modification to a faulty class definition. If a class is truly closed to modification, what about the possibility of disruptive ripples that unfold from the change? Ideally, a bug fix has no ripples. Start with a bug report, create a unit test, revise the code and hit presto it's fixed, right? Well, not so quickly. Pragmatically, a design change may be made here to fix a bug over there. This is common because buggy behavior often emerges from the interactions of multiple objects. Bugs may not be confined to the internals of a single class. When making a change here to fix a bug that arises over there, the whole point is to leverage the ripple effect and fix the problem.…

Contents