Cargo cult programming – Wikipedia, the free encyclopedia

metagorgon:

wrapscallion:

“Cargo cult programming is a style of computer programming characterized by the ritual inclusion of code or program structures that serve no real purpose.”

GETTERS AND SETTERS THAT DO NOTHING BUT WRAP VARIABLES THAT COULD BE PUBLIC

I will defend that practice!

if double price is public, I can never do anything with price.

If setPrice() is public, I can later e.g. switch from updating the price once per day on a timer to updating the price every time setPrice() is called.

So get/set for primitive variables does have a purpose: The redirecting layer allows me to expose an interface to you without forever being tied to the explicit implementation beneath. It might not do anything today but it keeps the technical debt lower.

Cargo cult programming – Wikipedia, the free encyclopedia

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