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

Zigster


In reply to Re: Re (tilly) 7: Object Oriented Pattern help by zigster
in thread Object Oriented Pattern help by thefid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.