DEV Community

loading...
Cover image for Code Smell 25 - Pattern Abusers

Code Smell 25 - Pattern Abusers

mcsee profile image Maxi Contieri Originally published at maximilianocontieri.com Updated on ・1 min read

Patterns are awesome. With great powers comes great responsibility

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

Right

Detection

It would be very difficult to create automatic detection rules.

A class name with more than one pattern on it, is a warning.

Tags

  • Abuser

  • Naming

Conclusion

Chose when to apply a pattern solution. You are not smarter for using too many patterns. You are smart if you choose the right opportunity for everyone.

Relations

More Info

How to decouple a legacy system

What exactly is in a name

Credits

Photo by Nathan Dumlao on Unsplash


When you have a hammer, every problem looks like a nail.

Discussion (0)

pic
Editor guide