<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: AOP-style Mixin Composition Stacks in Scala</title>
	<link>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/</link>
	<description>Down To The Bone</description>
	<pubDate>Sat, 19 Jul 2008 20:12:23 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>

	<item>
		<title>by: Jonas</title>
		<link>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-22107</link>
		<pubDate>Sat, 16 Feb 2008 16:09:17 +0000</pubDate>
		<guid>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-22107</guid>
					<description>&lt;blockquote&gt;
Shouldn’t RealStuff implement - in Scala, extend - the Stuff trait?
&lt;/blockquote&gt;

&lt;p&gt;Sure, you could do that (and it would feel natural) but it is not a requirement to get it to work.&lt;/p&gt;

&lt;p&gt;&lt;blockquote&gt;
One important aspect for AOP seem to be expressions with wildcards to select components and methods to intercept. The approach shown here is focused on single components with explicit methods. Any idea how to make it more generic?
&lt;/blockquote&gt;&lt;/p&gt;

&lt;p&gt;I would love to see full-blown AOP support in Scala, but until then you will have to use AspectJ, AspectWerkz or if you don't need that power, Spring AOP or similar.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<blockquote>
Shouldn’t RealStuff implement - in Scala, extend - the Stuff trait?
</blockquote>

<p>Sure, you could do that (and it would feel natural) but it is not a requirement to get it to work.</p>

<p><blockquote>
One important aspect for AOP seem to be expressions with wildcards to select components and methods to intercept. The approach shown here is focused on single components with explicit methods. Any idea how to make it more generic?
</blockquote></p>

<p>I would love to see full-blown AOP support in Scala, but until then you will have to use AspectJ, AspectWerkz or if you don&#8217;t need that power, Spring AOP or similar.</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Jörn Zaefferer</title>
		<link>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-22083</link>
		<pubDate>Sat, 16 Feb 2008 10:57:03 +0000</pubDate>
		<guid>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-22083</guid>
					<description>&lt;p&gt;Shouldn't RealStuff implement - in Scala, extend - the Stuff trait?&lt;/p&gt;

&lt;p&gt;One important aspect for AOP seem to be expressions with wildcards to select components and methods to intercept. The approach shown here is focused on single components with explicit methods. Any idea how to make it more generic?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Shouldn&#8217;t RealStuff implement - in Scala, extend - the Stuff trait?</p>

<p>One important aspect for AOP seem to be expressions with wildcards to select components and methods to intercept. The approach shown here is focused on single components with explicit methods. Any idea how to make it more generic?</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: djo.mos</title>
		<link>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-21238</link>
		<pubDate>Fri, 08 Feb 2008 09:40:27 +0000</pubDate>
		<guid>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-21238</guid>
					<description>&lt;p&gt;Hi Again :)
&lt;blockquote cite=&quot;Jonas&quot;&gt;Actually, I am wiring the interceptors in when I am instantiating the class, not when I define it which means that the target class is actually unaware of the fact that it is being intercepted. Also, this wiring is no different than Spring’s bean factory.&lt;/blockquote&gt;
Yep, that's true ... looking at it this way does not seem too bad ... a sort of Guice-like approach where you wire things up programatically (instead of declaratively as what is done in Spring).&lt;/p&gt;

&lt;blockquote cite=&quot;Jonas&quot;&gt;I don’t want to end up in this debate again (we discussed it to death in 2004)
&lt;/blockquote&gt;

&lt;p&gt;:oops:, In any way I did not intend to (re)start a flame war. Sorry.&lt;/p&gt;

&lt;p&gt;BTW, I did not mention that the Scala features are quite impressive ;)
Thanks for sharing these ;)&lt;/p&gt;

&lt;p&gt;Cheers.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Again <img src='http://jonasboner.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> 
<blockquote cite="Jonas">Actually, I am wiring the interceptors in when I am instantiating the class, not when I define it which means that the target class is actually unaware of the fact that it is being intercepted. Also, this wiring is no different than Spring’s bean factory.</blockquote>
Yep, that&#8217;s true &#8230; looking at it this way does not seem too bad &#8230; a sort of Guice-like approach where you wire things up programatically (instead of declaratively as what is done in Spring).</p>

<blockquote cite="Jonas">I don’t want to end up in this debate again (we discussed it to death in 2004)
</blockquote>

<p> <img src='http://jonasboner.com/wp-includes/images/smilies/icon_redface.gif' alt=':oops:' class='wp-smiley' /> , In any way I did not intend to (re)start a flame war. Sorry.</p>

<p>BTW, I did not mention that the Scala features are quite impressive <img src='http://jonasboner.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> 
Thanks for sharing these <img src='http://jonasboner.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>

<p>Cheers.</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: sanj</title>
		<link>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-21217</link>
		<pubDate>Fri, 08 Feb 2008 03:29:25 +0000</pubDate>
		<guid>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-21217</guid>
					<description>&lt;p&gt;Nice post! :) I never kind of linked this functionality to AOP. It's also very similar to the decorator pattern in Java where you can wrap objects that implement the same interface within each other to create an &quot;onion ring&quot; kind of effect.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Nice post! <img src='http://jonasboner.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I never kind of linked this functionality to AOP. It&#8217;s also very similar to the decorator pattern in Java where you can wrap objects that implement the same interface within each other to create an &#8220;onion ring&#8221; kind of effect.</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Jonas</title>
		<link>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-21191</link>
		<pubDate>Thu, 07 Feb 2008 19:15:52 +0000</pubDate>
		<guid>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-21191</guid>
					<description>&lt;p&gt;djo.mos, thanks for the feedback.&lt;/p&gt;

&lt;blockquote&gt;
Just to mention that this feature is not exactly what AOP solves. I mean, in the way you presented it, you need the explicitly specify the advices when launching a class … thus breaking the master goal of AOP, i.e. classes should be unaware of the advices around them.
&lt;/blockquote&gt;

&lt;p&gt;Actually, I am wiring the interceptors in when I am instantiating the class, not when I define it which means that the target class is actually unaware of the fact that it is being intercepted. Also, this wiring is no different than Spring's bean factory. &lt;/p&gt;

&lt;p&gt;However, I agree that this is not AOP its most pure sense, since the interceptors are hardwired to a specific component interface.  &lt;/p&gt;

&lt;blockquote&gt;
So IMHO there is no way to do real AOP without a container such as Spring.
&lt;/blockquote&gt;

&lt;p&gt;I don't want to end up in this debate again (we discussed it to death in 2004). My view back then was that proxy based AOP (like Spring) was not to be considered &quot;real&quot; AOP like AspectWerkz and AspectJ, but I have loosened up a bit on the religion since then. Getting older (and more pragmatic) I guess. :-)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>djo.mos, thanks for the feedback.</p>

<blockquote>
Just to mention that this feature is not exactly what AOP solves. I mean, in the way you presented it, you need the explicitly specify the advices when launching a class … thus breaking the master goal of AOP, i.e. classes should be unaware of the advices around them.
</blockquote>

<p>Actually, I am wiring the interceptors in when I am instantiating the class, not when I define it which means that the target class is actually unaware of the fact that it is being intercepted. Also, this wiring is no different than Spring&#8217;s bean factory. </p>

<p>However, I agree that this is not AOP its most pure sense, since the interceptors are hardwired to a specific component interface.  </p>

<blockquote>
So IMHO there is no way to do real AOP without a container such as Spring.
</blockquote>

<p>I don&#8217;t want to end up in this debate again (we discussed it to death in 2004). My view back then was that proxy based AOP (like Spring) was not to be considered &#8220;real&#8221; AOP like AspectWerkz and AspectJ, but I have loosened up a bit on the religion since then. Getting older (and more pragmatic) I guess. <img src='http://jonasboner.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
				</item>
	<item>
		<title>by: djo.mos</title>
		<link>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-21186</link>
		<pubDate>Thu, 07 Feb 2008 18:35:17 +0000</pubDate>
		<guid>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-21186</guid>
					<description>&lt;p&gt;Hi,
  A nice nifty post, thanks.&lt;/p&gt;

&lt;p&gt;Just to mention that this feature is not exactly what AOP solves. I mean, in the way you presented it, you need the explicitly specify the advices when launching a class ... thus breaking the master goal of AOP, i.e. classes should be unaware of the advices around them.&lt;/p&gt;

