<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Dean Wampler's Mind: Tag AOP</title>
    <link>http://blog.aspectprogramming.com/articles_controller.rb/tag?tag=aop</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Ruminations and Ruinations on Software</description>
    <item>
      <title>ANN: OOPSLA Tutorial on &amp;quot;Principles of Aspect-Oriented Design in Java and AspectJ&amp;quot;</title>
      <description>&lt;p&gt;I&amp;#8217;m doing a tutorial on aspect-oriented design principles with examples in Java and AspectJ at &lt;span class="caps"&gt;OOPSLA&lt;/span&gt; this year. You can find a description &lt;a href="http://www.oopsla.org/oopsla2007/index.php?page=sub/&amp;#38;id=90"&gt;here&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Tue, 04 Sep 2007 10:51:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:efe53cc5-2bc3-4af6-89ce-1c9ce05cc498</guid>
      <author>Dean Wampler</author>
      <link>http://blog.aspectprogramming.com/articles/2007/09/04/ann-oopsla-tutorial-on-principles-of-aspect-oriented-design-in-java-and-aspectj</link>
      <category>AOP</category>
      <category>Java and AspectJ</category>
      <category>OOPSLA</category>
      <category>AOP</category>
      <category>AOD</category>
      <trackback:ping>http://blog.aspectprogramming.com/articles/trackback/36</trackback:ping>
    </item>
    <item>
      <title>Contract4J5 v0.6.0 Is Now Available</title>
      <description>&lt;p&gt;After a longer-than-expected effort, I&amp;#8217;m pleased to announce the v0.6.0 release of Contract4J5.&lt;/p&gt;


	&lt;p&gt;The &lt;span class="caps"&gt;API&lt;/span&gt; for writing contract tests has not changed, but the internals have been restructured considerably to improve the code quality and make it easier to configure Contract4J5 using property files and &lt;a href="http://www.springframework.org"&gt;Spring Framework&lt;/a&gt; Dependency Injection.&lt;/p&gt;


	&lt;p&gt;The release also provides examples of using Contract4J5 with binary weaving or load-time weaving. The latter is now the preferred way to introduce Contract4J5 into a &amp;#8220;pure-Java&amp;#8221; environment.&lt;/p&gt;


	&lt;p&gt;For more details, see the 
&lt;a href="http://contract4j.org/contract4j/c4j5#notes"&gt;Release Notes&lt;/a&gt; in the &lt;span class="caps"&gt;README&lt;/span&gt; or browse to &lt;a href="http://www.contract4j.org"&gt;http://www.contract4j.org&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Thu, 21 Sep 2006 21:07:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:5edc78e1-2e33-4780-90b6-77960ccb8bea</guid>
      <author>Dean Wampler</author>
      <link>http://blog.aspectprogramming.com/articles/2006/09/21/contract4j5-v0-6-0-is-now-available</link>
      <category>AOP</category>
      <category>Java and AspectJ</category>
      <category>Contract4J</category>
      <category>Contract4J</category>
      <category>AOP</category>
      <category>AspectJ</category>
      <trackback:ping>http://blog.aspectprogramming.com/articles/trackback/20</trackback:ping>
    </item>
    <item>
      <title>RailsConf 2006</title>
      <description>&lt;p&gt;I attended the first annual &lt;a href="http://www.rubyonrails.org"&gt;Ruby on Rails&lt;/a&gt; &lt;a href="http://www.railsconf.org"&gt;RailsConf&lt;/a&gt; in Chicago last weekend and I&amp;#8217;ve finally found the time to blog about it ;)&lt;/p&gt;
&lt;p&gt;About 500-550 people attended, from novices to Rails experts, including 8 out of 11 of the Rails &amp;#8220;core&amp;#8221; team. The atmosphere was collegial and somewhat cozy. Everyone realized that future Rails conferences will be a lot bigger and probably more commercial too, given the growing interest in Rails.&lt;/p&gt;

