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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:14:53+00:00 2026-05-22T15:14:53+00:00

I’m in the process of designing a .NET library and I’m looking for some

  • 0

I’m in the process of designing a .NET library and I’m looking for some feedback concerning class organization and namespaces.

Suppose that I have an abstract Message class that is in the root namespace Foo. Message has many concrete implementations for different message types. Given that there will be many concrete implementations (let’s assume 20, or even more), is it expected that these concrete types live in a separate namespace, something like Foo.Messages?

I’m worried about cluttering the namespace with too many concrete Message classes that users of my library will rarely need to use directly. What are you expectations when using a library?

edit:

Also, if I do group the concrete classes into Foo.Messages, should the abstract class live there as well, or should that remain in Foo?

  • 1 1 Answer
  • 2 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-22T15:14:54+00:00Added an answer on May 22, 2026 at 3:14 pm

    Kind of a loaded question, but if the issue is having too many classes hampering discoverability, is part of the solution perhaps making some of these classes internal rather than public? If users won’t ever instantiate these directly, that might be part of the solution to your clutter problem.

    It really does depend quite a lot on the nature of the API you’re designing, and to some degree on taste. Often there’s a single primary class or set of classes that your users will be going straight to most of the time, like NLog’s Logger, or AutoMapper’s Mapper, or NoRM’s Mongo, or class factories in general. Those should be front and center and discoverable, and you could make a strong case that it’s best to have that in your root namespace.

    For other classes (ones that are more about the implementation and less about the API), obviously you want to be organized, but you can play with a pretty free hand and organize in a way that feels natural to you, as long as the parts of the API that users need to find are the most visible. Foo.Messages seems like a totally reasonable way to start. On the other hand, if 90% of your classes are Message subclasses, but there’s an important distinction between Server messages and Client messages, or Purple messages and Plaid messages, maybe Foo.Server or Foo.Plaid are the right kinds of namespaces for you.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have thousands of HTML files to process using Groovy/Java and I need to
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.