|Just another Perl shrine|
Re: Re (tilly) 7: Object Oriented Pattern helpby zigster (Hermit)
|on May 14, 2001 at 16:02 UTC||Need Help??|
I am going to let this drop now, the tone of your node seems to suggests that this is turning a little bit heated. I am not up for that kinda discussion. Suffice to come back upon a few points. I am not trying to have the last word. If you wanna come back then go for it, I will drop off now tho.
An incidental point. Your label is wrong. As I said I am not a big label person, so I don't really care. But for this to be a singleton design pattern, you need to have a class involved
I actually originally said:
This is a nice pattern to use, I am sure you realise that it is a variant of the singleton object. *REACHES for DP*
I am aware that this is not a singleton, however it exhibits enuff of the chars to allow it to be discussed as one. So that any points I made regarding singletons will also hold of for this 'thing'. Sorry for not being more explicit in my posts.
In fact with this insight, the dbi function might well take an optional argument specifying which of several databases to connect to. Conceptually this is still simple memoization
I quite agree this is in fact the jewel/facet pattern I have been talking about for the last few nodes. I assumed you were familiar with this pattern or I would have expanded (I do not intend this to be insulting, simply that noone knows every pattern and without a common frame of reference discussion is harder).
Now do you see why this is different from the Singleton design pattern? I have not imposed any structure on how the caching works, so I can move to a more complex structure without adding related structures.
I certainly do, you are no longer describing a singleton. See comments before about intent. A singleton has specific behaviour, as does a facet.And here is why I don't much like labels. Labels blind you. Labels turn into categorizations that are applied with little thought and foresight. This reduces the myriad of ways to understand problems into memorized channels that shall never be deviated from. I try not to limit myself like that.
Here I think our viewpoints differ, I find PATTERNS very valuable. My take is that other ppl are smarter than me so I tend to copy other peoples bright ideas rather than creating my own. Most of the views I have stated in the last few nodes could be found in OO text books. I have a strong background in OO programming and do disagree with a number of the principles at hand, I do not follow like a blind little sheep, yet I tend to follow the prescribed route of pattern interaction UNLESS something tells me it is wrong to do so. Thus far I see no good reason for not using patterns.
Interestingly tho the poing you make about lables blinding you is quite true. If I had not hidden behind lables and had instead explained the facet pattern then maybe we would have agreed sooner.