Generics allow you to describe something which, when expanded, gives you a more particular something.
In this case, you can say "IFooFactoryFactoryFactoryFactory" by saying "Factory<Factory<Factory<Factory<Factory<IFooFactory>>>>>", and you don't need to create (or maintain) a separate artifact.
Interfaces which embed type information are usually a less-expressive way of saying the same thing with generics:
> Email-style angle brackets
> are used for blockquotes.
> > And, they can be nested.
> #### Headers in blockquotes
>
> * You can quote a list.
> * Etc.
Horizontal Rules
Three or more dashes or asterisks:
---
* * *
- - - -
Manual Line Breaks
End a line with two or more spaces:
Roses are red,
Violets are blue.
Fenced Code Blocks
Code blocks delimited by 3 or more backticks or tildas:
```
This is a preformatted
code block
```
Header IDs
Set the id of headings with {#<id>} at end of heading line:
## My Heading {#myheading}
Tables
Fruit |Color
---------|----------
Apples |Red
Pears |Green
Bananas |Yellow
Definition Lists
Term 1
: Definition 1
Term 2
: Definition 2
Footnotes
Body text with a footnote [^1]
[^1]: Footnote text here
Abbreviations
MDD <- will have title
*[MDD]: MarkdownDeep
FUTURE POSTS
No future posts left, oh my!
RECENT SERIES
Recording
(18): 29 Sep 2025 - How To Run AI Agents Natively In Your Database
Webinar
(8): 16 Sep 2025 - Building AI Agents in RavenDB
Comments
Oi...
umm, is
iFooFactoryFactoryFactoryFactory : Factory<Factory<Factory<Factory<Factory<IFooFactory>>>>>
and are you using it more than once?
If so, then the former; btw, what is wrong that you need such a structure?
Redesign.
I like the latter, because the syntax exposes a little more detail about the type, but this is only a matter of personal preference.
I'll tell you one thing: it is a serious PITA to do the latter in XAML and it is pissing me off at the moment!!!!!!!!
NO NO NO NO NO!!!
It's Factory<Factory<Factory<Hammer>>>
(For those who don't get it, read http://discuss.joelonsoftware.com/default.asp?joel.3.219431.12)
I would go for the double barrel shotgun. If you need more firepower, I'll see what I can do. :-p
You could SO use another factory to manage all that complexity! ;-)
I'm with Nick on this one, although it seems you're also missing an AbstractFactory or two in there.
/Mats
I think redesign is a good answer.
I will prefer #1, the #2 one is going to cause a lot of confusion on casting as Factory<Factory... is a distinct type and it never cast to Factory...
I need both !
Obviously
Factory<Factory<Factory<Factory<Factory<IFooFactory>>>>> implements interface IFooFactoryFactoryFactoryFactory
I usualy prefer the first version because it allows for a more descriptive name and it keeps the implementation (using generics) hidden.
I feel so redeemed.
Generics allow you to describe something which, when expanded, gives you a more particular something.
In this case, you can say "IFooFactoryFactoryFactoryFactory" by saying "Factory<Factory<Factory<Factory<Factory<IFooFactory>>>>>", and you don't need to create (or maintain) a separate artifact.
Interfaces which embed type information are usually a less-expressive way of saying the same thing with generics:
IStringWidget vs. IWidget<string>
They are synonymous!
I so hope you really need that level of abstraction.
Based on the comments, it appears that a few people haven't properly analyzed an instance of the aforementioned type.
[Test]
public void CanExamineComplexClass() {
IFooFactoryFactoryFactoryFactory fooFactoryFactoryFactoryFactory = new Factory<Factory<Factory<Factory<Factory<IFooFactory>>>>>();
Assert.IsTrue(fooFactoryFactoryFactoryFactory is Joke);
}
If this was meant as a serious example, Oren would have used Boo (or written his own compiler).
Comment preview