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 4072076
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:50:19+00:00 2026-05-20T16:50:19+00:00

Is it possible to somehow simplify an interface? The goal is to provide a

  • 0

Is it possible to somehow simplify an interface? The goal is to provide a noise-reduced API for the user thats going to use it.

An example could be that the interface IFoo has 25 methods defined and I only want to expose 5 of them to the user, how would I do that in a clever and elegant way?

  • 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-20T16:50:20+00:00Added an answer on May 20, 2026 at 4:50 pm

    You can’t. An interface is by definition public on all the methods. That’s why it is called a contract.

    Try splitting it into a number of interfaces:

      IBaseFoo (5 methods)
      IFoo : IBaseFoo  (20 more methods)
    

    This is how it is commonly practiced. However, you cannot prevent the user form knowing your 20 other methods, unless you make IFoo a private interface.

    Then you write a wrapper class which just exposes IBaseFoo to the user. IFoo can be cast directly into an IBaseFoo to be returned to the user.

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

Sidebar

Related Questions

Is it possible to somehow use a .bat file to script the schema and/or
is it possible somehow to use the NOW() function or something similar in MYSQL
Is it possible somehow to ask the user to allow cross-domain access instead of
Is this possible somehow? @Name(geolocationService) public interface GeolocationService { @Query(SELECT g FROM Geolocation geolocation
Is it possible somehow to close StreamReader after calling ReadToEnd method in construction like
is it somehow possible to call a rails function or to access a rails
Is it somehow possible on Swing to set a TitledBorder transparent so that a
Is it somehow possible to customize or subclass System.Windows.Forms.ColorDialog to add a few buttons?
Is it possible to somehow mark a System.Array as immutable. When put behind a
Is it possible to somehow change the look/feel of NetBeans? I know it uses

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.