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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:31:46+00:00 2026-05-31T22:31:46+00:00

I don’t think I need to post my code (there’s lots of it) but

  • 0

I don’t think I need to post my code (there’s lots of it) but I’m happy to if prompted.

I am creating a distributed racing game in Java which currently has JFrame, JPanel and Car classes. I’m seeking the best way to implement the next stage which is the distributed part – I’m using TCP/IP rather than UDP as this is basically part of the requirements so there’s no need to comment on that.

So I’m questioning client and server sockets, streams and buffered readers etc.

For, I guess you could say, best practice – I’m wondering if I should start the implementation by having it all separate from main for elegance and possibly extensibility etc.

  • 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-31T22:31:47+00:00Added an answer on May 31, 2026 at 10:31 pm

    In general you are looking to use OO for separation of concerns. This means you divide what needs to be done in several manageable chunks. Then you decide on a clean understandable interface for each chunk, which hides the implementation details that aren’t relevant to the user of the class.

    In your case the reasoning could go something like this ( but it is entirely up to the problem you have).

    1. One class is handling the connecting/disconnecting and returns an simple object that represents a message sent or received. This class knows nothing or little about the contents sent over the line, but it knows how to set up a connection and what to do with a disconnect.
    2. The next class in line converts the simple message objects to useful objects with convenience methods that are easy to handle.
    3. Another class is responsible for putting these objects to effect.

    Of course when one of these tasks gets too big you can split them up even further.

    In most cases this will result in one object managing one socket.

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

Sidebar

Related Questions

Don't think there's much to say, here's my code for (int i = 0;
Don't know how to google for such, but is there a way to query
Don't ask me why but I need to do the following: string ClassName =
I don't know why, but this code worked for me a month ago... maybe
Don't ask why, but is there any way to suppress a failed linking error?
Don't ask me why but i can't use this method because I need to
Don't ask how I got there, but I was playing around with some masking,
Don't need to do this right now but thinking about the future... What would
don't know better title for this, but here's my code. I have class user
Don't know how to frase this but I found this code wich works as

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.