Why getter and setter methods are evil

Some classic read: Why getter and setter methods are evil via GetterEradicator.

This entry was posted in Code Smells and tagged , , . Bookmark the permalink.

One Response to Why getter and setter methods are evil

  1. pce says:

    hihi, thats the way i do it.

    Keep properties private, because i read they should private😉

    Procedural languages don’t have classes, but they do have the C struct (think: class without methods). It seems natural, then, to mimic a struct by building class definitions with virtually no methods and nothing but public fields. These procedural programmers read somewhere that fields should be private, however, so they make the fields private and supply public accessor methods. But they have only complicated the public access. They certainly haven’t made the system object oriented.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s