Code Smell 16 - Ripple Effect

Subscribe to my newsletter and never miss my upcoming articles

Small changes yield unexpected problems.

Problems

  • Coupling

Solutions

  1. Decouple.
  2. Cover with tests.
  3. Refactor and isolate what is changing.
  4. Depend on interfaces.

Examples

  • Legacy Systems

Sample Code

Wrong

Detection

Tags

  • Legacy

Conclusion

There are multiple strategies to deal with Legacy and coupled systems. We should deal with this problem before it explodes under our eyes.

Relations

More info

Credits

Photo by Jack Tindall on Unsplash


Architecture is the tension between coupling and cohesion.

Neal Ford


This article is part of the CodeSmell Series.

Comments (2)

Rodion Borisov's photo

Decoupling a clock isn't the best example of it, I suppose, because I didn't quite get it 😁

When I work with database for bot, as example, I plant queries in methods of accompanying Models. Does it somehow introduce a Ripple Effect?

Maxi Contieri's photo

which would be the source of time?

How would you test it?

Remember tests must be in full environment control and have no globals involved and 'now()' is a global out of control.

if you couple your model to your database you will indeed have lots of coupling.

Databases are accidental and, thus, unrelated to business models.

Create your bot. Create your chats, create your conversations and test them.

The database comes later on.