&lt;p&gt;So IMHO there is no way to do real AOP without a container such as Spring.&lt;/p&gt;

&lt;p&gt;cheers.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi,
  A nice nifty post, thanks.</p>

<p>Just to mention that this feature is not exactly what AOP solves. I mean, in the way you presented it, you need the explicitly specify the advices when launching a class &#8230; thus breaking the master goal of AOP, i.e. classes should be unaware of the advices around them.</p>

<p>So IMHO there is no way to do real AOP without a container such as Spring.</p>

<p>cheers.</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Gabriel C.</title>
		<link>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-21180</link>
		<pubDate>Thu, 07 Feb 2008 18:07:22 +0000</pubDate>
		<guid>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-21180</guid>
					<description>&lt;p&gt;I get it, the trick is ordering the mixins correctly using &quot;with&quot;.
Not the usual composition of: Stuff with Loggable, Tx but A with Tx with Loggable instead.
Just need to be careful in the ordering :-)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I get it, the trick is ordering the mixins correctly using &#8220;with&#8221;.
Not the usual composition of: Stuff with Loggable, Tx but A with Tx with Loggable instead.
Just need to be careful in the ordering <img src='http://jonasboner.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Jonas</title>
		<link>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-21172</link>
		<pubDate>Thu, 07 Feb 2008 15:58:26 +0000</pubDate>
		<guid>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-21172</guid>
					<description>&lt;blockquote&gt;
How would you make these traits usable in a more generic environment, applied to an arbitrary number of methods, not just on doStuff? As it is now, if a new method doMoreStuff is added, one would need to override it in all traits.
&lt;/blockquote&gt;

&lt;p&gt;I don't know of any way to implement completely generic interceptors/advice in Scala. Then you have to bring in a &quot;real&quot; AOP framework. &lt;/p&gt;

&lt;p&gt;I have successfully tried Scala with AOP Alliance interceptors driven by Guice or Spring as well as AspectWerkz aspects, not tried AspectJ though. &lt;/p&gt;

&lt;p&gt;The problem with Guice and Spring is that the interceptors are not type-safe, but are using reflection. This is the problem that Rickard's abstract schema addresses, which (if I remember correctly) Spring AOP supports as an optional strategy when you need type-safety, statically compiled code, direct access to the method arguments etc. and can live with tighter coupling and less flexibility.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<blockquote>
How would you make these traits usable in a more generic environment, applied to an arbitrary number of methods, not just on doStuff? As it is now, if a new method doMoreStuff is added, one would need to override it in all traits.
</blockquote>

<p>I don&#8217;t know of any way to implement completely generic interceptors/advice in Scala. Then you have to bring in a &#8220;real&#8221; AOP framework. </p>

<p>I have successfully tried Scala with AOP Alliance interceptors driven by Guice or Spring as well as AspectWerkz aspects, not tried AspectJ though. </p>

<p>The problem with Guice and Spring is that the interceptors are not type-safe, but are using reflection. This is the problem that Rickard&#8217;s abstract schema addresses, which (if I remember correctly) Spring AOP supports as an optional strategy when you need type-safety, statically compiled code, direct access to the method arguments etc. and can live with tighter coupling and less flexibility.</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Zsolt Szász</title>
		<link>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-21166</link>
		<pubDate>Thu, 07 Feb 2008 14:06:24 +0000</pubDate>
		<guid>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-21166</guid>
					<description>&lt;p&gt;How would you make these traits usable in a more generic environment, applied to an arbitrary number of methods, not just on doStuff? As it is now, if a new method doMoreStuff is added, one would need to override it in all traits.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>How would you make these traits usable in a more generic environment, applied to an arbitrary number of methods, not just on doStuff? As it is now, if a new method doMoreStuff is added, one would need to override it in all traits.</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Dale</title>
		<link>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-21116</link>
		<pubDate>Thu, 07 Feb 2008 04:24:05 +0000</pubDate>
		<guid>http://jonasboner.com/2008/02/06/aop-style-mixin-composition-stacks-in-scala/#comment-21116</guid>
					<description>&lt;p&gt;The more I read about Scala, the more I'm loving it!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The more I read about Scala, the more I&#8217;m loving it!</p>
]]></content:encoded>
				</item>
</channel>
</rss>
