Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 247733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:17:02+00:00 2026-05-11T21:17:02+00:00

Possible Duplicate: Allen Holub wrote “You should never use get/set functions”, is he correct?

  • 0

Possible Duplicate:
Allen Holub wrote “You should never use get/set functions”, is he correct?

Is there a good, no, a very good reason, to go through all the trouble of using getters and setters for object-oriented languages? What’s wrong with just using a direct reference to a property or method? Is there some kind of “semantical coverup” that people don’t want to talk about in polite company? Was I just too tired and fell asleep when someone walked out and said “Thou Shalt Write Copious Amounts of Code to Obtain Getters and Setters”?


Follow-up after a year:

It seems to be a common occurrence with Java, less so with Python. I’m beginning to wonder if this is more of a cultural phenomena (related to the limitations of the language) rather than “sage advice”. As I do not program in Java (currently by choice) I cannot make that assessment.

The current (current being as of this writing 2010-03-22) -1 question score is complete for-the-lulz as far as I am concerned. It’s interesting that there are specific questions that are downvoted, not because they are “bad questions”, but rather, because they hit someone’s raw nerve.

So let’s get to the nut of the matter. I repeat myself:

What's wrong with just using a direct reference to a property or method?

And here’s the unwritten corollary:

Are we so undisciplined as programmers that we can't keep our hands off of things that are clearly marked "no touchy"?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T21:17:02+00:00Added an answer on May 11, 2026 at 9:17 pm

    Here is Allen Holub (who is brilliant) on the matter. He goes into much more detail on this subject in Holub on Patterns. Some things require public getters and setters like serialization and patterns like the Data Transfer Object pattern. In general, I think necessary evil since your application becomes convoluted when you don’t use them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
Possible Duplicate: What is the “double tilde” (~~) operator in JavaScript? I found this
Possible Duplicate: What is the difference between #include <filename> and #include “filename”? I just
Possible Duplicate: New Cool Features of C# 4.0 Hello, There are several(many) questions at
Possible Duplicate: PHP get all arguments as array? Within a javascript function arguments always
Possible Duplicate: Can a Bash script tell what directory it's stored in? Is there
Possible Duplicate: Unable to get a list of installed Python modules How do I
Possible Duplicate: Singleton: How should it be used Following on from Ewan Makepeace 's
Possible Duplicate: how to use foursquare API in android application? This is a question
Possible Duplicate: Why do I get a null pointer exception from TabWidget? I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.