• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Do we need AOP ?

 
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is a snippet from an article by Martin Fowler -
(discovered in the Process Forum - Architecture and SDLC)
Who Needs An Architect
"My reservation of Aspect-Oriented Programming
is that we already have fairly
good techniques for separating aspects
of programs, and we don�t use them. I
don�t think the real problem will be
solved by making better techniques for
separating aspects. We don�t know what
should be the aspects that need separating,
and we don�t know when it is worth
separating them and when it is not."
What would your reply be ?
regards
[ September 17, 2003: Message edited by: HS Thomas ]
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just to give some context, the post is available at https://coderanch.com/t/130278/Agile/Architecture-SDLC
I think everyone can have a different opinion, and thus provide a different answer to this question. One thing that is generally accepted is that software becomes more and more complex and that OO will not be able to go alone and provide support for solving this complexity. OO is very good at providing a view of the world in terms of objects that represent localizable concerns. The problem is that software is not only made of localizable artifacts. For instance, security is usually an aspect of software systems that is not easily localizable with traditional OO techniques. Just look at the JDK sources and you will see that lots of methods in java.lang invoke a check*() method before doing their job in order to see whether the caller has the permission to execute the method or not. This would better be encapsulated in some aspect that would contain all security-related code of the JDK, so that when a change in the security policies is needed, you just go there and do the change instead of remembering where the h**l you need to do all the necessary changes. You can be sure you will forget to perform some changes and your system will be broken.
So, AOP will NOT replace OOP but it will elegantly complement it. OOP will be responsible for dealing with localizable concerns (objects) and AOP will take care of modularizing all concerns that cut across several objects or components (security, transaction, etc). In my opinion, one reason why AspectJ is a superset of the Java language is because AOP does not aim at killing OOP but only at complementing it and making it better. So instead of reinventing the wheel, Gregor & Co just reused what Java offered and enhanced it with a couple constructs.
Now, you are free to use AOP or not, you should never be constrained to use it. I would say that AspectJ and AOP in general is useful as soon as a certain complexity threshold has been attained in the software system under development. Of course, it would be better to figure out whether this threshold will be attained or not before attempting to use AspectJ in a project. Personally, we have been using AspectJ since the beginning and now all our software rely on that and we don't regret our choice.
[ September 17, 2003: Message edited by: Valentin Crettaz ]
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well said , Valentin and also a great link you posted.

we already have fairly
good techniques for separating aspects
of programs, and we don�t use them


What are the fairly good techniques and why don't we use them is REALLY what I'd like to know.
Thanks in advance!
regards
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since this is Ralph Johnson's opinion, I guess he is the best person to answer that. I don't really see what the "fairly good techniques for separating aspects of programs" are.
I would answer that question with another question (I know this is bad ): if those techniques are "fairly good" as he mentions why don't we use them already? Why did a whole bunch of people recognize the need for developing new techniques for separating "aspects" and created a whole community on Aspect-Oriented Software Development (AOSD)?
I do however agree with the fact that it is not easy to identify the aspects present in a system and also that we don't know exactly when it is good to separate them.
[ September 17, 2003: Message edited by: Valentin Crettaz ]
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I do however agree with the fact that it is not easy to identify the aspects present in a system and also that we don't know exactly when it is good to separate them.


You've just started my next question.
Should there be something added to *Refactoring* to extract separate concerns and make them aspects ? Is there any work in this area.
(Considering Martin Fowler seems against AOP , perhaps not!)
Or is it a super programmer guide's (architect's) territory rather than a programmers ?
regards
[ September 17, 2003: Message edited by: HS Thomas ]
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Why did a whole bunch of people recognize the need for developing new techniques for separating "aspects" and created a whole community on Aspect-Oriented Software Development (AOSD)?


Perhaps they are lemmings
(Ramnivas please note this graemlin usually means the poster is joking !)
No seriously, how would you convert a sceptic like Johnson to dealing with aspects ?
What sort of scenarios, rules can you use to show that here is where aspects could be beneficial in layman terms ?
(Valentin has made a good start!)