&lt;h3&gt;Dave Thomas&amp;#8217; Keynote&lt;/h3&gt;
&lt;p&gt;Dave&amp;#8217;s was the first keynote of the conference. He described the top-3 unsolved problems on his list of &lt;i&gt;&lt;span class="caps"&gt;TODO&lt;/span&gt;&amp;#8217;S&lt;/i&gt; for Rails. The list contains somewhat conventional items that you might expect, but what was interesting about the keynote was how the list anticipated some spirited philosophical discussions throughout the weekend.&lt;/p&gt;
&lt;h4&gt;Data Integration Improvements&lt;/h4&gt;
&lt;p&gt;Dave would like &lt;a href="http://wiki.rubyonrails.com/rails/pages/ActiveRecord"&gt;ActiveRecord&lt;/a&gt; to extract more information from the schema into the models, such as constraints and associations. He would like better foreign key and compound key support. He would like non-database back-ends supported, like &lt;span class="caps"&gt;JMS&lt;/span&gt;/MQ systems and he would like support for distributed transactions with two-phased commits, &lt;i&gt;etc.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;These are all reasonable requests from someone familiar with the typical challenges of &amp;#8220;enterprise&amp;#8221; (more on that word below&amp;#8230;) applications, especially legacy systems. However, this surfaced an on-going debate between the two Daves; Dave Thomas and David Heinemeier Hansson (&lt;a href="http://money.cnn.com/popups/2006/biz2/peoplewhomatter/frameset.34.exclude.html"&gt;&lt;span class="caps"&gt;DHH&lt;/span&gt;&lt;/a&gt;). &lt;span class="caps"&gt;DHH&lt;/span&gt; has made clear his preference for keeping all domain logic in the application and using the database as a relatively simple-minded storage vehicle.&lt;/p&gt;
&lt;p&gt;As subsequent presentations and discussions indicated, the Rails &amp;#8220;core&amp;#8221; will get smaller in the future and plugins will provide added support for things not considered &amp;#8220;core&amp;#8221;. No doubt people will implement plugins for all the things Dave (Thomas) wants, but they won&amp;#8217;t be part of the Rails core. But this is okay, as it will satisfy various needs, yet keep Rails lean, mean, and architecturally clean (you can quote me&amp;#8230;;) ).&lt;/p&gt;

&lt;h4&gt;&lt;span class="caps"&gt;CRUD&lt;/span&gt; and Scaffolding&lt;/h4&gt;
Create, Read, Update, Delete (CRUD) operations are the core of typical database-based applications. Dave argued that the Rails scaffolding, which is used to generate stubs for functionality, &lt;i&gt;etc.&lt;/i&gt; could be improved to better reflect the growing capabilities of Rails. He would like scaffolding that supports table relationships, in-browser validation JavaScript, &lt;span class="caps"&gt;AJAX&lt;/span&gt;, &lt;i&gt;etc., etc.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;Who could argue with that? Well, some people feel that scaffolding is too much of a crutch that discourages neophytes from understanding Rails and adapting it to their needs. Others feel that the scaffolding command-line tools are too primitive and should be more sophisticated. For a promising example of the latter, see the forth-coming &lt;a href="http://www.streamlined.relevancellc.com"&gt;Streamlined&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Perhaps most interesting was &lt;span class="caps"&gt;DHH&lt;/span&gt;&amp;#8217;s own keynote, where he discussed his thoughts on more fully realizing the &amp;#8220;vision&amp;#8221; of &lt;span class="caps"&gt;CRUD&lt;/span&gt; in rails, but more on that later.&lt;/p&gt;
&lt;h4&gt;Deployment&lt;/h4&gt;
Dave&amp;#8217;s third item was deployment of applications. While &lt;a href="http://wiki.rubyonrails.org/rails/pages/Capistrano"&gt;Capistrano&lt;/a&gt; is a widely-praised tool for automating deployments, it does have some limitations. For example, out of the box, it really assumes that the developer does the deploying. This may be true for many small shops, but larger enterprises typically have system administrators who handle deployments. The Developers know &lt;i&gt;what&lt;/i&gt; to deploy and administrators know the &lt;i&gt;where, when, how,&lt;/i&gt; etc. for the deployments. So, Dave advocated enhancements that logically-separate application and deployment configurations. He sighted one example where &lt;span class="caps"&gt;J2EE&lt;/span&gt; got it right (at least in theory); packaging applications as &amp;#8220;archives&amp;#8221;, WARs, EARs, &lt;i&gt;etc.&lt;/i&gt;, which can be deployed to any standard server.&lt;/p&gt;
&lt;p&gt;Deployment was a popular topic at the conference, with several sessions devoted to Capistrano, server topology considerations, &lt;i&gt;etc.&lt;/i&gt;

&lt;h3&gt;David Heinemeier Hansson&amp;#8217;s Keynote&lt;/h3&gt;
&lt;p&gt;Jumping ahead to &lt;span class="caps"&gt;DHH&lt;/span&gt;&amp;#8217;s keynote on Saturday, he replied to some of Dave Thomas&amp;#8217; comments by reaffirming his &lt;a href="http://www.loudthinking.com/arc/000516.html"&gt;opinions&lt;/a&gt; on topics such as the roll of the database and how far ActiveRecord should go in supporting various database features. For example, he was emphatic that composite keys are a known evil in the database world and ActiveRecord should not support them, at least not as a core feature. Perhaps someone will write a separate plugin, but &lt;span class="caps"&gt;DHH&lt;/span&gt; believes that if you do bad stuff, it should be painful, not easy.&lt;/p&gt;
&lt;p&gt;For most of hist talk, however, &lt;span class="caps"&gt;DHH&lt;/span&gt; focused on more fully realizing the &amp;#8220;vision&amp;#8221; of &lt;span class="caps"&gt;CRUD&lt;/span&gt; in Rails. Create, Read, Update, and Delete are the standard operations in database-backed applications. In forthcoming versions of Rails, &lt;span class="caps"&gt;DHH&lt;/span&gt; wants to make this model more consistently applied throughout Rails.&lt;/p&gt;
&lt;p&gt;For example, &lt;span class="caps"&gt;HTTP&lt;/span&gt; actually defines four methods, &lt;span class="caps"&gt;GET&lt;/span&gt; and &lt;span class="caps"&gt;POST&lt;/span&gt;, which we all know an love, but also &lt;span class="caps"&gt;PUT&lt;/span&gt; and &lt;span class="caps"&gt;DELETE&lt;/span&gt;. Roughly, these correspond the Read, Create, Update, and Delete operations in &lt;span class="caps"&gt;CRUD&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Our current way of organizing models, controls, and the behavior they offer is reflected in URLs of the form 
    &lt;pre&gt;.../model/action/id&lt;/pre&gt;
For example:&lt;/p&gt;
&lt;table&gt;
    &lt;tr&gt;&lt;th&gt;&lt;span class="caps"&gt;HTTP&lt;/span&gt; Method&lt;/th&gt;&lt;th&gt;Example&amp;nbsp;URL&lt;/th&gt;&lt;th&gt;Meaning&lt;/th&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;span class="caps"&gt;POST&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;.../person/create/1&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Edit Person with &lt;span class="caps"&gt;ID 1&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;span class="caps"&gt;GET&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;.../person/read/2&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Read Person with &lt;span class="caps"&gt;ID 2&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;span class="caps"&gt;POST&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;.../person/update/3&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Update Person with &lt;span class="caps"&gt;ID 3&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;span class="caps"&gt;POST&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;.../person/delete/4&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Delete Person with &lt;span class="caps"&gt;ID 4&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;Instead, we should be writing more &amp;#8220;CRUD&amp;#8217;y&amp;#8221; URLs of the form
        &lt;pre&gt;.../model/id&lt;/pre&gt;
    and using the &lt;span class="caps"&gt;HTTP&lt;/span&gt; method to indicate the &lt;span class="caps"&gt;CRUD&lt;/span&gt; operation. This would allow Rails to apply more &lt;i&gt;conventions&lt;/i&gt; for these typical controller operations, thereby minimizing code. For example:&lt;/p&gt;
    &lt;table&gt;
        &lt;tr&gt;&lt;th&gt;&lt;span class="caps"&gt;HTTP&lt;/span&gt; Method&lt;/th&gt;&lt;th&gt;Example&amp;nbsp;URL&lt;/th&gt;&lt;th&gt;Meaning&lt;/th&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;span class="caps"&gt;POST&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;.../person/1&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Edit Person with &lt;span class="caps"&gt;ID 1&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;span class="caps"&gt;GET&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;.../person/2&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Read Person with &lt;span class="caps"&gt;ID 2&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;span class="caps"&gt;PUT&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;.../person/3&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Update Person with &lt;span class="caps"&gt;ID 3&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;span class="caps"&gt;DELETE&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;.../person/4&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Delete Person with &lt;span class="caps"&gt;ID 4&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;/table&gt;
&lt;p&gt;Unfortunately, browsers don&amp;#8217;t usually support &lt;span class="caps"&gt;PUT&lt;/span&gt; and &lt;span class="caps"&gt;DELETE&lt;/span&gt;, so Rails is adopting a convention that hacks around this limitation. For example, the &lt;span class="caps"&gt;URL&lt;/span&gt; for the update case will look something like 
    &lt;pre&gt;.../model/id;update&lt;/pre&gt;
where the idea for using the semicolon &amp;#8221;;&amp;#8221; is based on some documentation written by Tim Berners-Lee himself (for &amp;#8220;Semantic Web&amp;#8221; concepts, I think).&lt;/p&gt;
&lt;p&gt;But there are more ways to &amp;#8220;embrace the &lt;span class="caps"&gt;CRUD&lt;/span&gt;.&amp;#8221; Consider a typical example with a &lt;code&gt;Person&lt;/code&gt; model and a &lt;code&gt;Group&lt;/code&gt; model, where one or more &lt;code&gt;Person&lt;/code&gt;s can be a member of one or more &lt;code&gt;Group&lt;/code&gt;s. Typically this is handled thusly:&lt;/p&gt;
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;    &lt;span class="keyword"&gt;class &lt;/span&gt;&lt;span class="class"&gt;Person&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="constant"&gt;ActiveRecord&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Base&lt;/span&gt;
      &lt;span class="ident"&gt;belongs_to&lt;/span&gt; &lt;span class="symbol"&gt;:group&lt;/span&gt;
      &lt;span class="punct"&gt;...&lt;/span&gt;
      &lt;span class="keyword"&gt;def &lt;/span&gt;&lt;span class="method"&gt;remove_from_group&lt;/span&gt; &lt;span class="punct"&gt;...&lt;/span&gt;
      &lt;span class="keyword"&gt;def &lt;/span&gt;&lt;span class="method"&gt;add_to_group&lt;/span&gt; &lt;span class="punct"&gt;...&lt;/span&gt;
      &lt;span class="punct"&gt;...&lt;/span&gt;
    &lt;span class="keyword"&gt;end&lt;/span&gt;

    &lt;span class="keyword"&gt;class &lt;/span&gt;&lt;span class="class"&gt;Group&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="constant"&gt;ActiveRecord&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Base&lt;/span&gt;
      &lt;span class="ident"&gt;has_many&lt;/span&gt; &lt;span class="symbol"&gt;:people&lt;/span&gt;
      &lt;span class="punct"&gt;...&lt;/span&gt;
      &lt;span class="keyword"&gt;def &lt;/span&gt;&lt;span class="method"&gt;remove_person&lt;/span&gt; &lt;span class="punct"&gt;...&lt;/span&gt;
      &lt;span class="keyword"&gt;def &lt;/span&gt;&lt;span class="method"&gt;add_person&lt;/span&gt; &lt;span class="punct"&gt;...&lt;/span&gt;
    &lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Where should those &lt;code&gt;add&lt;/code&gt; and &lt;code&gt;remove&lt;/code&gt; methods really go? &lt;span class="caps"&gt;DHH&lt;/span&gt; pointed out that if we &lt;i&gt;reify&lt;/i&gt; (not his term) the relationship between &lt;code&gt;Person&lt;/code&gt; and &lt;/code&gt;Group&lt;/code&gt;, that is, treat it as an model object in its own right, then we can use &lt;span class="caps"&gt;CRUD&lt;/span&gt; conventions to manage the relationship itself. In this example, a class &lt;code&gt;Membership&lt;/code&gt; could encapsulate membership of people in groups. The &lt;span class="caps"&gt;CRUD&lt;/span&gt; creation operation would add a &lt;code&gt;Person&lt;/code&gt; to a &lt;code&gt;Group&lt;/code&gt;, deletion of memberships would remove the relationship, &lt;i&gt;etc.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;Perhaps the most interesting thing about his keynote was how it demonstrated his thorough commitment to pushing design principles to their logically limit in Rails. Where most of us would have been satisfied with the current design, &lt;span class="caps"&gt;DHH&lt;/span&gt; sees that it can be made even more consistent to the &lt;span class="caps"&gt;CRUD&lt;/span&gt; vision, and thereby further increase the use of common (and automated) &lt;i&gt;conventions&lt;/i&gt;. No wonder Rails is so good!&lt;/p&gt;

&lt;h3&gt;Rails Application Optimization Techniques and Tools&lt;/h3&gt;
&lt;b&gt;Stefan Kaes&lt;/b&gt;
&lt;p&gt;Stefan has done an extensive analysis of Rails performance issues. His detailed talk listed some of his findings. He is working on a book that is due next year, published by Wiley, that promises to be valuable for developers concerned about optimizing performance.&lt;/p&gt;
&lt;p&gt;In a nutshell, he listed the following as the top performance problems:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;slow helper methods,&lt;/li&gt;
    &lt;li&gt;complicated routes,&lt;/li&gt;
    &lt;li&gt;associations, especially when loading one object retrieves all associated objects automatically,&lt;/li&gt; 
    &lt;li&gt;retrieving too much data from the database (related to the previous point), and&lt;/li&gt;
    &lt;li&gt;slow storage of session information.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For more details about his findings and recommendation, see Stefan&amp;#8217;s &lt;a href="http://railsexpress.de/blog/"&gt;blog&lt;/a&gt; and his recent &lt;a href="http://www.infoq.com/articles/Rails-Performance"&gt;InfoQ article&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;MetaRails&lt;/h3&gt;
There were many more interesting talks, but since I&amp;#8217;ve taken over a week to get this blog done, I&amp;#8217;ll finish with a comment on the excellent &lt;i&gt;MetaRails&lt;/i&gt; talk by Stuart Halloway, with an assist from his Relevance partner, Justin Gehtland.&lt;/p&gt;
&lt;p&gt;Stuart discussed some interesting uses of metaprogramming within the Rails core that make Rails the amazing environment that it is. Rails is a treasure trove of patterns and idioms that are well worth learning. As neither Stuart nor Justin are members of the core team, they provided an outsider&amp;#8217;s perspective.&lt;/p&gt;
&lt;p&gt;Stuart mostly praised the quality of the Rails code, but he pointed out one area where he felt it isn&amp;#8217;t &lt;span class="caps"&gt;DRY&lt;/span&gt; enough, the way many &lt;code&gt;ActiveRecord&lt;/code&gt; methods are aliased and then replaced with methods that add support for transactions, &lt;i&gt;etc.&lt;/i&gt; There are apparently several different areas where the same methods are aliased this way, where each alias provides a different &amp;#8220;enhancement.&amp;#8221; As these alias statements are not co-located, it would be easy for one such modification to stomp on another. Also, how do you ensure that one alias takes &amp;#8220;precedence&amp;#8221; (&lt;i&gt;i.e.,&lt;/i&gt; gets applied first) over another? For example, you might always want authentication and authorization to happen first. (Note that Stuart&amp;#8217;s follow-up &lt;a href="http://blogs.relevancellc.com/articles/2006/06/26/fixing-metarails"&gt;blog&lt;/a&gt; mentions that the &lt;span class="caps"&gt;DRY&lt;/span&gt; problem has been partially solved since he started his analysis.)&lt;/p&gt; 
&lt;p&gt;In fact, he described a classic case that motivates &lt;a href="http://www.aspectprogramming.com/home/aosd"&gt;Aspect-Oriented Programming&lt;/a&gt;. Even in dynamic languages like Ruby, where metaprogramming facilities are easy to use, &lt;span class="caps"&gt;AOP&lt;/span&gt; provides a &lt;i&gt;conceptual&lt;/i&gt; framework for thinking about certain design issues, like adding transactional behavior to persistent objects or invocation of authentication and authorization challenges before executing otherwise normal-looking methods. Yes, Ruby metaprogramming facilities allow you to implement &lt;span class="caps"&gt;AOP&lt;/span&gt;-like behavior, but you have to &amp;#8220;switch paradigms&amp;#8221; to do so. I don&amp;#8217;t know how Ruby implements &lt;i&gt;Object&lt;/i&gt;-Oriented behavior, but you could image that similar metaprogramming approaches are used or could be used if no OO support were provided. So, yes, you could do &lt;span class="caps"&gt;OOP&lt;/span&gt;, in this case, but isn&amp;#8217;t it nicer to &lt;i&gt;think&lt;/i&gt; in objects when you are writing OO code, rather than have to switch gears mentally and think in meta-object protocols? The same argument can be made about providing &lt;span class="caps"&gt;AOP&lt;/span&gt; facilities in a language, even if those facilities are relatively small additions. For example, &lt;a href="http://aspectr.sourceforge.net/"&gt;AspectR&lt;/a&gt;, an &lt;a href="http://www.aspectj.org"&gt;AspectJ-like&lt;/a&gt; Ruby clone, is &lt;a href="http://www.codecomments.com/archive327-2005-5-507143.html"&gt;only about 200 lines of Ruby code.&lt;/a&gt;&lt;/p&gt; 
&lt;p&gt;I&amp;#8217;m going to blog about the role of &lt;span class="caps"&gt;AOP&lt;/span&gt; in dynamic languages like Ruby in the next few days, so please check back. Also, I&amp;#8217;ll be doing a talk on &lt;span class="caps"&gt;AOP&lt;/span&gt; in Ruby and Python at the &lt;a href=""&gt;Dr. Dobbs Architecture and Design World&lt;/a&gt; in Chicago, July 17-20. I hope to see you there!&lt;/p&gt; 

&lt;h3&gt;RailsConf 2007&lt;/h3&gt;
Finally, it was announced that &lt;a href="http://live.oregoncc.org/iebms/coe/coe_p2_details.aspx?eventid=7202&amp;#38;cc=OCCCOE&amp;#38;oc=10&amp;#38;dict=27"&gt;next year&amp;#8217;s conference&lt;/a&gt; will be May 17-20 in Portland, Oregon.</description>
      <pubDate>Sun, 02 Jul 2006 23:13:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:8e410c37-880e-4372-8ada-1abf78428672</guid>
      <author>Dean Wampler</author>
      <link>http://blog.aspectprogramming.com/articles/2006/07/02/railsconf-2006</link>
      <category>AOP</category>
      <category>Ruby and Ruby on Rails</category>
      <category>Rails</category>
      <category>Ruby</category>
      <category>on</category>
      <category>RailsConf</category>
      <category>AOP</category>
      <category>MetaRails</category>
      <category>Metaprogramming</category>
      <trackback:ping>http://blog.aspectprogramming.com/articles/trackback/17</trackback:ping>
    </item>
    <item>
      <title>Aspect-Oriented Design: &amp;quot;Humane Pointcut Languages&amp;quot;</title>
      <description>&lt;p&gt;I started a discussion yesterday on the &amp;#8220;aspectj-users&amp;#8221; group about &lt;a href="http://dev.eclipse.org/mhonarc/lists/aspectj-users/msg05970.html"&gt;humane pointcut languages&lt;/a&gt;. The notion of &amp;#8220;humane interfaces&amp;#8221; in programming has been discussed by &lt;a href="http://www.martinfowler.com/bliki/HumaneInterface.html"&gt;Martin Fowler&lt;/a&gt; and in the context of user interfaces and product design by &lt;a href="http://jef.raskincenter.org/humane_interface/summary_of_thi.html"&gt;Jef Raskin&lt;/a&gt;.&lt;/p&gt;


This conversation was a spin-off of another &lt;a href="http://dev.eclipse.org/mhonarc/lists/aspectj-users/msg05960.html"&gt;thread&lt;/a&gt; where I made a mistake that I occasionally make. An AspectJ user wanted to apply some after advice after constructor calls in a class that has an annotation, &lt;em&gt;e.g.&lt;/em&gt;,
&lt;pre&gt;
  @MyAnnotation
  public class Foo {
    public Foo(...) {...}
    ...
  }
&lt;/pre&gt;

He needed help writing the pointcut and advice for this case. Without repeating the whole conversation here, at one point I remarked that
&lt;pre&gt;
  call( @MyAnnotation * *.new(..) )
&lt;/pre&gt;
matches constructors annotated with &lt;code&gt;@MyAnnotation&lt;/code&gt;, while
&lt;pre&gt;
  call( * (@MyAnnotation *).new(..) )
&lt;/pre&gt;
matches constructors in classes where the class has the annotation.

In fact, both are invalid expressions because the first &lt;code&gt;*&lt;/code&gt; is for the return type and there is no return type for constructors, so the first &lt;code&gt;*&lt;/code&gt; shouldn&amp;#8217;t be there.  Hence,  the correct statement is that
&lt;pre&gt;
  call( @MyAnnotation *.new(..) )
&lt;/pre&gt;
matches constructors annotated with &lt;code&gt;@MyAnnotation&lt;/code&gt;, while
&lt;pre&gt;
  call( (@MyAnnotation *).new(..) )
&lt;/pre&gt;
matches constructors in classes where the class has the annotation.
&lt;br/&gt;

	&lt;p&gt;This is the sort of mistake I make fairly often and I&amp;#8217;m sure beginners really struggle with the pointcut syntax, although it&amp;#8217;s generally great for experts because it is both succinct and powerful. However, sometimes a more &amp;#8220;human-readable&amp;#8221;, that is &amp;#8220;humane&amp;#8221;, syntax can be a real benefit.&lt;/p&gt;


	&lt;p&gt;In fact, I&amp;#8217;ve been thinking about expressive pointcut languages quite a bit recently, not so much in this context, but more in the context of higher-level &lt;span class="caps"&gt;AOP&lt;/span&gt; abstractions. As I said in the discussion thread, it bothers me that we discuss high-level concerns, say for example security, then turn around and write &lt;acronym title="Pointcut Definitions"&gt;PCD&lt;/acronym&gt;s using very low-level primitives that tend to reference specific classes, methods, &lt;em&gt;etc.&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;Of course, I&amp;#8217;m not the only person who thinks this way and the recent work on AO interface-based programming is a huge step towards making it possible to express aspects with appropriate levels of abstraction.&lt;/p&gt;


	&lt;p&gt;I would like to comment on this issue more in future blogs, but for now, let&amp;#8217;s return to the original problem and look at some things we might do to make &lt;acronym title="Pointcut Definitions"&gt;PCD&lt;/acronym&gt;s more humane.&lt;/p&gt;


	&lt;p&gt;The first thing I suggested in the thread is the addition of special keywords that could be substituted for some of the wild-cards:&lt;/p&gt;


	&lt;table style="border:1px solid black; background:#eee;"&gt;
		&lt;tr&gt;
			&lt;th style="text-align:left;"&gt;Keyword &lt;/th&gt;
			&lt;th&gt;Maps To:&amp;nbsp; &lt;/th&gt;
			&lt;th style="text-align:left;"&gt;Context &lt;/th&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;$any_return&lt;/code&gt; &lt;/td&gt;
			&lt;td style="vertical-align:middle;text-align:center;"&gt;&lt;code&gt;*&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; Used for any return type &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;$any_arg&lt;/code&gt; &lt;/td&gt;
			&lt;td style="vertical-align:middle;text-align:center;"&gt;&lt;code&gt;*&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; Used for any &lt;em&gt;one&lt;/em&gt; method argument &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;$any_arglist&lt;/code&gt; &lt;/td&gt;
			&lt;td style="vertical-align:middle;text-align:center;"&gt;&lt;code&gt;..&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; Used for zero-many method arguments &lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;code&gt;$any_type&lt;/code&gt; &lt;/td&gt;
			&lt;td style="vertical-align:middle;text-align:center;"&gt;&lt;code&gt;*&lt;/code&gt; &lt;/td&gt;
			&lt;td&gt; Used for any  type expression (class, interface, ...) &lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;




