|
|
|
|
|
by anti-pattern
4838 days ago
|
|
Interesting. Why would the requires go stale? And how would you use a dependency you don't require? It wouldn't be possible to use it unless you required it. This of course assumes you're testing your classes in isolation. |
|
For requires going stale, I mean when a file originally depends on something but no longer does. The require is likely to linger, especially if the dependency is removed without knowing that it was the entirety or the last of the dependency. This file now has stale dependencies.
Then something requiring that file will have that dependency in place and possibly use it without requiring it because of that. This file now has incorrect dependencies.
Expand the above across a more complex project and it becomes virtually impossible to verify the correctness of your requires, so you probably just stop trying and require things as needed, which makes it worse.
When you finally discover it your changes (in your version control) become less isolated as random requires start popping in and out.
This is not a new or unique problem to Ruby, obviously. C/C++ headers have a very similar problem.