DEV Community

Discussion on: What programming best practice do you disagree with?

Collapse
 
rossdrew profile image
Ross

It allows you to validate and know when fields are accessed.

Thread Thread
 
michaeldober profile image
Michael Ober

Getters and Setters allow you to validate and normalize input. If this validation isn't needed then consider a public field.