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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:23:24+00:00 2026-06-04T06:23:24+00:00

If I have a set of interfaces which may have several implementations (i.e. in-memory,

  • 0

If I have a set of interfaces which may have several implementations (i.e. in-memory, NHibernate, xml-based, etc.), is it wise to provide namespace hints in the class names themselves? For example:

MyDomain.Infrastructure.ISomeProvider
MyDomain.Infrastructure.ISomeOtherProvider
MyDomain.Infrastructure.IYetAnotherProvider

I might then have:

MyDomain.Infrastructure.Impl.MemoryBased.SomeProvider
MyDomain.Infrastructure.Impl.MemoryBased.SomeOtherProvider
MyDomain.Infrastructure.Impl.MemoryBased.YetAnotherProvider
MyDomain.Infrastructure.Impl.XmlFileBased.SomeProvider // etc...
MyDomain.Infrastructure.Impl.NHibernate.SomeProvider // etc...

vs.

MyDomain.Infrastructure.Impl.MemoryBased.MemoryBasedSomeProvider
MyDomain.Infrastructure.Impl.MemoryBased.MemoryBasedSomeOtherProvider
MyDomain.Infrastructure.Impl.MemoryBased.MemoryBasedYetAnotherProvider
MyDomain.Infrastructure.Impl.XmlFileBased.XmlSomeProvider // etc...
MyDomain.Infrastructure.Impl.NHibernate.NHibernateSomeProvider // etc...

In the second case, it’s clear which implementation I am using anywhere in my code by the class name itself, but it seems a bit redundant to group them by namespace and then include it in the class name anyway, no?

A third option might be:

MyDomain.Infrastructure.ISomeProvider
MyDomain.Infrastructure.Impl.MemoryBasedSomeProvider
MyDomain.Infrastructure.Impl.MemoryBasedSomeOtherProvider
MyDomain.Infrastructure.Impl.MemoryBasedYetAnotherProvider
MyDomain.Infrastructure.Impl.XmlSomeProvider // etc...
MyDomain.Infrastructure.Impl.NHibernateSomeProvider // etc...

I have eliminated the redundant namespaces, but now the only way to group / organize the classes is by class name prefix. I suppose I could separate them into folders and manually adjust the namespaces in any newly created files. Are there any clear advantages for one of these styles over the others?

  • 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-04T06:23:25+00:00Added an answer on June 4, 2026 at 6:23 am

    Option #1

    MyDomain.Infrastructure.Impl.MemoryBased.SomeProvider
    MyDomain.Infrastructure.Impl.MemoryBased.SomeOtherProvider
    MyDomain.Infrastructure.Impl.MemoryBased.YetAnotherProvider
    MyDomain.Infrastructure.Impl.XmlFileBased.SomeProvider // etc...
    MyDomain.Infrastructure.Impl.NHibernate.SomeProvider // etc...
    

    Would be my preferred option. You could argue that you should have them in different projects per implementation (In memory, ORM, XML) and then the required implementation could be loaded in at runtime depending on your IoC container and requirements at the time.

    To mess around with namespaces and add in the type of implementation in the name of the class is overkill and will make your namespaces look pointless to external/other developers.

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

Sidebar

Related Questions

I have a set of different interfaces and I need to give them access
I have written a set of classes and interfaces that are implemented in Moose
I have the following Interfaces: public interface ITemplateItem { int Id { get; set;
I work with an application that uses a large set of xml interfaces for
I have my domain model with several NewsType's which are subclasses of NewsItem as
I have a build.xml which imports other ant xml files. I'd like to get
I have a set of objects that I want to conform to an interface,
I have a XIB set up like in this screenshot: alt text http://emberapp.com/jxpx777/images/interface-builder/sizes/m.png File's
I have the following scenario: public interface IParam { Object Value {get;set;} } public
i have one interface like, public interface Details { int Id { get; set;

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.