What should I call the umbrella type safe?

It "always" bothered me ...

Let's say I have an IFiddle interface and another interface that does nothing more than a collection of several different IFiddle s:

 public interface IFiddleFrobbler { IFiddle Superior { get; } IFiddle Better { get; } IFiddle Ordinary { get; } IFiddle Worse { get; } IFiddle Crackpot { get; } } 

(The specific IFiddleFrobbler and IFiddle are configuration dependent and are created using factory.)

I repeatedly come across the name of such "umbrella" types - I want to exchange "Frobbler" for something descriptive.

  • The "Collection", "List" and "Set" are not good enough in the sense that this is not a collection / list / set where items can be listed, added or deleted.
  • There is no "manager" because management is not performed - factory and configurations handle this.
  • The “aggregator” makes it sound like it’s selected directly from the GoF book (although I don’t think they will break the “law of the demeter” - this is from the topic here).

Please enlighten me, what is a good naming scheme for my umbrella types?


Edit: As xtofl pointed out in a comment , there is actually more semantics than I first showed above. If I do the following instead, I think my need is clearer:

 // // Used for places where the font width might need // to be tapered for a rendered text to fit. // public interface ITaperableFont { Font Font { get; } Boolean CanTaper { get; } void Taper(); } // // Used for rendering a simple marked-up text in // a restricted area. // public interface ITaperableFonts { ITaperableFont Biggest{ get; } ITaperableFont Big { get; } ITaperableFont Normal { get; } ITaperableFont Small { get; } ITaperableFont Smallest { get; } } 

In fact, I defined my problem in addition to the real life above as a design flaw, not a naming problem, the smell of which several people have indicated below.

+7
c # oop naming-conventions naming
source share
5 answers

I would say that the name you choose should depend on what you are trying to achieve. In the code example, I would say that you are setting the rating, so I would call it IFiddleRating

As a general answer, I would say: “It depends” :) I find it a good idea to name the material after what it is trying to do, and not what it “is”

+3
source share

Can you just use the plural: IFiddles ?

+7
source share

I agree with you that it is really difficult to name a class, interface or abstract class. Some possible names that I used before you want are the following:

  • xxx Assistant
  • Composite xxx
  • xxx Coordinator
  • xxx Group
+7
source share

As Pop said: “If you cannot name it, then I smell something suspicious of design.”

may rethink your design.

 IFiddles : IDictionary<SomeType, IFiddle> { } 

Update. If you want it to be just to create an interface for this yourself:

 IReadOnlyDictionary<TKey,TValue> { TValue this[TKey] { get; } int Count { get; } ... } 

Your life can still be as easy as before.

+3
source share

I think that this is really a problem of personal preferences, so I activated the thesaurus and looked for synonyms for "Family" (which could be in itself).

gender, classification, genre, group, view, division, association, affiliation, alliance, clan, clique, club, coalition, combination, combo, confederation, confederation, congress, cooperative, family, federation, scholarship, fraternity, gang, guild, league, crowd, order, organization, ring, society, fortune telling, fraternity, syndicate, binding, binding, tribe, troops, troupe, zoo

I dropped a few who have a certain technical meaning (e.g. pool, ring, pool) ... choose what you like best.

+1
source share

All Articles