Adding persistence, serialization, displaying, importing, exporting code to an object bloats its protocol and brings coupling.
Keep your objects clean.
Decouple business objects.
Separate accidental concerns: Move Persistence, Formatting, Serialization to special objects.
Keep essential protocol using bijection.
It is difficult (but not impossible) to create linting rules based on naming and hinting for suspect names.
- Some frameworks force us to inject dirty code in our objects. (For example identifiers).
We should try to use better languages/frameworks.
We are very used to see business objects polluted. This is normal. We need to reflect on the consequences and coupling from these designs.
Simple things should be simple, complex things should be possible.
This article is part of the CodeSmell Series.