Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 18 | Comments: 72

filter by tags archive


Bill Barry


umm, is

iFooFactoryFactoryFactoryFactory : Factory<Factory<Factory<Factory<Factory>>>>

and are you using it more than once?

If so, then the former; btw, what is wrong that you need such a structure?



Peter w

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!!!!!!!!



It's Factory<Factory<Factory>>

(For those who don't get it, read http://discuss.joelonsoftware.com/default.asp?joel.3.219431.12)

Luke Breuer

I would go for the double barrel shotgun. If you need more firepower, I'll see what I can do. :-p

Nick Parker

You could SO use another factory to manage all that complexity! ;-)

Mats Helander

I'm with Nick on this one, although it seems you're also missing an AbstractFactory or two in there.



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...

Tapio K

I need both !


Factory<Factory<Factory<Factory<Factory>>>> 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.

Bryan Watts

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>>>>", 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

They are synonymous!

Keith Nicholas

I so hope you really need that level of abstraction.

James Kovacs

Based on the comments, it appears that a few people haven't properly analyzed an instance of the aforementioned type.


public void CanExamineComplexClass() {

IFooFactoryFactoryFactoryFactory fooFactoryFactoryFactoryFactory = new Factory<Factory<Factory<Factory<Factory>>>>();

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

Comments have been closed on this topic.


  1. RavenDB 3.0 New Stable Release - 17 hours from now
  2. Production postmortem: The industry at large - about one day from now
  3. The insidious cost of allocations - 3 days from now
  4. Buffer allocation strategies: A possible solution - 6 days from now
  5. Buffer allocation strategies: Explaining the solution - 7 days from now

And 3 more posts are pending...

There are posts all the way to Sep 11, 2015


  1. Find the bug (5):
    20 Apr 2011 - Why do I get a Null Reference Exception?
  2. Production postmortem (10):
    01 Sep 2015 - The case of the lying configuration file
  3. What is new in RavenDB 3.5 (7):
    12 Aug 2015 - Monitoring support
  4. Career planning (6):
    24 Jul 2015 - The immortal choices aren't
View all series



Main feed Feed Stats
Comments feed   Comments Feed Stats