<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>Stubblog - Comments</title>
    <link>http://stubbles.org/</link>
    <description>Stubblog - Less slogan, more code.</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.1 - http://www.s9y.org/</generator>
    <pubDate>Fri, 12 Mar 2010 23:00:59 GMT</pubDate>

    <image>
        <url>http://stubbles.org/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: Stubblog - Comments - Stubblog - Less slogan, more code.</title>
        <link>http://stubbles.org/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Lars Strojny: vfsStream 0.5.0 released</title>
    <link>http://stubbles.org/archives/73-vfsStream-0.5.0-released.html#c415</link>
            <category></category>
    
    <comments>http://stubbles.org/archives/73-vfsStream-0.5.0-released.html#comments</comments>
    <wfw:comment>http://stubbles.org/wfwcomment.php?cid=73</wfw:comment>

    

    <author>nospam@example.com (Lars Strojny)</author>
    <content:encoded>
    I find it quite wonderful that path/to/../foo is not supported, as PHP should not have supported that from the beginning. Please, don&#039;t implement &lt;img src=&quot;http://stubbles.org/templates/default/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt; 
    </content:encoded>

    <pubDate>Tue, 26 Jan 2010 20:56:43 +0100</pubDate>
    <guid isPermaLink="false">http://stubbles.org/archives/73-guid.html#c415</guid>
    
</item>
<item>
    <title>Berry Langerak: Registry Design Pattern - useful or harmful?</title>
    <link>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#c414</link>
            <category></category>
    
    <comments>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#comments</comments>
    <wfw:comment>http://stubbles.org/wfwcomment.php?cid=70</wfw:comment>

    

    <author>nospam@example.com (Berry Langerak)</author>
    <content:encoded>
    You&#039;re (obviously) right.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve explained it to one of my coworkers as follows: &quot;a Dependency Injection container is a Factory, which creates objects and recursively fulfills all dependencies which are denoted through type-hints, all starting from one aggregate root (or starting point).&quot;&lt;br /&gt;
&lt;br /&gt;
I like to think that description is both accurate as easy to follow, but the inner workings and &quot;automagic&quot; involved in DI containers can make the use of such code difficult to follow, especially if you haven&#039;t encountered one before. 
    </content:encoded>

    <pubDate>Wed, 06 Jan 2010 09:28:19 +0100</pubDate>
    <guid isPermaLink="false">http://stubbles.org/archives/70-guid.html#c414</guid>
    
</item>
<item>
    <title>Frank Kleine: Registry Design Pattern - useful or harmful?</title>
    <link>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#c413</link>
            <category></category>
    
    <comments>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#comments</comments>
    <wfw:comment>http://stubbles.org/wfwcomment.php?cid=70</wfw:comment>

    

    <author>nospam@example.com (Frank Kleine)</author>
    <content:encoded>
    &gt; A DI container takes care of the &lt;br /&gt;
&gt; problem of dependency. If you&#039;ve got a &lt;br /&gt;
&gt; hierarchy 4 levels deep but you don&#039;t &lt;br /&gt;
&gt; know when instantiating the 1st level &lt;br /&gt;
&gt; that you&#039;ll need the 4th level, how are &lt;br /&gt;
&gt; you going to handle the dependency of &lt;br /&gt;
&gt; the deep level?&lt;br /&gt;
&lt;br /&gt;
The first level says &quot;I need some object of the second level&quot;, so the DI container tries to create this 2nd level instance. However, the 2nd level says &quot;I need something from the 3rd level&quot;, so the DI container tries to create this 3rd level instance. (Same with 4th level, as deep as you wish.) Now it has the 3rd level instance which it can use to create the 2nd level instance which in turn can be used to create the 1st level instance. A proper DI container tries to instantiate the whole object graph, it steps down to the lowest level which has no dependencies and back to the class you want to instantiate after it created all of its dependencies (and the dependencies of the dependencies and so on and so forth). 
    </content:encoded>

    <pubDate>Wed, 06 Jan 2010 00:54:49 +0100</pubDate>
    <guid isPermaLink="false">http://stubbles.org/archives/70-guid.html#c413</guid>
    
