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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:17:29+00:00 2026-05-13T06:17:29+00:00

So this question is a sort of follow on from here ( how to

  • 0

So this question is a sort of follow on from here (how to deal with multiple event args). That question led me onto thinking about this but is different enough to warrant its own thread.

I am creating a game (for fun and learning purpose) and would like to know if I am using good standards for design or not. I think I might have gone OTT on separation of concerns, or just got the whole thing wrong, but I am hoping that isn’t the case. I have no problem rewriting it as I want to learn “best practices” and the practical application of them.

EDIT

Let me explain a little more about the game, It is based on Jawbreaker a game found on many mobile phones (quick demo found here). Objective is to select balls that are in groups to remove them from play and score as many points as possible.

I am trying to expand it a little and have different types of boards, balls move in different ways, and different ball types, the balls may just go where they are told to, or they might do something along the way.

So Here is the structure of the objects I have created, top row shows the DLL’s with their Objects, second row shows what those objects reference:

alt text
(source: ggpht.com)

Here is my attempt at doing the UML:

alt text http://yuml.me/3279d2ac

Click here to link to full page for UML, makes it a little larger and hopefully easier to read

The Objects DLL holds the basic objects used in the game, Balls and a Board. They do not contain any logic about how they act / react to situations (the ball does implement the CompareTo and the Equals methods). There could be X number of implementations of IBall (and the same for IBoard, although there will not be that many I imagine).

The InstanceManager DLL is used as a way of Creating Objects, not sure this was 100% needed it could have gone in the Objects DLL. The Factories are static classes that have various overloaded methods to create IBall objects. The BallFactory can take the BallType Enum, A Drawing.Color object, etc. The BoardFactory is very similar. Jawbreaker is a singleton object that deals with things like holding a Random Object as it is used very regularly and some GameConfiguration data, (not so relevant to this topic).

The Engine DLL is where most of the work happens. The LogicFactories take the BallType and BoardType objects to create the relevant Logic Objects. The logic objects are used to control how an IBall and IBoard object works. The BallLogic tells the ball what it can do when its events fire. For example when a Ball is selected a method is called on the Ball Logic saying Ball X on Board Y has been selected. The Ball can then do whatever its type of ball should / could do. The BoardLogic is very similar and deals with how the board acts.

The Engine Object is another singleton and is how the GUI would interact with the whole game. The GUI would not instantiate any of the other objects directly.

So to summarize the IBall and IBoard classes hold just the data about them, the Logic classes deal with all the functionality.

What I would like to know is:

1) Is this a sensible approach?

2) Should (in general) Logic be separate from the Objects / data?

3) Have I gone too far with the separation of concerns?

4) Any other comments about the design / structure

EDIT

The reason I have used a couple of singletons is partly for simplicity of accessing the data in one place without keeping hold of objects all the time and also just because it is a single game and will not be scaled to either high end or across multiple machines. I do understand that they are not great and its not something I use regularly, but appreciate the comments.

Thank you for your thoughts and feedback.

  • 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-13T06:17:30+00:00Added an answer on May 13, 2026 at 6:17 am

    It’s hard to critique your design without a better idea of what you are trying to do. I know that it involves balls and boards, but other than that, I have no idea.

    Try to avoid singletons as much as possible. Yes, I know that the GoF book lists it, and I know that it is a common pattern, but in my experience it ends up becoming an anti-pattern.

    You mention that IBall and IBoard don’t have any logic about how they interact. Does that imply that they don’t have any methods? Are their methods just getters and setters for their private data? If IBall and IBoard are just structs (or their equivalent), then they don’t need to be interfaces. Could you flesh out your description to talk about the kinds of messages that you can send to an IBall and to an IBoard?

    2) Should (in general) Logic be separate from the Objects / data?

    Sometimes. If you have plain old data, then separating the logic from the plain data is fine. Of course, then you’re not doing OOP anymore – you are writing procedural code. I think you’re struggling with the desire to not hard-code any behavior into Ball. Perhaps some other entity should be responsible for deciding how balls interact, but you still have room for Ball to participate in the decision. This is where the strategy pattern (among other patterns) would come into play. Think about how things work in the real world – how would a physical ball and a physical board coordinate their interactions? If they talked to each other, what would they say? See if you can implement that in your code.

    Finally, a word about design. I think it’s good to want to “get the design right.” On the other hand, that’s the path towards becoming an architecture astronaut. Consider what problems you currently have with your code base.

    • Is it hard to refactor?
    • Is it hard to add new types of things?
    • Is too much “hard-wired”?

    Design doesn’t exist in a vacuum – it is informed by the current state of the world. Just look at some of the crazy cell phone concept art that people come up with, and you’ll see good examples of bad design. Cell phones are limited by current technology, and designs that ignore the restrictions of the real world are nothing more than dreams. The same is true in software. Pay attention to what the code is telling you it needs, and you’ll do fine.

    The more software you write (and finish), the more experience you will have, and the better your sense of aesthetic will become. Don’t let fear of “doing it wrong” stop you from finishing your software. Persevere, make it work, and then see what you learned from the process.

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

Sidebar

Related Questions

This question is sort of a follow-up to my original question here . Let's
I know that this sort of question has been asked here before, but still
My question is sort of a follow on from this question below but I
This is sort of a follow on from my last question. I am using
This is sort of a follow-up to this question . If there are multiple
This question is a (sort of) follow-up to Intercepting/Rerouting TCP SYN packets to C++
This question is sort of a sequel to that question. When we want to
James here. This question relates (sort of) to the one I posted a little
This is sort of the Java analogue of this question about C# . Suppose
This is sort of a secondary question to my question here but it was

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.