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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:04:48+00:00 2026-06-08T18:04:48+00:00

Concrete Example: Abstraction of a controlling unit, which could also be a remote unit

  • 0

Concrete Example: Abstraction of a controlling unit, which could also be a remote unit represented by a socket. For ease of use, I consider creating the sockets and accept()’ing already in the constructor.

However, this feels slightly weird. Such a constructor could always fail. And it could block. Is there a way that doesn’t make me uncomfortable, or is it just OO and I have to take that pill?

(This question relates especially to the trendy OO languages and the generally accepted styles used there)

  • 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-08T18:04:49+00:00Added an answer on June 8, 2026 at 6:04 pm

    While it is not necessarily bad to lock on a constructor, I would consider hiding that from the user. Something like:

    connection establish_connection();
    

    From user code, if they see:

    connection c = establish_connection();
    

    It seems sensible that a connection is established and the active connection is returned. Users expect the code to possibly fail (exception) or block, so there will be no surprises there, considering that in many libraries the creation of a socket is a non-blocking call.

    Note: in this code connection represents an active connection, the library should control whether the connection can be created directly or not, whether it can be closed (by anything other than the destructor, i.e. whether a connection object can be alive and not represent an active connection) and whether it can be copied or not and what the semantics are.

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

Sidebar

Related Questions

Can you give me a concrete example when is preferable to use private inheritance
Here's a concrete example of what I want to do. Consider the string.Join function.
In Concrete Abstractions , there is this example of recursion: (define subtract-the-first (lambda (n)
concrete example http://img246.imageshack.us/img246/602/6x7gridsm.png By address I mean the location if you were counting left
I can't find a concrete and COMPLETE example of what I'm looking for. In
I've tried searching around but there isn't something that is a fairly concrete example
I am looking for a concrete example (http://stackoverflow.com/questions/1313607/finding-the-center-point-of-a-city, for instance, contains general information, which
I've got a general question illustrated with a concrete example. How much would you
I was reading http://www.orchardproject.net/docs/Creating-1-n-and-n-n-relations.ashx and could not get the idea, if it is possible
Here is a concrete example: I create a IWeBrowser2 interface by calling wb.CoCreateInstance(CLSID_InternetExplorer, 0,

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.