Code Smell 63 - Feature Envy

If your method is jealous and don't trust in delegation you should start to do it.

Subscribe to my newsletter and never miss my upcoming articles

Listen to this article


  • Coupling

  • Low Reuse

  • Low Testability

  • Bad Responsibilities Assignment

  • Bijection Fault


  1. Move method to the appropriate class.

Sample Code



Some linters can detect a sequential pattern of collaborations with another object.


  • Coupling


  • We should assign responsibilities according to real object mappers and avoid abusing other objects protocol.


More info


Photo by Hisu lee on Unsplash

We argue that design practices which take a data-driven approach fail to maximize encapsulation because they focus too quickly on the implementation of objects. We propose an alternative object-oriented design method which takes a responsibility-driven approach.

Rebecca Wirfs-Brock

This article is part of the CodeSmell Series.

Comments (2)

Rodrigo's photo

Great advice Maxi 👏

The job instance knows its properties, so by moving the print responsibility close to their source of change; we make the candidate class depend on one point of change rather than multiples attributes in the job class 👌

Maxi Contieri's photo

yes ! i will add this to the article!