I see you’ve defended the use of getters and setters. What do you think of how field accessors in Kotlin call the applicable getter, if one exists, and returns the field if one does not?

Ceterum censeo Javascriptem esse delendam.

But past that – if a field doesn’t have a get(), it’s not supposed to be touched, it’s the OoP equivalent of a sticker that says “No user serviceable parts inside.”

You can still do it of course, but if I get any bug reports on my API that include “DLL crashed my program when I tweaked the internal state of the class, and…” those will get closed as “feature, not bug.” You should thank me for ensuring the program stopped pretending to work after the internal state became inconsistent.

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s