<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments on: Dependency Injection vs. Virtual Classes</title>
	<atom:link href="http://www.iam.unibe.ch/~akuhn/blog/2009/dependency-injection-vs-virtual-classes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.iam.unibe.ch/~akuhn/blog/2009/dependency-injection-vs-virtual-classes/</link>
	<description>Random notes on software, programming and languages.</description>
	<pubDate>Thu, 24 May 2012 10:34:29 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Niko</title>
		<link>http://www.iam.unibe.ch/~akuhn/blog/2009/dependency-injection-vs-virtual-classes/comment-page-1/#comment-3321</link>
		<dc:creator>Niko</dc:creator>
		<pubDate>Sun, 10 Jan 2010 13:07:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.iam.unibe.ch/~akuhn/blog/?p=459#comment-3321</guid>
		<description>@Gilad, I couldn’t agree more. &lt;a href="http://smalltalkthoughts.blogspot.com/2010/01/on-erwann-wernlis-idea-of-having-vm.html" rel="nofollow"&gt;I tried to argue to the same point here.&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>@Gilad, I couldn’t agree more. <a href="http://smalltalkthoughts.blogspot.com/2010/01/on-erwann-wernlis-idea-of-having-vm.html" rel="nofollow">I tried to argue to the same point here.</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SCG : Should DI and GC be unified?</title>
		<link>http://www.iam.unibe.ch/~akuhn/blog/2009/dependency-injection-vs-virtual-classes/comment-page-1/#comment-3317</link>
		<dc:creator>SCG : Should DI and GC be unified?</dc:creator>
		<pubDate>Sun, 10 Jan 2010 07:37:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.iam.unibe.ch/~akuhn/blog/?p=459#comment-3317</guid>
		<description>[...] post is somehow an answer to this other post, which discusses dependency injection vs. virtual classes. Neither is optimal in my view, though I [...]</description>
		<content:encoded><![CDATA[<p>[...] post is somehow an answer to this other post, which discusses dependency injection vs. virtual classes. Neither is optimal in my view, though I [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: akuhn</title>
		<link>http://www.iam.unibe.ch/~akuhn/blog/2009/dependency-injection-vs-virtual-classes/comment-page-1/#comment-3316</link>
		<dc:creator>akuhn</dc:creator>
		<pubDate>Sun, 10 Jan 2010 06:16:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.iam.unibe.ch/~akuhn/blog/?p=459#comment-3316</guid>
		<description>Hi Gilad and welcome to my small blog! 

I am glad that you mention named constructors! I learned to love them in Smalltalk and Newspeak, and only left them out in this post to avoid confusing the uninitiated reader with two new concepts at once. Java's &lt;code&gt;new&lt;/code&gt; keyword is terribly limited, and "injection is the new new" can't be the solution either. Named constructors are awesome! Also, passing a block to them (that receives an inner builder class as argument) even offers a nice way to implement a small builder DSL …hmm, mebbe that should go into a post if its own :)</description>
		<content:encoded><![CDATA[<p>Hi Gilad and welcome to my small blog! </p>
<p>I am glad that you mention named constructors! I learned to love them in Smalltalk and Newspeak, and only left them out in this post to avoid confusing the uninitiated reader with two new concepts at once. Java&#8217;s <code>new</code> keyword is terribly limited, and &#8220;injection is the new new&#8221; can&#8217;t be the solution either. Named constructors are awesome! Also, passing a block to them (that receives an inner builder class as argument) even offers a nice way to implement a small builder DSL …hmm, mebbe that should go into a post if its own :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gilad Bracha</title>
		<link>http://www.iam.unibe.ch/~akuhn/blog/2009/dependency-injection-vs-virtual-classes/comment-page-1/#comment-3290</link>
		<dc:creator>Gilad Bracha</dc:creator>
		<pubDate>Sat, 02 Jan 2010 23:21:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.iam.unibe.ch/~akuhn/blog/?p=459#comment-3290</guid>
		<description>Hi Adrian,

Nice post; one more point I'd like to make:

When you use a special syntax like new Foo(x)  to instantiate classes, you're restricting yourself. Say you want to look up instances in a cache, rather than allocating fresh ones.  You would like to replace the class Foo with an object that looks up instances in the cache (say, based on the value of x,  the argument to the constructor.  That is why it is important to do away with traditional constructors even when classes are virtual. Therefore, in Newspeak, constructors (aka factories) have names and their use is indistinguishable from ordinary methods.</description>
		<content:encoded><![CDATA[<p>Hi Adrian,</p>
<p>Nice post; one more point I&#8217;d like to make:</p>
<p>When you use a special syntax like new Foo(x)  to instantiate classes, you&#8217;re restricting yourself. Say you want to look up instances in a cache, rather than allocating fresh ones.  You would like to replace the class Foo with an object that looks up instances in the cache (say, based on the value of x,  the argument to the constructor.  That is why it is important to do away with traditional constructors even when classes are virtual. Therefore, in Newspeak, constructors (aka factories) have names and their use is indistinguishable from ordinary methods.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: akuhn</title>
		<link>http://www.iam.unibe.ch/~akuhn/blog/2009/dependency-injection-vs-virtual-classes/comment-page-1/#comment-3281</link>
		<dc:creator>akuhn</dc:creator>
		<pubDate>Thu, 31 Dec 2009 02:04:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.iam.unibe.ch/~akuhn/blog/?p=459#comment-3281</guid>
		<description>@brian, I dont know Beta to that detail. In Newspeak at least there is no such thing as &lt;code&gt;static&lt;/code&gt; at all (except maybe for the outermost context of the outermost nested class, recall &lt;i&gt;each&lt;/i&gt; class is nested in another class). Gilad Bracha, the inventor of Newspeak, is an outspoken opponent of anything static. Read eg &lt;a href="http://gbracha.blogspot.com/2008/02/cutting-out-static.html" rel="nofollow"&gt;Cutting out Static&lt;/a&gt; on his blog.</description>
		<content:encoded><![CDATA[<p>@brian, I dont know Beta to that detail. In Newspeak at least there is no such thing as <code>static</code> at all (except maybe for the outermost context of the outermost nested class, recall <i>each</i> class is nested in another class). Gilad Bracha, the inventor of Newspeak, is an outspoken opponent of anything static. Read eg <a href="http://gbracha.blogspot.com/2008/02/cutting-out-static.html" rel="nofollow">Cutting out Static</a> on his blog.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Randal L. Schwartz</title>
		<link>http://www.iam.unibe.ch/~akuhn/blog/2009/dependency-injection-vs-virtual-classes/comment-page-1/#comment-3280</link>
		<dc:creator>Randal L. Schwartz</dc:creator>
		<pubDate>Thu, 31 Dec 2009 01:32:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.iam.unibe.ch/~akuhn/blog/?p=459#comment-3280</guid>
		<description>In Perl, I just teach "no hardwired classnames".  So instead of:
&lt;pre&gt;&lt;code&gt;sub foo {
 ...
 return FriendClass-&#62;new-&#62;something(@xyz);
}
&lt;/code&gt;&lt;/pre&gt;
we write
&lt;pre&gt;&lt;code&gt;sub foo {
  ...
  return $self-&#62;friendclass-&#62;new-&#62;something(@xyz);
}

sub friendclass { 'FriendClass' }&lt;/code&gt;&lt;/pre&gt;
And yeah, this does the trick nicely.</description>
		<content:encoded><![CDATA[<p>In Perl, I just teach &#8220;no hardwired classnames&#8221;.  So instead of:</p>
<pre><code>sub foo {
 ...
 return FriendClass-&gt;new-&gt;something(@xyz);
}
</code></pre>
<p>we write</p>
<pre><code>sub foo {
  ...
  return $self-&gt;friendclass-&gt;new-&gt;something(@xyz);
}

sub friendclass { 'FriendClass' }</code></pre>
<p>And yeah, this does the trick nicely.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Harris</title>
		<link>http://www.iam.unibe.ch/~akuhn/blog/2009/dependency-injection-vs-virtual-classes/comment-page-1/#comment-3278</link>
		<dc:creator>Brian Harris</dc:creator>
		<pubDate>Wed, 30 Dec 2009 19:44:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.iam.unibe.ch/~akuhn/blog/?p=459#comment-3278</guid>
		<description>Good insight!  Do you know if Beta or Newspeak also have virtual "static methods"?</description>
		<content:encoded><![CDATA[<p>Good insight!  Do you know if Beta or Newspeak also have virtual &#8220;static methods&#8221;?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