So, our previous &lt;acronym title="Pointcut Definition"&gt;PCD&lt;/acronym&gt; that matches calls to the constructors could be written
&lt;pre&gt;
    call( (@MyAnnotation $any_type).new($any_arglist) )
&lt;/pre&gt;

	&lt;p&gt;This is a little more readable, especially for new users, while experts will prefer the more terse form for its brevity.&lt;/p&gt;


	&lt;p&gt;As an aside, you could use a similar mechanism to support regular expression matching while minimizing the potential for confusion, as discussed &lt;a href="http://aspectprogramming.com/papers/The%20Challenges%20of%20Writing%20Reusable%20Aspects%20in%20AspectJ%20v3.pdf"&gt;here&lt;/a&gt;. Something like &lt;code&gt;$re(/(foo|bar)$/)&lt;/code&gt; to match names ending in &lt;code&gt;foo&lt;/code&gt; or &lt;code&gt;bar&lt;/code&gt;, for example.&lt;/p&gt;


Let&amp;#8217;s combine our new &lt;acronym title="Pointcut Definition"&gt;PCD&lt;/acronym&gt; with &lt;code&gt;after&lt;/code&gt; advice, to see a little more context. We want to &amp;#8220;bind&amp;#8221; the newly-created &lt;code&gt;Foo&lt;/code&gt; instance to a variable &lt;code&gt;foo&lt;/code&gt;. Handling newly-created objects is &lt;a href="http://www.eclipse.org/aspectj/doc/released/faq.html#q:adviseconstructors"&gt;tricky&lt;/a&gt;.
&lt;pre&gt;
    after() returning(Foo foo): 
      call( (@MyAnnotation $any_type).new($any_arglist) ) {
        ...
    }
&lt;/pre&gt;
Another approach, if we&amp;#8217;re using the &lt;code&gt;execution&lt;/code&gt; join point, is the following: 
&lt;pre&gt;
    after(Foo foo): 
      execution( (@MyAnnotation $any_type).new($any_arglist) ) &amp;#38;&amp;#38; this(foo) {
        ...
    }
&lt;/pre&gt;

However, the keywords are a small improvement. Let me suggest that a real &amp;#8220;humane&amp;#8221; &lt;span class="caps"&gt;PCD&lt;/span&gt; language should read more like English. Consider this rewriting of the same two expressions, using a made-up pointcut &lt;acronym title="Domain Specific Language"&gt;DSL&lt;/acronym&gt;:
&lt;pre&gt;
    after() returning(Foo foo): 
      call(constructors().takingAnyArgs().inClassesAnnotatedWith(@MyAnnotation)) {
        ...
    }
&lt;/pre&gt;
and
&lt;pre&gt;
    after(Foo foo): 
  execution(constructors().takingAnyArgs().inClassesAnnotatedWith(@MyAnnotation))
    &amp;#38;&amp;#38; bindNewlyConstructedObjectTo(foo) {
    ...
}
&lt;/pre&gt;

	&lt;p&gt;This syntax is inspired by the syntax of mocking frameworks like &lt;a href="http://www.jmock.org"&gt;JMock&lt;/a&gt; and equivalents in Ruby. Certainly my toy &lt;acronym title="Domain Specific Language"&gt;DSL&lt;/acronym&gt; could be improved; I made it up on the fly during the discussion thread yesterday.&lt;/p&gt;


	&lt;p&gt;However, because it reads like English, it is very self-documenting, making comprehension easier by AspectJ neophytes and even experienced AspectJ users who are new to the application. 
