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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:35:33+00:00 2026-06-10T09:35:33+00:00

If I have an interface for a Server like this… interface IServer { void

  • 0

If I have an interface for a Server like this…

interface IServer
{
    void Login();
    void Post();
    void Get();
}

…where Post and Get don’t work unless you’ve done Login first. Is it a semantic violation of encapsulation, since it makes your use of the interface implicitly dependent on the implementation? How would you fix it?

  • 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-06-10T09:35:35+00:00Added an answer on June 10, 2026 at 9:35 am

    My idea:

    interface IServer 
    {
        ISession Authenticate();
    }
    
    interface ISession 
    {
        IServer Server{get;}
        void Post();
        void Get();
    }
    

    Ignore that if you are accessibly of “mud”:

    [MUD]

    to clarify this: imho you have to think about software design as you
    would create a product… do you really want a safe for all your
    valueable things where you can push a button “open” instead of FIRST
    input the code on it? this is just an analogy for your use-case…

    an implementator can just call post and get before he validates…

    another widely used approach are access-tokens and the use of it like
    here:’

    interface IServer{ // returns the required token string
    Authenticate(); void Post(string token); void Get(string token);
    }

    but i think, that’s wrong too…

    you can see and maybe call methods, which you are not allowed to
    see/call before login… if the implementator just not checks if
    “token” is correct, you have a security risk in here…

    if you divide the logic into several layers (guest/unauthenticated,
    authenticated/session, and (for example) adminsession) you get clean
    separation of logic and a lot more semantic usefullness….

    I PERSONALLY write code EVER in way, that good framework-builders would write code… it has the be reuseable, even after years, very
    easy and clear.

    [/MUD]

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

Sidebar

Related Questions

I have a ServiceContract on the server like this: [ServiceContract] public interface ICheckService {
I have an interface like this public interface IField<T> extends IsSerializable { public String
I have an NSArray which contain objects. my Objects are like this : @interface
I have several server controls that implement the IValidator interface. As such, they have
I have interface Foo public interface Foo { public void test(); } Class FooChild
I'm trying to figure out why this code won't compile. I have interface A
I have a URL that resides on another domain, like this: http://ads.adserver.com/ad?site=1233&zone=45435 When you
I have a simple resftul wcf service. The .svc file looks like this <%@
I have a defined idl file, which looks like this: module Banking { typedef
I have this code: @interface MyBusinessesController : UIViewController { NSDictionary *businesses; NSArray *items_array; }

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.