Tag Archives: OCP

if-else trees vs SOLID principles

Introduction

If you have read my previous articles, or know me personally, you must know that the one kind of bad code I hate the most is if-else trees. In the first article of this weblog, I talked about if-else trees in general, exposing some general ideas about how to avoid them, remove them from the code or why they are bad, describing them as a code smell.

Today, as I have just finished writing a series of articles in French about the SOLID principles, I am going to focus on the maintainability aspect of if-else trees, and make them fight against two of the SOLID principles: the Single Responsibility Principle and the Open/Closed Principle. This will allow me to introduce some important rules to know about if-else trees. Continue reading if-else trees vs SOLID principles

SOLID Partie II : Open/Closed Principle

Introduction

Dès lors qu’un logiciel est, avec le temps, amené à être modifié, que ce soit afin d’y ajouter des fonctionnalités ou de modifier certains comportements, des problèmes de régression se posent. Au fil des versions la qualité tend à diminuer et la maintenabilité aussi. Continue reading SOLID Partie II : Open/Closed Principle