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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:45:25+00:00 2026-05-10T18:45:25+00:00

I have a property called IsSecureConnection that is part of my object’s interface. This

  • 0

I have a property called ‘IsSecureConnection’ that is part of my object’s interface. This makes sense for most implementations of the interface, however, in some implementations I would like to make the property ReadOnly.

Should I omit this property from the object’s interface even though it is required by all of the implementations (though slightly different on occasion)?

Thanks!

  • 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. 2026-05-10T18:45:26+00:00Added an answer on May 10, 2026 at 6:45 pm

    It really depends on what’s most readable for your clients. I can think of a couple of options:

    1) The inherited interface, though I’m not a fan of hiding, and I think it makes it a bit ugly for any VB.NET or explicit clients to implement:

    interface IObject {     bool IsSecureConnection { get; }    // ... other interface definitions // }  interface ISecurableObject : IObject {    new bool IsSecureConnection { get; set; } } 

    2) Split the set from the property, with an inherited interface:

    interface IObject {     bool IsSecureConnection { get; }    // ... other interface definitions // }  interface ISecurableObject : IObject {    void SetConnectionSecurity(bool isSecure); } 

    3) Changing the semantics to try and acquire a secure connection, which an implementer is free to just return false from:

    interface ISecurable {    bool IsSecureConnection { get; }    bool TrySecureConnection(); } 

    4) Add an additional check property:

    interface ISecurable {    bool IsSecureConnection { get; set; }    bool SupportsSecureConnection { get; } } 

    All of these are, IMO, valid designs for certain contexts. Since I don’t have any info on the use cases, except that almost all of the time a secure connection can be established – I’d probably vote for 3. It’s easy to implement, there’s only 1 code path for clients, and there’s no exception mechanism (which is another form of coupling). You do have the danger of clients not checking the return from TrySecureConnection, but I think it has less issues than the other choices.

    If clients prefer a secure connection, but don’t require one – then 1 has the disadvantage of either requiring overloads or the client to check if their IObject is really a ISecurableObject. Both of which are kind of ugly. 2 has the same problem, but without the troublesome new/shadows trickery. However, if some clients require a secure connection, then this (or 2) is probably the way to go – otherwise, you can’t really use type safety to enforce a securable connection.

    4, while a valid design IMO (some would disagree – see reactions to IO.Stream) is easy for clients to get wrong. If 90% of implementers are securable, it’s easy to not check the SupportsSecureConnection. There’s also an implementer’s choice of either throwing an exception or discarding the IsSecureConnection = true call if it’s not supported, requiring clients to both catch and check the new value of IsSecureConnection.

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

Sidebar

Ask A Question

Stats

  • Questions 106k
  • Answers 106k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer reCaptcha May 11, 2026 at 8:59 pm
  • Editorial Team
    Editorial Team added an answer Torry helped procedure wmNCLButtonDown(var Msg: TWMNCLButtonDown); message WM_NCLBUTTONDOWN; procedure wmNCLButtonUp(var… May 11, 2026 at 8:59 pm
  • Editorial Team
    Editorial Team added an answer You need to give the proper version number. Note that… May 11, 2026 at 8:59 pm

Related Questions

I have a property called IsSecureConnection that is part of my object's interface. This
I have a c# object with a property called Gender which is declared as
Lets say I have something called Stuff in my database, with a property called
Here is my setup. In my application delegate, I have a property called currentFoo.
I have a database field called abCode , that I want to map to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.