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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:55:21+00:00 2026-05-16T16:55:21+00:00

Suppose I’m making a new library, Jokes, with a small API. In the interest

  • 0

Suppose I’m making a new library, Jokes, with a small API. In the interest of making my API easy to use I put it in the base namespace:

namespace Jokes

    --> public interface IJoker
        --> string Joke();

    --> public static class Jokers
        --> public static IJoker NewSlapstickJoker()
        --> public static IJoker NewAbsurdJoker()
        --> public static IJoker NewCheesyJoker()

The implementations of the Jokers are internal:

--> internal class SlapstickJoker : IJoker
--> internal class AbsurdJoker : IJoker
--> internal class CheesyJoker : IJoker

Now I’m pretty sure the following is a guideline to follow (could someone please verify?):

  • Do not access types from subnamespaces from the root namespace. (For example, the types in System are ignorant of types in System.Drawing).

Does this guideline apply to internal classes? To avoid polluting my root namespace, I would like to put my internal classes in Jokes.Internal. This would mean that a type in the Jokes namespace (Jokers) would know about types in the subnamespace Jokes.Internal. Is this ok?

  • 1 1 Answer
  • 4 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-16T16:55:21+00:00Added an answer on May 16, 2026 at 4:55 pm

    To avoid polluting my root namespace, I would like to put my internal classes in Jokes.Internal. This would mean that a type in the Jokes namespace (Jokers) would know about types in the subnamespace Jokes.Internal. Is this ok?

    Yes, that’s fine. The main guidance about not having types in a namespace rely on types within a “sub” namespace really is more about the public API. The internal classes, and namespaces used only by internal types, is really an implementation detail, and outside of any guidance of the sort.

    I would stick to something consistent that you find makes sense. Using an Internal namespace seems reasonable (though I’d potentially do something like namespace Jokes.Implementations).

    Also, given that your Jokers class is constructing new instances, it’s basically a factory. You might want to consider naming something more like JokerFactory to make this obvious. Jokers, to me, would suggest that there would be a collection of Joker instances contained within the class, not a set of factory methods.

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

Sidebar

Related Questions

Suppose I have a pure virtual method in the base interface that returns to
Suppose I have a simple model, such as Record: @Model public class Record {
Suppose we have the Lyric model: class Lyric < ActiveRecord::Base belongs_to :song end and
Suppose the following constructor: class Needed { public: Needed () {} Needed (const char
Suppose a process spawns a thread A and this thread further spawns a new
Suppose I have a ASP.NET Web API controller that uses a service, which in
Suppose I have the following code: namespace x{ class X{ virtual void x(){} }
Suppose I have a stringbuilder in C# that does this: StringBuilder sb = new
Suppose I define an export in AssemblyA: [Export(typeof(Foo))] public class Foo { ... }
Suppose you have the following object hierarchy: class Vehicle { public: virtual ~Vehicle() {}

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.