Activity log design issue in web application .. Whatabout AOP ?

Hi guys. ..

I am working on a big web application in which there is module called activity log which actually logs most of the activities one perform in application like make a payment , defere the payment , issue the check etc. Almost all components in the application less or more use this component.

Now what is my issue is its design sucks. Every time a new activity has to added one has to add a separate class for that and make a call at a particular place in other component depending on some logic. sometime it becomes a nightmare to maintain all this.

I am sure there should be better way to do it .without making a call to this component every othere class.

I dont know much about AOP. Is AOP got some solution for that.? or any design pattern I should use to make it maintainable or simple to add new activities whenever need arise.

Thanks

HibernFan.

[907 byte] By [hibernfana] at [2007-10-2 7:35:28]
# 1

> Hi guys. ..

> I am working on a big web application in which there

> is module called activity log which actually logs

> most of the activities one perform in application

> like make a payment , defere the payment , issue the

> check etc. Almost all components in the application

> less or more use this component.

> Now what is my issue is its design sucks. Every time

> a new activity has to added one has to add a separate

> class for that and make a call at a particular place

> in other component depending on some logic. sometime

> it becomes a nightmare to maintain all this.

> I am sure there should be better way to do it

> .without making a call to this component every othere

> class.

>

> I dont know much about AOP. Is AOP got some solution

> for that.? or any design pattern I should use to make

> it maintainable or simple to add new activities

> whenever need arise.

You are thinking exactly the right thing. AOP is born for this sort of thing, and it addresses exactly the problem you've experienced: Move all that code that's duplicated with every new activity into the advice class.

You can do AOP if you have AspectJ or, better yet, Spring.

If not, you can think of Filters as a kind of AOP. Since this is a Web app you can write a Filter that does the logging for you.

Either way, you've nailed the idea. Good thinking.

%

duffymoa at 2007-7-16 21:17:00 > top of Java-index,Other Topics,Patterns & OO Design...