views:

41

answers:

1

I have been using AOP for "classic" things like logging and security for a while and am starting to take it further.

One problem I come across frequently with desktop applications is the need to store user-specific data locally. To that end, I have built a component that works well for me that stores data as XML in an application-specific subfolder of the LocalApplicationData folder (on Windows, but the concept applies to any OS).

Each application needs to store it's own data, but I have also built a code library where several components also need to store data.

One approach I could take is to tightly couple each of my components that need the local storage service to my implementation of local storage. However, a change to the interface of that local storage engine would be expensive.

Is this problem domain well-suited to AOP? Are there better approaches? Are there pitfalls that I'm not seeing?

+1  A: 

I really don't see the cross cutting concern which would make this a problem for AOP to solve.

Simply define a little API for storing the information. Make your library implement that interface. Put everything together with Spring, any DI Tool or manual glue code and you are done.

Jens Schauder