Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Any open source tools discussed in Java Reflection in Action?

 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dr.Forman,
I just would like to know whether any open source tool is discussed in chapter-7 Code Generation of the book or not... There are a couple of tools out there which we can pick up and use. Do you discuss any of them in the book? Thanks...
 
author
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy,

Section 7.8 briefly discusses some of the concepts in Aspect-Oriented Programming (as realized in tools like Aspect/J). However, we don't go into a detailed discussion of the use of such tools or others like Jikes BT and Javassist.

Chapters 7&8 are more about prescribing a way to use reflection to solve problems. To do AOP-style programming, you can use reflection to examine an existing class and then generate another class that has additional capability. We call this class-to-class transformation.

In the book, we present ideas on problems to solve with this technique. We also provide a framework that facilitates performing the up-front examination of the source class, as well as the generation of the result class. Any of the excellent toolkits out there could be used in the way we prescribe in the book, but detailing their use was out of our scope.

When they last came through Austin, I heard one of the Lone Star Symposium (No Fluff Just Stuff) guys do a really interesting talk on generation tools and use cases. (off the top of my head, I'm not sure who--I'll post again if I can find it)

Hope this helps,

Nate
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Nate Forman:
To do AOP-style programming, you can use reflection to examine an existing class and then generate another class that has additional capability. We call this class-to-class transformation.



Thanks a million to your great explanation...

BTW, I have heard about class-to-class transformation from one of my colleagues at work... But I'm wondering if there are any other kinds of transformation else... If so, could you please give us a hints what they are? So that we can find more info later as well...

Thanks...
 
Nate Forman
author
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ko Ko,

My dad's the transformation enthusiast, so I'm going to defer this to him. He'll be available later in the week...

Best Regards,

Nate
 
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When talking about code generation the first thoughts went two ways:
- source code generation (with tools a la XDoclet)
- bytecode generation (excellently applied in aop frameworks, jdo implementations).

However while inspecting the existing classes you can generate your custom metadata model and from here the ways are infinite.

--
./pope
[the_mindstorm]
 
Nate Forman
author
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ali,

I've enjoyed your insightful postings.

When you say "custom metadata model," do you refer to MDA (Model Driven Architectures)? I haven't had a chance to do a lot of looking, but people have suggested that there seems to be potential synergy between that and reflection. Care to comment?

Best Regards,

Nate
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The first example that comes to my mind is the project i am currently involved in: TestNG. Using reflection (including annotations related reflection) we are building the testing flow metamodel that is later run according to suites/tests configurations.
As regards bytecode based metamodel I can think of JDO implementations, that are instrumenting according the persistent classes.

--
./pope
[the_mindstorm]
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Nate Forman:
When you say "custom metadata model," do you refer to MDA (Model Driven Architectures)? I haven't had a chance to do a lot of looking, but people have suggested that there seems to be potential synergy between that and reflection. Care to comment?



Oh... I have no idea about both the custom metadata model and Model Driven Architectures that u guys are talking about here... Could anyone of you shed a light on me for these things?

But I know that MDA is from OMG and it is kinda abstract system model and so and so... But I can't figure out the custom metadata model that Ali talked about is somehow related to the MDA... Thanks...
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here you can read an intro to MDA.
While my answer was not directly referring to MDA, I can probably see some usages out there .

--
./pope
[the_mindstorm]
 
author
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me follow-up on class-to-class transformations. There are many difference kinds of program transformations (for example, common expression elimination is one). However, I am especially interested in transformations that take a whole class and return a new class that has new property; this is a class-to-class transformation. Achieving class-to-class transformation is the way to modularize the properties that OO programers talk about (for example, persistent, atomic, and so on). This is one of the goals of AOP. This modularization may be achieved in many ways: with a new language (AspectJ), with bytecode manipulation (JBOSS does this), with metaclasses ("Putting Metaclasses to Work"), or through program generation (Chapters 7 and 8 of "Java Reflection in Action").
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ira, AspectJ and AspectWerkz are doing in background bytecode manipulation too.

--
./pope
[the_mindstorm]
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ira Forman:
Let me follow-up on class-to-class transformations. There are many difference kinds of program transformations (for example, common expression elimination is one). However, I am especially interested in transformations that take a whole class and return a new class that has new property; this is a class-to-class transformation. Achieving class-to-class transformation is the way to modularize the properties that OO programers talk about (for example, persistent, atomic, and so on). This is one of the goals of AOP. This modularization may be achieved in many ways: with a new language (AspectJ), with bytecode manipulation (JBOSS does this), with metaclasses ("Putting Metaclasses to Work"), or through program generation (Chapters 7 and 8 of "Java Reflection in Action").



Thank you very much for your most informative explanation to me about other transformations...

So now I can see that those other transformation are available in the modularizations that were listed above... I never know that before... Thanks a lot...
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ira Forman:
[...] with bytecode manipulation (JBOSS does this)[...]



What part of JBoss are you referring to?

--
./pope
[the_mindstorm]
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ali Pope:
What part of JBoss are you referring to?


The EJB container, if I remember correctly.
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Weird. Why should the ejb container do bytecode manipulation? Afaik they are using some interceptors that are proxy-based solution. Maybe the 4.0 series is doing bytecode manipulation, but i cannot comment on this - never had the time to dig into it.

--
./pope
[the_mindstorm]
 
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

Originally posted by Ali Pope:
Weird. Why should the ejb container do bytecode manipulation? Afaik they are using some interceptors that are proxy-based solution.


Here's a quote from Bill Burke's article:
JBoss AOP does bytecode manipulation to attach interceptors

And I think I remember JBoss 3.x doing bytecode manipulation as well, even before the birth of JBoss AOP.
 
You're not going crazy. You're going sane in a crazy word. Find comfort in this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic