users
[Top] [All Lists]

RE: [cinjug-users] Looking for AOP framework

To: "Witt, Mike (OH35)" <mike.witt@xxxxxxxxxxxxx>
Subject: RE: [cinjug-users] Looking for AOP framework
From: "Witt, Mike (OH35)" <mike.witt@xxxxxxxxxxxxx>
Date: Tue, 11 May 2004 08:19:27 -0700
Cc: users@xxxxxxxxxx
Delivered-to: mailing list users@cinjug.org
Mailing-list: contact users-help@cinjug.org; run by ezmlm
Thanks for your thoughts Eric.  This snippet from the Spring reference
should give you an idea of what I'm talking about for Hibernate support.
I'm not necessarily sure what all this means myself, but I'm looking to find
out.  It does strike me as a fairly valuable feature to have, but I'm not
sure (since I know next to nothing about AOP at this point) if this is
something that could just as easily be done in AspectJ.


>From the Spring Reference ...

* Session management. Spring offers efficient, easy, and safe handling of
Hibernate Sessions. Related code
using Hibernate generally needs to use the same Hibernate Session object for
efficiency and proper
transaction handling. Spring makes it easy to transparently create and bind
a session to the current thread,
using either a declarative, AOP method interceptor approach, or by using an
explicit, template wrapper
class at the Java code level. Thus Spring solves many of the usage issues
that repeatedly arise on the
Hibernate forums.
* General resource management. Spring application contexts can handle the
location and configuration of
Hibernate SessionFactories, JDBC datasources, and other related resources.
This makes these values easy to
manage and change.
* Integrated transaction management. Spring allows you to wrap your
Hibernate code with either a
declarative, AOP style method interceptor, or an explicit 'template' wrapper
class at the Java code level. In
either case, transaction semantics are handled for you, and proper
transaction handling (rollback, etc.) in
case of exceptions is taken care of. As discussed below, you also get the
benefit of being able to use and
swap various transaction managers, without your Hibernate related code being
affected. As an added
benefit, JDBC-related code can fully integrate transactionally with
Hibernate code. This is useful for
handling functionality not implemented in Hibernate.
* Exception wrapping. Spring can wrap Hibernate exceptions, converting them
from proprietary, checked
exceptions, to a set of abstracted runtime exceptions. This allows you to
handle most persistence
exceptions, which are non-recoverable, only in the appropriate layers,
without annoying boilerplate
catches/throws, and exception declarations. You can still trap and handle
exceptions anywhere you need to.
Remember that JDBC exceptions (including DB specific dialects) are also
converted to the same hierarchy,
meaning that you can perform some operations with JDBC within a consistent
programming model.

-----Original Message-----
From: Eric Galluzzo [mailto:egalluzzo@xxxxxxxxxxxxxxx]
Sent: Tuesday, May 11, 2004 10:58 AM
To: Witt, Mike (OH35)
Cc: users@xxxxxxxxxx
Subject: Re: [cinjug-users] Looking for AOP framework


Witt, Mike (OH35) wrote:

>I'm planning to spend some time experimenting with AOP.  I'm wondering if a
>de facto AOP framwork is emerging.  Right now, I'm looking at AspectJ and
>Spring, there are probably others as well.  So, I'm looking for an opinion
>on which framework to use based on:
>
>- What's the standard
>  
>
Standard?  There is no standard -- at least not yet.  At this stage, 
you'll probably have to use popularity as a criterion instead.  I 
believe that AspectJ is the most established AOP framework presently.  
An up 'n' coming one, though, is dynaop (https://dynaop.dev.java.net/).  
It's gaining a lot of "mindshare," or whatever the trendy word for 
people having heard of a product is.

>- Which one is the most newbie friendly - available documentation and
>tutorials
>  
>
As for documentation and tutorials, I don't really know.  I think most 
all of them have "good enough" documentation to get one started.  I 
think the main problem is getting into the AOP mindset, since it's quite 
different from the "plain" OO mindset.  (I certainly haven't gotten 
there yet.)  As far as I can tell, most of the frameworks have 
comparable feature sets (with minor differences), although they 
implement those features in different ways.  I kinda like dynaop's 
approach: they use JSR-175-style metadata comments in regular Java code 
to implement aspects.  This means that you can use your existing tools 
and augment them if desired with aspect-related functionality.  That 
sounds like a fun AOP project, actually. :)

>- Eclipse plug-in support
>  
>
AspectJ now lives under the Eclipse umbrella, so they probably have the 
best (most integrated) Eclipse support.

>- Hibernate support
>  
>
Not sure what you want here.  Hibernate is an existing library; how 
would aspects "support" hibernate, except for in the generic sense that 
they would support any type of library?

>- Most active development community
>  
>
Not sure on this one either.  AspectJ is probably the biggest, most 
established project.  However, this may be because some of the other 
projects achieve the same functionality in much less code.

    - Eric

<Prev in Thread] Current Thread [Next in Thread>