regards
[ September 17, 2003: Message edited by: HS Thomas ]
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Considering Martin Fowler seems against AOP , perhaps not!
Please note that the statement quoted in Martin's article comes from Ralph Johnson which does not imply that Martin is against AOP!
 
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How many langauges support AOP ? Are there more than AspectJ?
 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
AspectWerkz is another framework for AOP. I am a bit confused by your 1st question though. Does a language need to support AOP ?
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, there are many implementations of AOP. You can check them out at http://www.aosd.net/technology/index.php
 
Pradeep bhatt
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bhushan Jawle:
AspectWerkz is another framework for AOP. I am a bit confused by your 1st question though. Does a language need to support AOP ?



From Ramnivas

AspectJ is an aspect-oriented programming language (that uses Java as the base language), much like Java is an object-oriented programming language.

 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Please note that the statement quoted in Martin's article comes from Ralph Johnson which does not imply that Martin is against AOP!


Sorry Valentin. That was very badly phrased. I have searched the web and Martin Fowler is remarkably silent about AOP.

If refactoring is for OOP perhaps there should be an equivalent for discovering aspects in AOP - Crosscutting for AOP so it would be natural for the programmer to discover aspects ?
Perhaps Raminvas covers this in his book ?

regards
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Refactoring (the activity) is not for OOP. It (the activity) can be applied to practically any type of code from assembly to C++ and Perl. It's just that we need to learn a new set of refactorings (the subject) that lead to better structured aspect code.
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aaah!
So you could refactor to POJOs or AJOs (Aspect Java Objects )
Who'll be rewriting the refactoring book ? (And I've just bought that. )
Thanks for making that clear, Lasse.
In order to get answers one must exhibit a lack of knowledge.
regards
 
Pradeep bhatt
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://c2.com/cgi/wiki?WhatIsRefactoring
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Pradeep for the link but it didn't answer my question.
regards
 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I love Martin Fowler don't get me wrong he is a genius but think it should be pretty easy to figure out the basics of what should be an aspect and what shouldn't just follow good OOP design.
A Car class should have only code which relates to being a car and nothing else, anything else should be an aspect.
[ September 17, 2003: Message edited by: Andre Mermegas ]
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Who'll be rewriting the refactoring book ?

Whoever has managed to gather proven AOP patterns and repeatable steps to follow... and who has enough balls to write a sequel for "The Bible."

And I've just bought that.

Don't worry, Refactoring will be Good Stuff for years to come
 
Author
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow, woke up this morning and saw that there are already 17 replies. Great community!
Refactroring and AOP are not at odds. It is much easier to add aspects to a well-refactored code and aspects are a useful way to refactor (a crosscutting concern out of) an existing piece of code.
Traditional (OO) refactroring can take you only up to a point. Look at the logging example in https://coderanch.com/t/91659/java/week-book-give-away. The logger code is already refactored out (into standard logging toolkit) and no traditional technique can take _logger.logp(..) code out of each method in Account and Customer class. Chapter 10 of AspectJ in Action (available for free download) shows conventional code and AspectJ-based code to perform authorization. You will see that in conventional implementation, there is a lot of code, but not much left to refactor. AspectJ-based solution takes out all that code out of core module and put it in a reusable aspect.
-Ramnivas
 
Pradeep bhatt
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone send me AOP tutorial link.
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know The tutorial for AOP but here are a couple of pages full of links to AspectJ related papers and publications:
http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/publications.html
http://www.parc.com/research/csl/projects/aspectj/default.html
I also bumbed into this AspectJ tutorial once.
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes we do. Need AOP that is.
regards
 
Bhushan Jawle
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or you can try this tutorial
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No seriously, how would you convert a sceptic like Johnson to dealing with aspects ? --HS Thomas
I have invited Ralph Johnson and Martin Fowler to participate in this discussion
[ September 18, 2003: Message edited by: Valentin Crettaz ]
 
Pradeep bhatt
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I will invite Ralph Johnson and Martin Fowler to participate in this discussion


When are the coming here?
 
Life just hasn't been the same since the volcano erupted and now the air is full of tiny ads.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic