Results 1 to 6 of 6
  1. #1
    dismal-it is offline Member
    Join Date
    Aug 2013
    Posts
    8
    Rep Power
    0

    Default Feedback on aspect-oriented programming in java

    Hi,

    I am working on an application framework where I would like to use aspect-oriented programming. Anyone has any experience of this kind of development ? I see huge benefits to being able to reuse "concerns" across objects (so I like the concept), but I have no clue how to best implement it (and by the way if it really works and scales).

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,452
    Rep Power
    20

    Default Re: Feedback on aspect-oriented programming in java

    Moved from Advanced Java

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,280
    Rep Power
    6

    Default Re: Feedback on aspect-oriented programming in java

    Well read up about AspectJ then and take away the gap in your knowledge.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  4. #4
    dismal-it is offline Member
    Join Date
    Aug 2013
    Posts
    8
    Rep Power
    0

    Default Re: Feedback on aspect-oriented programming in java

    Hi both,

    thanks for your answer. I read some stuff about aspectJ and here are a few more questions:
    - I understand there are many aspect oriented implementations in java. Shall I consider AspectJ as the "reference" one ?
    - did you hear about any plan to support this directly in the java language ?
    - Also, do you know how widespread this technology is ? I posted the question in the "advanced" forum here as I had the impression it was still somehow a "niche" / high-tech (none of the "flesh" developers I talked to knew about it, at least here in France);
    - I understand that code generation could be somehow an alternative to aspect oriented programming. Do you know what the pros / cons would be ?
    - Do you have any experience of debugging complex applications using aspect-oriented programming in production ? I have a fear that to understand what happens, sometimes, you will have to go through all the aspect code to see if by chance, there is one interacting with your "business" method.

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,280
    Rep Power
    6

    Default Re: Feedback on aspect-oriented programming in java

    1) Up to you. Check them both out and see which one you like more. I tend to go with the better documented one.
    2) Nope. Java is an OO language and its going to stay that way. Perhaps one of the other JVM languages is more to your liking though, check out Groovy and Scala for example.
    3) You're correct, and its going to stay that way in the world of the Java language since Java is an OO language
    4) Perhaps you mean byte code instrumentation, not code generation. Its a necessary evil for me, only to be used by APIs that actually need to instrument classes (such as ORM packages). I'm allergic to most forms of generation, since it produces stuff I did not create and design
    5) Generally when debugging you're only interested in what your own code does, not what the underlying machinery does. There will be no difference to debugging.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    dismal-it is offline Member
    Join Date
    Aug 2013
    Posts
    8
    Rep Power
    0

    Default Re: Feedback on aspect-oriented programming in java

    Quote Originally Posted by gimbal2 View Post
    1)
    4) Perhaps you mean byte code instrumentation, not code generation. Its a necessary evil for me, only to be used by APIs that actually need to instrument classes (such as ORM packages). I'm allergic to most forms of generation, since it produces stuff I did not create and design
    An example of what I meant by code generation would be to define a data object (e.g. person being made of field lastname (String 120), firstname (String 50), birthdate (Date)... ) in a meta-language, and then have some script (I write them often in java but there are better options probably) to generate the sql, the jdbc transactions, the import from xml / csv for batch processing, and even sometimes the screen.

    I see the following advantages to this approach:
    - very fast at execution (my experience is that most subtle approach include a lot of introspection / flexible runtime execution is slow on a production server);
    - transparent debugging / clear stack trace (when something fails, I know exactly where;
    - easy to define a base / automatically generated logic and some customized extensions (typically, an abstract class is generated, and the concrete class is developped by the programmer for the specific logic);
    - very quick impact analysis when something changes (red dots in eclipse appear in a second, as opposed to runtime logic that sometimes need end-to-end tests for errors to be caught).

    With this kind of logic, my feeling is that I can get away with "some" aspects, as I can define, for example a generic transaction logging logic as part of my automatically generated JDBC getters and setters. Of course, it is not a generic logic but probably good enough in my context

Similar Threads

  1. Replies: 0
    Last Post: 12-28-2012, 04:01 PM
  2. new to object oriented programming and arrays
    By maximumammo in forum New To Java
    Replies: 11
    Last Post: 04-22-2012, 09:25 PM
  3. help for Object Oriented Programming RMI
    By clapton in forum New To Java
    Replies: 0
    Last Post: 03-20-2012, 07:42 PM
  4. Replies: 1
    Last Post: 08-04-2011, 10:22 AM
  5. Help in object oriented programming .
    By renu in forum New To Java
    Replies: 18
    Last Post: 10-26-2010, 08:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •