Refactoring: Remove Setters #CodeSmellby@mcsee

Refactoring: Remove Setters #CodeSmell

tldt arrow
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

Make your attributes private to favor immutability and add accidental coupling. Setters violate good naming policies since it does not exist on the [MAPPER] setXXX(). Remove the setXXX prefix. If you need to change an accidental property it is not a setter. Remove setXXX. Setter.setX(1); SetXXX(1) violates good naming policy. Setters should detect setters (unless they use meta-programming). Setters must also have good coverage if the car stores its new speed.

People Mentioned

Mention Thumbnail

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Refactoring: Remove Setters #CodeSmell
Maximiliano Contieri HackerNoon profile picture

@mcsee

Maximiliano Contieri

I’m senior software engineer specialized in declarative designs and S.O.L.I.D. and Agile lover.


Receive Stories from @mcsee

react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!