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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:29:28+00:00 2026-05-28T07:29:28+00:00

I am building out my domain model and continuing to refactor it. As I

  • 0

I am building out my domain model and continuing to refactor it. As I do, I am finding that I like interfaces as it allows me to create reusable methods/controllers/views for concrete types based on their interfaces. However, I am finding that I am creating an interface every time I add a new property to one of my domain entities.

For example, I have a MemberStatus object which inherits from an abstract Entity object which in turn implements the IIdentifiableEntity interface meaning that it has an Id property. MemberStatus also implements the INamedEntity interface meaning that it has a Name property, the IOrderedEntity interface meaning that it has a DisplayOrder property and the IHasMembers interface meaning that it has a collection Member objects. Here’s the code:

public class MemberStatus : Entity, INamedEntity, IOrderedEntity, IHasMembers
{
  public string Name { get; set; }
  public float DisplayOrder { get; set; }
  public ICollection<Member> Members { get; set; }
}

public abstract class Entity : IIdentifiableEntity
{
  public int Id { get; set; }
}

public interface IIdentifiableEntity
{
  int Id { get; set; }
}

public interface INamedEntity
{
  string Name { get; set; } 
}

public interface IOrderedEntity
{
  float DisplayOrder { get; set; }
}

public interface IHasMembers
{
  ICollection<Member> Members { get; set; }
}

Now, this seems to work fine as I other similar objects such as MemberPosition and MemberTeam which all implement these same interfaces and I can use my repository methods and controller actions with generics that implement these interfaces and have a lot of code reuse.

However, my concern is whether or not it’s appropriate to keep adding simple, one-property interfaces every time I add a new property to my concrete objects. For example, let’s say I want to add a bool Enabled property… should I continue to create a IEnabled interface? The reason I’m asking is that some of controller “initializers” that are using generics are becoming very long as shown in the following line of code. Is this normal and best-practice?

public abstract class OrderedCrudController<TEntity> : CrudController<TEntity> where TEntity : Entity, INamedEntity, IOrderedEntity, IHasMembers, new()
  • 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-28T07:29:29+00:00Added an answer on May 28, 2026 at 7:29 am

    The fact that you are using interfaces is a good thing. However, you should ask yourself, if I create an IEnabled interface, will I ever reference my class by that interface alone? i.e. will there be contexts where I interact with my class purely via the single property that interface exposes?

    Also, can you consider contexts where you will interact with multiple implementation of this IEnabled interface?

    If the answer to both of these question is “no”, then the interface serves very little purpose.

    Having said that, please don’t worry too much about this! it does very little harm.

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

Sidebar

Related Questions

We're finally building a domain model. The domain model includes interfaces for loosely coupling
So no doubt that building a domain model is something that I think happens
I'm currently building out a Drupal site that is an aggregate of local housing
We're building a text templating engine out of a custom HttpModule that replaces tags
I'm building out a Grails app and realize that a lot of custom stuff
I'm working with a new application at work that we're building out using Knockout.js
I'm building out an API for web app that I've been working on for
I am building out some reporting stuff for our website (a decent sized site
We were building out the next version of an in-house thick-client application using WPF/Prism
I'm building out a medium-sized application using Sinatra and all was well when I

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.