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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:10:05+00:00 2026-05-10T20:10:05+00:00

As I mention in an earlier question, I’m refactoring a project I’m working on.

  • 0

As I mention in an earlier question, I’m refactoring a project I’m working on. Right now, everything depends on everything else. Everything is separated into namespaces I created early on, but I don’t think my method of separtion was very good. I’m trying to eliminate cases where an object depends on another object in a different namespace that depends on the other object.

The way I’m doing this, is by partitioning my project (a game) into a few assemblies:

GameName.Engine GameName.Rules GameName.Content GameName.Gui 

The GameName.Engine assembly contains a bunch of interfaces, so other parts of the program don’t need to depend on any particular implementation. For instance, I have a GameName.Engine.ICarryable interface that is primarily implemented by GameName.Content.Item class (and its sub-classes). I also have an object to allow an Actor to pick up an ICarryable: PickupAction. Previously, it required an Item, but this exposes unneccessary methods and properties, where it really only needed the methods required to pick it up and carry it. That’s why I’ve created the ICarryable interface.

Now that’s all good, so to my question. GameName.Gui should only depend on GameName.Engine, not any implementation. Inside GameName.Gui I have a MapView object that displays a Map and any IRenderable objects on it.

IRenderable is basically just an interface that exposes an image and some strings describing the object. But, the MapView also needs the object to implement ILocateable, so it can see its location and know when it’s changed via an event, LocationChanged, inside ILocateable.

These two interfaces are implemented by both Item and Actor objects. Which, again are defined in GameName.Content. Since it needs both interfaces, I have two choices:

  1. Make GameName.Gui depend on GameName.Content and require an Entity (base-class of Item and Actor).

  2. Make an interface inside GameName.Engine that looks like this:

    interface ILocateableRenderable : ILocateable, IRenderable { } 

    And then make my Actor and Item objects implement that interface instead of the two individually.

Anyone have any suggestions on which method is the best? Is it appropriate to create an interface with no methods or properties, that only enforces implementing two other interfaces?

Clarification: MapView works on a Map, which is composed of Entity objects. I don’t want to expose the Entity objects to the MapView, it only needs to know their location (ILocateable) and how to render them (IRenderable).

  • 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. 2026-05-10T20:10:06+00:00Added an answer on May 10, 2026 at 8:10 pm

    You seem to have two conflicting requirements:

    Inside GameName.Gui I have a MapView object that displays a Map and any IRenderable objects on it.

    and

    But, the MapView also needs the object to implement ILocateable, so it can see its location and know when its changed via an event, LocationChanged, inside ILocateable.

    So, if the MapView only needs IRenderable, then it should accept IRenderable and then check whether the class also implements ILocateable. In this case use its methods.

    public void Whatever(IRenderable renderable) {    if (renderable is ILocateable)    {       ((ILocateable) renderable).LocationChanged += myEventHandler;    }     // Do normal stuff } 

    On the other hand, if you always need it to be ILocateable and IRenderable, then you should really create a derived interface in one of two ways Either

    interface IMappable: IRenderable, ILocateable {}  public void Whatever(IMappable mappable) {    mappable.LocationChanged += myEventHandler;     // Do normal stuff }     

    or

    interface IRenderable: ILocateable {   // IRenderable interface }   public void Whatever(IRenderable renderable) {    renderable.LocationChanged += myEventHandler;     // Do normal stuff }   

    depending on how your code is at the moment.

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

Sidebar

Related Questions

As I mention in an earlier question , I am having trouble with the
I'm working from a question I posted earlier ( here ), and trying to
im making a mention system like the one in facebook, right now I achieved
I am sorry for not giving enough information earlier,I will mention a few things
Hello nice computer persons, Per to a question I had earlier concerning accessing the
I am currently working on a c# project, where I need to access Outlook.
Hi I posted a question a little earlier and I had some replies that
This earlier SO question talks about how to retrieve all files in a directory
I am trying to work on a project in Visual Studio 2008 Professional. Earlier,
So I have been working on a project for a client on their current

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.