This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

This week book give away

 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please give a great big JavaRanch welcome to: Ramnivas Laddad, author of "AspectJ in Action".
This week we are giving away copies of this book to four lucky winners who participate in this forum.
So say hi and start asking your questions!
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome Ramnivas!
We'll see whether this book promotion gets my aspects going... (I have to admit I haven't put as much effort as I would've liked into learning what it's all about)
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ramnivas,
I am not as well read in Java and design developments as I should be and the "JavaRanch Book Promotion" was pretty much the first I had heard of AOD and AspectJ. Having been brought up on OOAD, I would appreciate it if you could either list the salient differences/similarities between AspectJ and the "traditional" way of creating objects, or (if you think that is too lazy ), suggest some articles to get me started.
Many Thanks,
Ant
[ September 16, 2003: Message edited by: Ant B ]
 
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ramnivas,
Welcome to the Ranch, from a fellow Manning author!
 
Ranch Hand
Posts: 8943
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ramnivas
 
Author
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Everybody,
I am very delighted to be here and discuss your AOP/AspectJ questions.
About Ant Burge's question:
Crosscutting concerns � requirement, design, or implementation that span multiple modules are abound in practice: logging, tracing, dynamic profiling, service-level agreement, policy enforcement, pooling, caching, concurrency control, security, transaction management, business rules, and so forth. Traditional implementation of these concerns requires you to fuse their implementation with the core concern of a module. For example, a simple Account class may incorporate some code to address all of the above concerns. With aspect-oriented programming, you can implement each of the concern in a separate module called aspect.
Consider logging concern as an example. Traditional implementation may look something like:

With AspectJ, you can keep you core classes oblivious of logging:

That�s it. You can put this aspect into any Java program, compile using AspectJ compiler, and start seeing log output generated (which will be the same as the output generated by traditional implementation).
Now imagine a typical project with 100s, if not 1000s of classes and imagine a typical project with many other crosscutting present in a system. AspectJ can make life vastly simple by separating each individual concerns away from core business logic. Please read sample chapters (http://www.manning.com/laddad).
-Ramnivas
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ramnivas,
I�m finished reading your book and its just great(advice for Javaranchers: buy it!). But a friend of mine asked me something that I really couldn�t answer. The question is about the fine-grained granularity about logging. For example, supose I have the following class:
public class {
public someMethod(String foo) {
String myVar = "java";
// do some stuff

//At this point I would like to know the value of myVar.
// How can I do this (with aspectj)?

// do some more stuff

}
}
The question is how aspectj can show the value of some private variables for some method, just for logging (to know if its value, in the middle of a computation, is right)?
Thank you,
Julio Cesar
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I doubt that you can define pointcuts in the middle of a method. Could someone confirm this?
 
Ramnivas Laddad
Author
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Julio Cesar,
Thanks for buying and reading my book.
Lasse is right. You cannot define a poincut to capture join points that modify a local variable. The reason for such constraint is (while perhaps useful for very fine grained logging) it can lead to unstable crosscutting. You can, however, access assignment or read-access to a instance and class data member inside a method as well as calls to other methods.
-Ramnivas
 
Ant Burge
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ramnivas,
thanks very much for the in depth answer: I was just expecting a link and a "go and work it out for yourself" type comment!
I can see now why you would want to use this over standard OOP. Time to get learning!
Thanks again,
Ant
 
My name is Inigo Montoya, you killed my father, prepare to read a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!