[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

AOP and Ruby

Luís Miguel Lourenço

5/24/2005 5:04:00 PM

Hello,

I'm working with some friends on an AOP comparison across several
programming languages. We're doing this as a small project for a
college course. We want to talk about AOP and how it's been implemented
in various languages, it's influence on them and how it's being
accepted by their various communities.

We've chosen Ruby as one of the languages. Java and C++ are the other
ones. This seemed like a good idea since they stand at different levels
of dynamism. Dynamism as in metaclasses, reflection, open classes,
eval, etc.

I've searched the mailing list archives and googled for information
about AOP and Ruby, but haven't come up with much. AspectR seems to
have been abandoned. I did find a proposal for AOP in Ruby up at
RubyGarden. Not much more though. Can someone give us some pointers to
more information? My impression is that there isn't much interest in
AOP from the Ruby community in general.

I'm somewhat convinced that Ruby, compared to many other languages,
enables one to effectively cut back tremendously on code scattering,
with it's reflection capabilities, metaclasses, eval, etc. But from
what I've understood from AOP it aims to bring direct semantics to code
that crosscuts a program. So, I'm not sure the techniques used in Ruby
would qualify as AOP. I have however seen an interesting quote by Dave
Thomas (http://c2.com/cgi/wiki?AspectsAndDynami...) in which he
says "Once you have decent reflection and metaclasses, AOP is just part
of the language.". I'm not sure I agree with it. I agree in the sense
that I can probably avoid code scattering using Ruby, I don't agree
because I have to think in terms of metaclasses, method aliasing,
reflection and whatnot to get the code in there. I don't know how big a
deal that is. Or if it is a deal at all. Any thoughts on this?

Luís Miguel Lourenço


4 Answers

Jim Weirich

5/24/2005 5:49:00 PM

0


Luís Miguel Lourenço said:
> I'm working with some friends on an AOP comparison across several
> programming languages. We're doing this as a small project for a
> college course. We want to talk about AOP and how it's been implemented
> in various languages, it's influence on them and how it's being
> accepted by their various communities.
> [...] interesting quote by Dave Thomas [...] in which he
> says "Once you have decent reflection and metaclasses, AOP is just part
> of the language.". I'm not sure I agree with it. [...]

What an interesting project, I wish you luck.

I have a (non-ruby) friend who is very interested in AOP. He and I have
talked about this on and off about AOP in a language like Ruby. My
position is very similar to Dave Thomas's that you quoted above. Once you
have powerful meta programming abilities in a language, the AOP becomes
pretty straight forward.

Here's a thought. One can think of AOP as a Domain Specific Language for
doing a limited set of metaprogramming operations. Since Ruby is
recognized as fairly good language to use to implement DSLs, so using Ruby
directly to do AOP stuff isn't a far stretch.

Another data point. AspectR provides a large percentage of AOP
capability. Its only around 200 lines of code! Compare that to AOP in
Java or C++ aspect lanaguages and you begin to get a feel for how easy AOP
is in Ruby.

One final suggestion: Propose a couple AOP like operations that you would
like to see. Then implement them in Ruby and compare it to the
implementation in Java/C++. I would like to see some of the operations
you would suggest.

--
-- Jim Weirich jim@weirichhouse.org http://onest...
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)



Trans

5/24/2005 9:30:00 PM

0

After creating numerous implementations of varyng degrees of capability
in this regard I can tell you from experience: It is possible to do AOP
in Ruby utilizing reflection and metaclasses, but it certinaly isn't
convenient nor generally efficient, and for obvious reasons. These
features were not designed with AOP in mind.

So what are you after exactly? Are you in search of an active AOP
implementaiton other then AspectR? Or how to AOP in Ruby "as-is" with
its current meta-features. Or somehing more general? I may be able to
provide some answers, more or less.

T.

Caio Tiago Oliveira

5/24/2005 9:43:00 PM

0

Luís Miguel Lourenço, 24-05-2005 14:03:
> Hello,
>
> I'm working with some friends on an AOP comparison across several
> programming languages.
[snip]
>
> I've searched the mailing list archives and googled for information
> about AOP and Ruby, but haven't come up with much. AspectR seems to have
> been abandoned. I did find a proposal for AOP in Ruby up at RubyGarden.
> Not much more though.
[snip]


http://rubygarden.com/ruby?AspectOr...



Lionel Thiry

5/24/2005 10:21:00 PM

0

Luís Miguel Lourenço a écrit :
> Hello,
>
> I'm working with some friends on an AOP comparison across several
> programming languages. We're doing this as a small project for a college
> course. We want to talk about AOP and how it's been implemented in
> various languages, it's influence on them and how it's being accepted by
> their various communities.
>
> We've chosen Ruby as one of the languages. Java and C++ are the other
> ones. This seemed like a good idea since they stand at different levels
> of dynamism. Dynamism as in metaclasses, reflection, open classes, eval,
> etc.
>
> I've searched the mailing list archives and googled for information
> about AOP and Ruby, but haven't come up with much. AspectR seems to have
> been abandoned. I did find a proposal for AOP in Ruby up at RubyGarden.
> Not much more though. Can someone give us some pointers to more
> information? My impression is that there isn't much interest in AOP from
> the Ruby community in general.
>
> I'm somewhat convinced that Ruby, compared to many other languages,
> enables one to effectively cut back tremendously on code scattering,
> with it's reflection capabilities, metaclasses, eval, etc. But from what
> I've understood from AOP it aims to bring direct semantics to code that
> crosscuts a program. So, I'm not sure the techniques used in Ruby would
> qualify as AOP. I have however seen an interesting quote by Dave Thomas
> (http://c2.com/cgi/wiki?AspectsAndDynami...) in which he says
> "Once you have decent reflection and metaclasses, AOP is just part of
> the language.". I'm not sure I agree with it. I agree in the sense that
> I can probably avoid code scattering using Ruby, I don't agree because I
> have to think in terms of metaclasses, method aliasing, reflection and
> whatnot to get the code in there. I don't know how big a deal that is.
> Or if it is a deal at all. Any thoughts on this?
>
> Luís Miguel Lourenço
>
>

Had a sight at Objectteams ruby?

http://www.objectteams.org/...

http://sourceforge.net/projects/ro...

Good work! :)

--
Lionel Thiry

Personal website: http://users.skynet....