</item>
<item>
    <title>Fake51: Registry Design Pattern - useful or harmful?</title>
    <link>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#c412</link>
            <category></category>
    
    <comments>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#comments</comments>
    <wfw:comment>http://stubbles.org/wfwcomment.php?cid=70</wfw:comment>

    

    <author>nospam@example.com (Fake51)</author>
    <content:encoded>
    &quot;Those objects have to be instantiated anyway, no matter what strategy you use. Using a DI framework however, will actually instantiate *less* objects than the registry approach would.&quot;&lt;br /&gt;
&lt;br /&gt;
What extra objects will the Registry create?&lt;br /&gt;
&lt;br /&gt;
&quot;You don&#039;t pass around a DI container, as you would then end up with a Service Locator instead.&quot;&lt;br /&gt;
&lt;br /&gt;
A DI container takes care of the problem of dependency. If you&#039;ve got a hierarchy 4 levels deep but you don&#039;t know when instantiating the 1st level that you&#039;ll need the 4th level, how are you going to handle the dependency of the deep level?&lt;br /&gt;
&lt;br /&gt;
I might be completely wrong about the proper use of a DI container, but as far as I&#039;m concerned, it&#039;s not limited to top-level objects. That would be limiting a design for no apparent reason. 
    </content:encoded>

    <pubDate>Mon, 04 Jan 2010 20:53:17 +0100</pubDate>
    <guid isPermaLink="false">http://stubbles.org/archives/70-guid.html#c412</guid>
    
</item>
<item>
    <title>Stephan Hochdoerfer: Registry Design Pattern - useful or harmful?</title>
    <link>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#c411</link>
            <category></category>
    
    <comments>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#comments</comments>
    <wfw:comment>http://stubbles.org/wfwcomment.php?cid=70</wfw:comment>

    

    <author>nospam@example.com (Stephan Hochdoerfer)</author>
    <content:encoded>
    Even if your registry is write-once you cannot really be sure what objects are in there. If you use DI and rely on defined interfaces you can at least be sure to get what you need. 
    </content:encoded>

    <pubDate>Mon, 04 Jan 2010 16:08:38 +0100</pubDate>
    <guid isPermaLink="false">http://stubbles.org/archives/70-guid.html#c411</guid>
    
</item>
<item>
    <title>Berry Langerak: Registry Design Pattern - useful or harmful?</title>
    <link>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#c410</link>
            <category></category>
    
    <comments>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#comments</comments>
    <wfw:comment>http://stubbles.org/wfwcomment.php?cid=70</wfw:comment>

    

    <author>nospam@example.com (Berry Langerak)</author>
    <content:encoded>
    &gt; my top level classes could possibly  use&lt;br /&gt;
&lt;br /&gt;
Have you ever actually used a dependency injection container? Your claims so far have been false and completely contradictory to my experiences with DI containers. They don&#039;t create all objects your top level classes could possibly use: they instantiate the ones that *one* single aggregate root has in it&#039;s signature, and if that needs objects, it will create those.&lt;br /&gt;
&lt;br /&gt;
Those objects have to be instantiated anyway, no matter what strategy you use. Using a DI framework however, will actually instantiate *less* objects than the registry approach would.&lt;br /&gt;
&lt;br /&gt;
&gt; You can obviously pass it around, which is better than statically calling it, but you still &lt;br /&gt;
&gt; run the risk of having classes know about it when they don&#039;t need to.&lt;br /&gt;
&lt;br /&gt;
Use a DI framework before making your own groundless assumptions. You don&#039;t pass around a DI container, as you would then end up with a Service Locator instead.&lt;br /&gt;
&lt;br /&gt;
&gt; Whether or not such a registry is then a good solution to problems is a different question, but it should &lt;br /&gt;
&gt; evaluated based on what it is instead of being shunned because someone called it evil at some point.&lt;br /&gt;
&lt;br /&gt;
Fully agreed. The only downside of a registry I can see, is the dependency that each class will get upon the registry. That&#039;s also the fundamental difference between a Registry and a DI container. 
    </content:encoded>

    <pubDate>Mon, 04 Jan 2010 15:58:53 +0100</pubDate>
    <guid isPermaLink="false">http://stubbles.org/archives/70-guid.html#c410</guid>
    
