DEV Community

Cover image for Code Smell 16 - Ripple Effect
Maxi Contieri ⭐⭐⭐
Maxi Contieri ⭐⭐⭐

Posted on • Updated on • Originally published at


Code Smell 16 - Ripple Effect

Small changes yield unexpected problems.

TL;DR: If small changes have big impact, you need to decouple your system.


  • Coupling


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


  • Legacy Systems

Sample Code


class Time {
   constructor(hour, minute, seconds) {
     this.hour = hour;    
     this.minute = minute;  
     this.seconds = seconds;  
      //call operating system

//Adding a TimeZone will have a big Ripple Effect
//Changing now() to consider timezine will also bring the effect
Enter fullscreen mode Exit fullscreen mode


class Time {
   constructor(hour, minute, seconds, timezone) {
     this.hour = hour;    
     this.minute = minute;  
     this.seconds = seconds;  
     this.timezone = timezone;  
  //Removed now() since is invalid without context

class RelativeClock {
     this.timezone = timezone;
     var localSystemTime = this.localSystemTime();
     var localSystemTimezone = this.localSystemTimezone();
     //Do some math translating timezones
     return new Time(..., timezone);     
Enter fullscreen mode Exit fullscreen mode



  • Legacy


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


More info


Photo by Jack Tindall on Unsplash

Architecture is the tension between coupling and cohesion.

Neal Ford

This article is part of the CodeSmell Series.

Last update: 2021/06/24

Top comments (0)

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.

One does not simply learn git