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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:45:29+00:00 2026-06-01T09:45:29+00:00

Scenario: a game with a board, and several tiles on it. Classes: Board ,

  • 0

Scenario: a game with a board, and several tiles on it. Classes: Board, Tile, Player and of course, Game.
Whenever the player presses a tile, his score gets incremented by 1. Board is instantiated inside of Game, and an array of Tile is instantiated inside of Board. My first option to increment that score easily was to make a public static class with a public static field (Score). Of course, it’s rather amateurish. And seemed to break the overall flow of the app.

After some thought, I changed everything to use Events; Tile raises an event when clicked; Board handles that event, and raises another event to the main Game class. Player is instantiated inside of Game; when Game handles the event received from Board, it does a PlayerOne(instance of Player).Score += 1;

Should I just go on ahead and use this flow? Do you have any other architecture/design ideas that would work better? Why would your ideas work better?
I didn’t use custom made events intensively before and I feel that the whole event raising another even idea might be a bit wrong. From afar though, it looks like a good flow. And it certainly does the job correctly.

  • 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-01T09:45:30+00:00Added an answer on June 1, 2026 at 9:45 am

    You should have provided some code.

    Should I just go on ahead and use this flow?

    Depends on what the events look like.

    Do you have any other architecture/design ideas that would work better?

    Publish/Subscribe is an alternative. But the .NET events works fine here.

    I didn’t use custom made events intensively before and I feel that the whole event raising another even idea might be a bit wrong.

    It’s fine to keep encapsulation. I would do something like:

    class Tile
    {
        public event EventHandler Clicked = delegate{};
    }
    
    class Board
    {
        private void OnTileClick(object source, EventArgs e)
        {
            var tile = (Tile)source;
            //doSome
    
            var args = new CustomEventArgs();
            CustomEvent(this, args);
        }
    
        public event EventHandler<CustomEventArgs> SomeEvent = delegate{};
    }
    
    public class SomeCustomEventArgs : EventArgs
    {
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following scenario: Game has GameUID, GameName Player has PlayerUID, PlayerName GamePlayer
I have the following scenarios: Scenario: Create a game with valid information Given I
How can I construct this scenario? I want to build a game where the
I’m writing a server/client game, a typical scenario looks like this: one client (clientA)
Scenario, in context of a card game: User moves a card on the screen.
I have the following scenario: I'm creating a card game, and as part of
Think card game ... Computer attacks human with a card. In response, player moves
I'm developing a high score web service for my game, and it's running on
I have scenario where there are several items on a the context stack and
I am creating a stock market game on rails. Here I have a scenario

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.