DEV Community

Cover image for Code Smell 25 - Pattern Abusers
Maxi Contieri
Maxi Contieri

Posted on • Updated on • Originally published at maximilianocontieri.com

Code Smell 25 - Pattern Abusers

Patterns are awesome. With great powers comes great responsibility.

TL;DR: Don't abuse patterns.

Problems

  • Over Design

  • Readability

Solutions

  1. Measure the tradeoff of patterns usage.

  2. Create solutions based on real world names (essential) over architecture (accidental).

  3. Choose good names.

  4. User MAPPER technique to find bijection real entities.

Sample Code

Wrong

public final class FileTreeComposite {
    //name should be inferred from behaviour
}

public final class DateTimeConverterAdapterSingleton {
    //
}

public final class PermutationSorterStrategy {
    //
} 

public final class NetworkPacketObserver {
    //
}

public final class AccountsComposite {
    //
}