Imagine building a house.
If you build a house where the Foundation is made of wallpaper (unstable and concrete), the house falls down! This is called the Zone of Pain.
This rule calculates the “health” of a Namespace by looking at three ratios:
0 means nothing depends on it. 1 means everyone depends on it.0 means it’s all concrete classes. 1 means it’s all interfaces and abstract classes.A namespace full of concrete Database connection classes (A=0) that every other part of the application depends on (I=1).
Because everyone depends on it, it’s hard to change. But because it’s concrete, you want to change it often. This causes pain!
A namespace full of Interfaces (A=1) that nobody in the application actually uses or implements (I=0). It’s highly abstract, but totally useless.
rules:
E0023:
max_instability: 0.8
max_abstractness: 0.8
max_distance: 0.5
If Phanalist flags your namespace for Distance (D), it means you have important files that are too specific, or abstract files that nobody uses. If a lot of code depends on a folder, that folder should contain mostly Interfaces!