aop

Yet another AoP vs IoC/DI Question

Hello, I'm stuck and I'd appreciate your opinions on the subject. I want to implement INotifyPropertyChanged for my entities. I can't figure out which way is the best and why. The only obvious difference to me is that AoP is a little faster since everything gets done at compile-time while using IoC/DI it's easier to change behaviors lat...

Java: Is it possible to automatically add log statements to methods ?

Most of the methods in my application are written like this: public void m() { long t1 = System.currentTimeMillis(); log.info("begin - m()"); /* method body */ long t2 = System.currentTimeMillis(); log.info("end - m(), took " + (t2 - t1) + "ms."); } I wish I could simply annotate my method and have the log statem...

spring 3 AOP anotated advises

Trying to figure out how to Proxy my beans with AOP advices in annotated way. I have a simple class @Service public class RestSampleDao { @MonitorTimer public Collection<User> getUsers(){ .... return users; } } i have created custom annotation for monitoring execution time @Target({ ElementType.M...

JSF, Exception Logging using a aopalliance MethodInterceptor

I would like to log the exceptions that are thrown when serving JSF files in the same way other exceptions are logged in our web application. We annotate classes with logged exceptions with @LoggedExceptions and a MehtodInterceptor is matched against those classes with Guice AOP (This should be very similar for other implementations of ...

How to handle injecting dependencies into rich domain models?

In a web server project with a rich domain model (application logic is in the model, not in the services) how do you handle injecting the dependencies into the model objects? What are your experiences? Do you use some form of AOP? Like Springs @Configurable annotation? Load time or build time weawing? Problems you encountered? Do you u...

Is PostSharp a good way to profile code running in production?

I would like to run profiling code against some services running in testing and production. My plan is to use PostSharp to implement a class that looks like public class TimerAttribute : OnMethodBoundaryAspect { //some data members //... public override void OnEntry(MethodExecutionEventArgs eventArgs) ...

How do I execute a block of code with PostSharp when the application exits?

Presently, I am checking the method name in the OnMethodBoundaryAspect.OnExit method: [Serializable] public class TimerAttribute : OnMethodBoundaryAspect { public override void OnExit(MethodExecutionEventArgs eventArgs) { if(eventArgs.Method.DeclaringType.Name == "Program" && eventArgs.Method.Name == "Main") ...

Cross-cutting logging in Ruby

I'm trying to add logging to a method from the outside (Aspect-oriented-style) class A def test puts "I'm Doing something..." end end class A # with logging! alias_method :test_orig, :test def test puts "Log Message!" test_orig end end a = A.new a.test The above works alright, except that if I ever needed to do...

How to introduce AOP into productive software development?

I know this question has been asked before, but this was one and a half years ago, though I thought it might be the time for a re-questioning. I also recognized it might be seen as subjective, but I guess there are objective reasons for/against AOP. I would be interested in who is using AOP in software development and also why or why no...

Have you used Perf4J to collect and analyze performance metrics in Java app?

Did you use Perf4J in your Java application to collect and analyze performance stats? What was the typical pattern (using log files, utilities, UI, JMX, etc.)? Did you use annotations and AOP-based features? Did you use any JMX integration? How did you handle production configuration? Did you include performance stats views/rep...

Is aspect oriented programming useful for providing implementations for interface based programming?

I was just curious about the subject. I have never used aspect oriented programming (intentionally), and I have only a small amount of knowledge about it. Here's my question (using logging as the typical use-case): If i have an existing interface based paradigm for example consider the pseudo-code class MyClass implements Loggable { ...

AspectJ vs. Spring AOP vs. JBoss AOP for exception handling

I'm writing a webservice to an external system. My service wrapper class has a number of methods which call all the soap interface of the webservice. The call can throw an exception which should then automatically trigger a reconnect to the webservice. To handle that scenario I'd like to use AOP such that all methods which call the SO...

AOP use cases? ........

Hi, I'd like to make a picture of what are the possible cases for effective invovement of AOP in application design. All I have met so far is: logging-related security checks transaction management tweaking of a legacy application Anything else? (It doesn't have to be necessarily Spring's proxy based AOP - rather JBoss AOP.) (Rela...

Has anybody succeeded in using JBoss AOP in Tomcat?

HI, I'm failing to deploy my application using JBoss AOP within a Apache Tomcat 6.0.16 server. I'm using the VM arg -Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader I also have added the jboss aop jars to the classpath. The server and the webapp is starting but I'm getting this error: INFO: Unknown loade...

What AOP tools exist for doing aspect-oriented programming at the assembly language level against x86 application files for native OS X and MS-Windows native executables?

Looking for a tool I can use to do aspect-oriented programming at the assembly language level. For experimentation purposes, I would like the code weaver to operate native application level executable and dynamic link libraries. I have already done object-oriented AOP. I know assembly language for x86 and so forth. I would like to be...

Why is post-compilation code injection a better idea than pre-compilation code injection?

So we all know that C# doesn't have a C-like macro pre-processor (and there's a good thread on why here). But now that AOP is gaining traction, it seems like we're starting to do stuff with post-processors that we used to do with pre-processors (bear in mind that I am only getting my feet wet with PostSharp so am perhaps off base). I am...

Advice on AOP with C#

I have an ASP.NET 3.5 SP1 Webforms Application. I use the MVP pattern (supervising controller) with DI (autofac). My presenters call to the repository contracts defined in my Domain (DDD) which are implemented in an Infrastructure project. The repository methods the presenters call can hork, so I need to log exceptions and then set an...

Influencing AOP with attributes via IoC; code-smell or elegant?

I'm using StructureMap at the moment, generally with convention-based (Scan()) auto-configuration, and I'm looking to add decorator-based caching into the pipeline. If I configure it manually that is fine, but Scan() is just so convenient when you get lots of dependencies... I'm toying with noting cache suggestions on the interface(s), ...

Procedure for exception handling (catch, log, report, fix) in end user desktop app

Hi I'm starting a new project, a end-user desktop application. I'm a concerned about what will happened if (ok, when) the end-user gets an unhandled exception. Asking the user to help me reproduce the bug is not an acceptable option. As I see it I'm left with one option: to upload an error report to my server. Years ago when I were a...

How to intercept a static method call in C#

Hi All, I'm trying to implement some sort of Aspect Oriented Programming in C#, where I had some small success but found some important limitations. One of those limitations is the capability to intercept the call to a static method. For example, suppose We have the next object: public class SampleObject { public SampleObjectPro...