</item>
<item>
    <title>Fake51: Registry Design Pattern - useful or harmful?</title>
    <link>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#c409</link>
            <category></category>
    
    <comments>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#comments</comments>
    <wfw:comment>http://stubbles.org/wfwcomment.php?cid=70</wfw:comment>

    

    <author>nospam@example.com (Fake51)</author>
    <content:encoded>
    I wouldn&#039;t want to instantiate all possible objects that my top level classes could possibly use, on the off chance that they would need them. That means code lower down in the hierarchy still needs to know about the DI container. You can obviously pass it around, which is better than statically calling it, but you still run the risk of having classes know about it when they don&#039;t need to.&lt;br /&gt;
&lt;br /&gt;
Apart from that, registries don&#039;t necessarily have problematic state. People somehow assume that a registry is can be changed from anywhere in the code, but that&#039;s a groundless assumption: a registry can easily function as a write-once object, where overwriting values are not possible.&lt;br /&gt;
&lt;br /&gt;
Whether or not such a registry is then a good solution to problems is a different question, but it should evaluated based on what it is instead of being shunned because someone called it evil at some point. 
    </content:encoded>

    <pubDate>Mon, 04 Jan 2010 15:43:56 +0100</pubDate>
    <guid isPermaLink="false">http://stubbles.org/archives/70-guid.html#c409</guid>
    
</item>
<item>
    <title>Mastodont: Registry Design Pattern - useful or harmful?</title>
    <link>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#c408</link>
            <category></category>
    
    <comments>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#comments</comments>
    <wfw:comment>http://stubbles.org/wfwcomment.php?cid=70</wfw:comment>

    

    <author>nospam@example.com (Mastodont)</author>
    <content:encoded>
    Many thanks for sentence: &quot;it should be common sense by now that global state is a bad idea, at least if this global does not mean the root of the application itself&quot;.&lt;br /&gt;
&lt;br /&gt;
Personally, I do not understand that fear of global, a few root global statics are manageable (e.g. Registry, Log etc.) 
    </content:encoded>

    <pubDate>Mon, 04 Jan 2010 14:39:05 +0100</pubDate>
    <guid isPermaLink="false">http://stubbles.org/archives/70-guid.html#c408</guid>
    
</item>
<item>
    <title>Stephan Hochdoerfer: Registry Design Pattern - useful or harmful?</title>
    <link>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#c407</link>
            <category></category>
    
    <comments>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#comments</comments>
    <wfw:comment>http://stubbles.org/wfwcomment.php?cid=70</wfw:comment>

    

    <author>nospam@example.com (Stephan Hochdoerfer)</author>
    <content:encoded>
    The important difference between a Registry and an DI container is about how dependencies are provided to the requesting class. With a registry the requesting class asks for the dependency explicitly. With DI there is no explicit request, the dependency appears automatically in the requesting class. 
    </content:encoded>

    <pubDate>Mon, 04 Jan 2010 13:58:29 +0100</pubDate>
    <guid isPermaLink="false">http://stubbles.org/archives/70-guid.html#c407</guid>
    