I think it&amp;#8217;s useful to remember that most code is &lt;em&gt;write once, read many&lt;/em&gt;. We may not like to type a lot, but a literate style pays dividends over time.&lt;/p&gt;


	&lt;p&gt;Note that the syntax of this &lt;acronym title="Domain Specific Language"&gt;DSL&lt;/acronym&gt; and the standard syntax express essentially the same pointcut language &amp;#8220;abstraction&amp;#8221; for AspectJ.&lt;/p&gt;


	&lt;p&gt;So, I think there is a place for a more &amp;#8220;humane&amp;#8221; form of the AspectJ pointcut &lt;acronym title="Domain Specific Language"&gt;DSL&lt;/acronym&gt;. Similarly, I think that we need &lt;acronym title="Domain Specific Languages"&gt;DSL&lt;/acronym&gt;s appropriate for higher-level &lt;span class="caps"&gt;AOP&lt;/span&gt; abstractions (&lt;em&gt;e.g.&lt;/em&gt;, at the design level) and ideally &lt;span class="caps"&gt;AOP&lt;/span&gt; &lt;acronym title="Domain Specific Languages"&gt;DSL&lt;/acronym&gt;s that are domain-specific for non-trivial domains.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Update 4/28/06:&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;Jonas Bon&amp;eacute;r wrote an interesting blog on &lt;a href="http://jonasboner.com/2006/04/24/domain-driven-pointcut-design/"&gt;Domain Driven Pointcut Design&lt;/a&gt; where he discusses good principles of pointcut design that minimize dependencies on fragile class details and instead rely on metadata annotations, &lt;em&gt;etc.&lt;/em&gt; He also makes an excellent argument that the &amp;#8220;language&amp;#8221; of those annotations should reflect the domain of the annotated class and not mix in other domains, like cross-cutting concerns.&lt;/p&gt;</description>
      <pubDate>Fri, 21 Apr 2006 11:25:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:c74cc194-7212-4b4c-b61f-7b8368cce687</guid>
      <author>Dean Wampler</author>
      <link>http://blog.aspectprogramming.com/articles/2006/04/21/aspect-oriented-design-humane-pointcut-languages</link>
      <category>AOP</category>
      <category>Java and AspectJ</category>
      <category>AOP</category>
      <category>AOSD</category>
      <category>AspectJ</category>
      <category>Design</category>
      <category>Humane</category>
      <trackback:ping>http://blog.aspectprogramming.com/articles/trackback/2</trackback:ping>
    </item>
    <item>
      <title>My Contract4J Article on developerWorks</title>
      <description>&lt;p&gt;This is my inaugural blog hosted on my own web sites. My previous blogs can be found &lt;a href="http://jroller.com/page/deanwampler"&gt;here&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;My article on &lt;a href="http://contract4j.org"&gt;Contract4J&lt;/a&gt; went live on Tuesday, April 11 at &lt;span class="caps"&gt;IBM&lt;/span&gt;&amp;#8217;s &lt;a href="http://www-128.ibm.com/developerworks/java/library/j-aopwork17.html"&gt;developerWorks&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;In the article, I introduce Design by Contract and describe how Contract4J supports DbC in Java, using AspectJ under the hood. I end the article with a discussion of the emerging trends in aspect-oriented design using interfaces. That is, how the familiar interface-based design we&amp;#8217;re used to in &lt;span class="caps"&gt;OOP&lt;/span&gt; is being extended to support aspects.&lt;/p&gt;


	&lt;p&gt;I intend to explore Aspect-Oriented Design in more detail in coming blogs. Please stay tuned!&lt;/p&gt;</description>
      <pubDate>Thu, 13 Apr 2006 13:34:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:9b3aabd1-3c77-4d2f-9f8c-27af98b37f24</guid>
      <author>Dean Wampler</author>
      <link>http://blog.aspectprogramming.com/articles/2006/04/13/my-contract4j-article-on-developerworks</link>
      <category>AOP</category>
      <category>Java and AspectJ</category>
      <category>Contract4J</category>
      <category>AOP</category>
      <category>developerWorks</category>
      <category>AspectJ</category>
      <trackback:ping>http://blog.aspectprogramming.com/articles/trackback/1</trackback:ping>
    </item>
  </channel>
</rss>
