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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:08:12+00:00 2026-06-15T22:08:12+00:00

This question has been bothering me for quite a while: I have a Room

  • 0

This question has been bothering me for quite a while:

I have a Room class, and lets say I want to add a Ball entity.

Ball should have x and y coordinates that represents a location in this room.

So here is the question:

What class should hold the coordinates?

1) Each Ball for it self.

2) The Room will hold the coordinates of every Ball.

I know that it’s probably doesn’t matter much, but what is preferred choice or what is more popular?

EDIT:

What I’m actually worried about, is that object can change it’s content however it like, so having it limited by some third party would solve it. But I guess it’s only valid for applications with multiple users, not my case.

  • 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-15T22:08:13+00:00Added an answer on June 15, 2026 at 10:08 pm

    When it comes to object design, one of my starting mantras is “the object knows everything about itself“. Imagine the Ball having to ask the Room – where am I? I would start with the Ball holding it’s coordinates. This way the Room only has to know about itself and a collection of Ball objects. Conversely the Ball knows everything about itself. Any details the Room may need about Ball coordinates can be gathered by iterating the the collection. When you get around to adding other objects to your room, you’ll impact your design a lot less as well.

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

Sidebar

Related Questions

I am New to Spring.I have this question which has been bothering me for
This question has been bothering me for a while. I see alot of people
I'm new to this forum, and I have a question that has been bothering
This question has been bothering me for a while. If I do int* a
This question has been bothering me for a while now. Let's consider the two
Ok so this question has been bothering me for some time. I'm running a
This is a question that has been bothering me for sometime. My application uses
This problem has been bothering me for sometime now, I have not settled on
This question has been on my mind for a while. I used C++ for
This question has been asked before in a more general way. I want to

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.