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

  • Home
  • SEARCH
  • 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 3489512
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:24:13+00:00 2026-05-18T11:24:13+00:00

So yeah, the question basically says it all. What do you gain when you

  • 0

So yeah, the question basically says it all. What do you gain when you ensure that private members / methods / whatever are marked private (or protected, or public, or internal, etc) appropriately?

I mean, of course I could just go and mark all my methods as public and everything should still work fine. Of course, if we’d talk about good programming practice (which I am a solid advocate of, by the way ), I’d mark a method as private if it should be marked as such, no questions asked.

But let’s set aside good programming practice, and just look at this in terms of actual quantitative gain. What do I get for proper scoping of my methods, members, classes, etc.?

I’m thinking that this would most generally translate to performance gains, but I’d appreciate it if someone could provide more detail about it.

(For purposes of this question, I’m thinking more along C#.NET, but hey, feel free to provide answers on whatever language / framework you deem fit.)

EDIT: Most pointed out that this doesn’t lead to performance gain, and yeah, thinking back, I don’t even know why I thought that. Lack of coffee probably.

In any case, any good programmer should know about how proper scopes (1) help your code maintenance / (2) control the proper use of your library / app / package; I was kinda curious as to whether or not there was any other benefit you get from it that’s not apparently obvious outright. Based on the answers below, it looks like it basically sums up to just those two things most importantly.

  • 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-18T11:24:14+00:00Added an answer on May 18, 2026 at 11:24 am

    Performance has absolutely nothing to do with the visibility of methods. Virtual methods have some overhead, but that’s not why we scope. It has to do with maintenance of code. Your public methods are the API to your class or library. You as a class designer want to provide some guarantee to the outside world that future changes aren’t going to break other peoples code. By marking some methods private, you take away the ability for users to depend on certain implementations which allows you freedom to change that implementation at will.

    Even languages that don’t have visibility modifiers, like python, have conventions for marking methods as internal and subject to change. By prefixing the method with an _underscore(), you’re signalling to the outside world that if you use that method, you do so at your own risk, as it can change at any time.

    On the other hand, public methods are an explicit entry way into your code. Every effort should go towards making public methods backward compatible to avoid the pitfalls I described above.

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

Sidebar

Related Questions

yeah :( simple question * blush * Lets imagine i have the following enumeration:-
Yeah quite a specific question. I'm making a bot for Google Wave and I'm
Yeah, it's a homework question, so givemetehkodezplsthx! :) Anyway, here's what I need to
Yeah, poorly worded question, but I really wasn't sure how to phrase it. :)
Yeah, I know this seems like a dumb question, its just a one-off hack
Yeah, sorry about asking a stupid n00b question. So I have a C# program.
Before you tell me that there is already a similar question, yes, i know,
Yeah, its a bit on this side of pointless, but I was wondering... I've
Yeah, sounds silly but I'm a designers and the site I'm working on is
So yeah, I'm a Java guy in this crazy iPhone world. When it comes

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.