</item>
<item>
    <title>Stephan Hochdoerfer: Registry Design Pattern - useful or harmful?</title>
    <link>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#c406</link>
            <category></category>
    
    <comments>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#comments</comments>
    <wfw:comment>http://stubbles.org/wfwcomment.php?cid=70</wfw:comment>

    

    <author>nospam@example.com (Stephan Hochdoerfer)</author>
    <content:encoded>
    I have to disagree. From my own experience it is not that complicated to learn the DI patterns and to use them in real world projects. All of our developers who had no experience in DI quickly got used to the DI principles. I think it`s mostly a matter how good and intuitive the DI framework is that gets used. 
    </content:encoded>

    <pubDate>Mon, 04 Jan 2010 13:48:20 +0100</pubDate>
    <guid isPermaLink="false">http://stubbles.org/archives/70-guid.html#c406</guid>
    
</item>
<item>
    <title>Berry Langerak: Registry Design Pattern - useful or harmful?</title>
    <link>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#c405</link>
            <category></category>
    
    <comments>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#comments</comments>
    <wfw:comment>http://stubbles.org/wfwcomment.php?cid=70</wfw:comment>

    

    <author>nospam@example.com (Berry Langerak)</author>
    <content:encoded>
    Actually, I do think you&#039;re mistaken. A DI container - in my book - is *not* globally available, and it only instantiates top level classes, such as a controller. The controller then acts as an aggregate root, &quot;telling&quot; the DI container it needs a Repository, which in turn needs a DatabaseConnectionPool, which in turn needs a string that represents the location of a config file with connection details, all by the means of simple type-hinting.&lt;br /&gt;
&lt;br /&gt;
The only objects within my application that know anything about a Dependency Injection container, are factories: the objects that make other objects. Those factories can easily be changed into registry based factories, if you&#039;d like that.&lt;br /&gt;
&lt;br /&gt;
Stating that a DI container is on the same level as a Registry is incorrect; a Registry is known throughout an application, a DI container should not be. It doesn&#039;t have any kind of state either.&lt;br /&gt;
&lt;br /&gt;
I do agree, however, with the sentiment that DI containers complicate the overall learning process of the application. Although it&#039;s quick, easy to work with and it makes for decent code (by inflicting the need for Inversion of Control), the first time you encounter it in the wild without knowing what it is, you _will_ be confused &lt;img src=&quot;http://stubbles.org/templates/default/img/emoticons/wink.png&quot; alt=&quot;;-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt; 
    </content:encoded>

    <pubDate>Mon, 04 Jan 2010 13:25:05 +0100</pubDate>
    <guid isPermaLink="false">http://stubbles.org/archives/70-guid.html#c405</guid>
    
</item>
<item>
    <title>Fake51: Registry Design Pattern - useful or harmful?</title>
    <link>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#c404</link>
            <category></category>
    
    <comments>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#comments</comments>
    <wfw:comment>http://stubbles.org/wfwcomment.php?cid=70</wfw:comment>

    

    <author>nospam@example.com (Fake51)</author>
    <content:encoded>
    I find that calling anything evil is a good sign that people are misunderstanding something, if only slightly.&lt;br /&gt;
&lt;br /&gt;
For instance, does a singleton equal global state that is changeable from everywhere? Well, that really depends upon what the singleton does. If it&#039;s a global variable in disguise, then obviously. Do things have to be that way? Only to people that insist singletons must be evil by design.&lt;br /&gt;
&lt;br /&gt;
Same with the registry pattern, which, when implemented as pure static, is just as global as a singleton, btw. You can use it and you can abuse it. It might be very easy to abuse it, unfortunately, which is likely why people are yelling at it, much like they&#039;re yelling at the singleton.&lt;br /&gt;
&lt;br /&gt;
Now, instead of registries or singletons, DI is offered as the silver bullet to solve all problems. Quickly though, people discover that they either have to pass dependencies deep into hierarchies, through classes that have no need for them and thus should not depend on them, or you need to create a DI container that can be created anywhere. The latter obviously appeals to people, as it seems cleaner, but the next problem presents itself: how do you handle resource pooling? Well, let the DI container take care of it. And hey presto, you&#039;re getting close to registries and singletons: you&#039;ve created a class that needs to be available from anywhere and which keeps track of a state, globally. Only it&#039;s called a DI container, so it&#039;s not evil - because we know that evil means Singleton and Registry.&lt;br /&gt;
&lt;br /&gt;
Mind you, I&#039;m happy about DI and I do think it solves some problems better than the Singleton or Registry do. What that means is mainly: use the right design for your problem. DI is not a silver bullet, it won&#039;t solve all your problems. Abuse it, and you&#039;ll end up regretting it. 
    </content:encoded>

    <pubDate>Mon, 04 Jan 2010 09:45:12 +0100</pubDate>
    <guid isPermaLink="false">http://stubbles.org/archives/70-guid.html#c404</guid>
    
</item>
<item>
    <title>Frank Kleine: Registry Design Pattern - useful or harmful?</title>
    <link>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#c403</link>
            <category></category>
    
    <comments>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#comments</comments>
    <wfw:comment>http://stubbles.org/wfwcomment.php?cid=70</wfw:comment>

    

    <author>nospam@example.com (Frank Kleine)</author>
    <content:encoded>
    I think you have to differentiate here. Using a DI framework adds another layer of abstraction, and depending on the choosen framework more or less complexity.&lt;br /&gt;
&lt;br /&gt;
However, using DI as a design principle in general does not add more complexity. Quite contrary, it makes code more concise, explicit and easier to understand. Separating construction of objects into their own layer belongs to a well thought out design, because changing it later would require to refactor your code in a way that you would be forced to change your test cases as well (if you hopefully have any), something you do not want to do under all circumstances. 
    </content:encoded>

    <pubDate>Mon, 04 Jan 2010 09:44:38 +0100</pubDate>
    <guid isPermaLink="false">http://stubbles.org/archives/70-guid.html#c403</guid>
    
</item>
<item>
    <title>Les: Registry Design Pattern - useful or harmful?</title>
    <link>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#c402</link>
            <category></category>
    
    <comments>http://stubbles.org/archives/70-Registry-Design-Pattern-useful-or-harmful.html#comments</comments>
    <wfw:comment>http://stubbles.org/wfwcomment.php?cid=70</wfw:comment>

    

    <author>nospam@example.com (Les)</author>
    <content:encoded>
    For the vast magjority of applications Dependency Injection is over the top for many, many people.&lt;br /&gt;
&lt;br /&gt;
I look at it in the same way we look at premature optimisation - it&#039;s a bad thing, so why utilise it from the beginning?&lt;br /&gt;
&lt;br /&gt;
I would suggest (whilst Singleton is bad and avoid it) people should just learn to pass thier dependencies around as normal.&lt;br /&gt;
&lt;br /&gt;
If the application has been thought out and designed with thought (separation of concerns - proper layers) then it shouldn&#039;t be a problem to hook in one or another Dependency container.&lt;br /&gt;
&lt;br /&gt;
There are many other things you can do at a design level that you won&#039;t need Dependency Injection anyway...&lt;br /&gt;
&lt;br /&gt;
As for testing that isn&#039;t here nor there in regards that Dependency Injection makes little difference.&lt;br /&gt;
&lt;br /&gt;
Until you actually need it - a proven need that is - then it&#039;s [Dependency Injection] just another layer of complexity. 
    </content:encoded>

    <pubDate>Mon, 04 Jan 2010 05:58:41 +0100</pubDate>
    <guid isPermaLink="false">http://stubbles.org/archives/70-guid.html#c402</guid>
    
</item>
<item>
    <title>taktu: Lazy loading of classes stored in a session without __autoload()</title>
    <link>http://stubbles.org/archives/12-Lazy-loading-of-classes-stored-in-a-session-without-__autoload.html#c401</link>
            <category></category>
    
    <comments>http://stubbles.org/archives/12-Lazy-loading-of-classes-stored-in-a-session-without-__autoload.html#comments</comments>
    <wfw:comment>http://stubbles.org/wfwcomment.php?cid=12</wfw:comment>

    

    <author>nospam@example.com (taktu)</author>
    <content:encoded>
    You can specify multiple directories, and also multiple name patterns using foreach several times in __autoload() 
    </content:encoded>

    <pubDate>Thu, 10 Dec 2009 17:18:30 +0100</pubDate>
    <guid isPermaLink="false">http://stubbles.org/archives/12-guid.html#c401</guid>
    
</item>

</channel>
</rss>