Permalink
Browse files

Updated AOP post.

  • Loading branch information...
1 parent b01976a commit f790722cbd097f02ab353dec26b89feff228ad87 @andhapp committed Dec 30, 2013
@@ -121,6 +121,23 @@ <h1 class="entry-title">Aspect Oriented Programming</h1>
<a href="https://github.com/gcao/aspector">Aspector</a>. It provides a lot of examples
as well just in case you are stuck.</p>
+<h3>Why not just use Ruby Modules?</h3>
+
+<p>Ruby modules are similar but not exactly same as the AOP concept. One
+important difference is that you can apply an aspect (aspect is the
+piece of code with common functionality, like a module) to a class from
+outside, without opening the class. Here&#8217;s some aspector code snippet to
+elaborate the point:</p>
+
+<pre>
+TestAspect.apply A
+</pre>
+
+
+<p>Here A is the class, and TestAspect is the aspect. As you can see, you
+can just apply it from outside. Sorry, not very clear, but I didn&#8217;t want
+to tie the concept to a particular library implementation.</p>
+
<p>One good use case of using AOP concepts would be with something like
debugging, for example, a user performed an action and you want to check
the log for parameters that are getting passed in to methods, or what
View
@@ -4,7 +4,7 @@
<title><![CDATA[Plough => Ruby]]></title>
<link href="Plough => Ruby/atom.xml&#8221; rel=&#8221;self&#8221;/>
<link href="Plough => Ruby/&#8221;/>
- <updated>2013-12-30T11:30:03+00:00</updated>
+ <updated>2013-12-30T12:04:28+00:00</updated>
<id>Plough => Ruby/</id>
<author>
<name><![CDATA[andHapp]]></name>
@@ -55,6 +55,23 @@ briefly looked at is called
<a href="https://github.com/gcao/aspector">Aspector</a>. It provides a lot of examples
as well just in case you are stuck.</p>
+<h3>Why not just use Ruby Modules?</h3>
+
+<p>Ruby modules are similar but not exactly same as the AOP concept. One
+important difference is that you can apply an aspect (aspect is the
+piece of code with common functionality, like a module) to a class from
+outside, without opening the class. Here&#8217;s some aspector code snippet to
+elaborate the point:</p>
+
+<pre>
+TestAspect.apply A
+</pre>
+
+
+<p>Here A is the class, and TestAspect is the aspect. As you can see, you
+can just apply it from outside. Sorry, not very clear, but I didn&#8217;t want
+to tie the concept to a particular library implementation.</p>
+
<p>One good use case of using AOP concepts would be with something like
debugging, for example, a user performed an action and you want to check
the log for parameters that are getting passed in to methods, or what
View
@@ -124,6 +124,23 @@ <h1 class="entry-title"><a href="/2013/12/30/aspect-oriented-programming.html/">
<a href="https://github.com/gcao/aspector">Aspector</a>. It provides a lot of examples
as well just in case you are stuck.</p>
+<h3>Why not just use Ruby Modules?</h3>
+
+<p>Ruby modules are similar but not exactly same as the AOP concept. One
+important difference is that you can apply an aspect (aspect is the
+piece of code with common functionality, like a module) to a class from
+outside, without opening the class. Here&#8217;s some aspector code snippet to
+elaborate the point:</p>
+
+<pre>
+TestAspect.apply A
+</pre>
+
+
+<p>Here A is the class, and TestAspect is the aspect. As you can see, you
+can just apply it from outside. Sorry, not very clear, but I didn&#8217;t want
+to tie the concept to a particular library implementation.</p>
+
<p>One good use case of using AOP concepts would be with something like
debugging, for example, a user performed an action and you want to check
the log for parameters that are getting passed in to methods, or what
View
@@ -120,14 +120,14 @@
</url>
<url>
<loc>Plough =&gt; Ruby/2013/12/30/aspect-oriented-programming.html/</loc>
- <lastmod>2013-12-30T11:29:59+00:00</lastmod>
+ <lastmod>2013-12-30T12:02:59+00:00</lastmod>
</url>
<url>
<loc>Plough =&gt; Ruby/blog/archives/</loc>
- <lastmod>2013-12-30T11:29:59+00:00</lastmod>
+ <lastmod>2013-12-30T12:02:59+00:00</lastmod>
</url>
<url>
<loc>Plough =&gt; Ruby/</loc>
- <lastmod>2013-12-30T11:29:59+00:00</lastmod>
+ <lastmod>2013-12-30T12:02:59+00:00</lastmod>
</url>
</urlset>
@@ -35,13 +35,28 @@ Cross-cutting concern can be defined as any piece of code that's more widely
used across the application, for example, logging, security, or authentication, perhaps.
Something, like a before_filter in Rails controllers that's applied to a set of actions.
-
There are libraries that one could use to achieve same and even more
than before_filter functionality outside of Rails. The one that I
briefly looked at is called
[Aspector](https://github.com/gcao/aspector). It provides a lot of examples
as well just in case you are stuck.
+### Why not just use Ruby Modules?
+
+Ruby modules are similar but not exactly same as the AOP concept. One
+important difference is that you can apply an aspect (aspect is the
+piece of code with common functionality, like a module) to a class from
+outside, without opening the class. Here's some aspector code snippet to
+elaborate the point:
+
+<pre>
+TestAspect.apply A
+</pre>
+
+Here A is the class, and TestAspect is the aspect. As you can see, you
+can just apply it from outside. Sorry, not very clear, but I didn't want
+to tie the concept to a particular library implementation.
+
One good use case of using AOP concepts would be with something like
debugging, for example, a user performed an action and you want to check
the log for parameters that are getting passed in to methods, or what

0 comments on commit f790722

Please sign in to comment.