Ayende @ Rahien

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

ayende@ayende.com

+972 52-548-6969

, @ Q c

Posts: 6,128 | Comments: 45,549

filter by tags archive

Comments

Bill Barry

Oi...

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?

Avish

Redesign.

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

Trumpi

NO NO NO NO NO!!!

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.

/Mats

goodwill

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 !

Obviously

Factory<Factory<Factory<Factory<Factory>>>> implements interface IFooFactoryFactoryFactoryFactory

efdee

I usualy prefer the first version because it allows for a more descriptive name and it keeps the implementation (using generics) hidden.

Mr_Simple

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.

[Test]

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.

FUTURE POSTS

  1. The worker pattern - 2 days from now

There are posts all the way to May 30, 2016

RECENT SERIES

  1. The design of RavenDB 4.0 (14):
    26 May 2016 - The client side
  2. RavenDB 3.5 whirl wind tour (14):
    25 May 2016 - Got anything to declare, ya smuggler?
  3. Tasks for the new comer (2):
    15 Apr 2016 - Quartz.NET with RavenDB
  4. Code through the looking glass (5):
    18 Mar 2016 - And a linear search to rule them
  5. Find the bug (8):
    29 Feb 2016 - When you can't rely on your own identity
View all series

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats