Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] ITD - why public ?

Hi Roger,
yes, it has a meaning if you are separating the concern of "gui rendering" of an otherwise already specific class, inside a separate aspect.

For example, I could have a business logic class, say a bean with getters and setters and some business methods. Then, I want to make that object able to persist itself. Since persistence is another aspect of my application, it could be implemented in a separate aspect that adds some methods (like public boolean persist(), public boolean delete() etc..) to that class (or to a number of classes, if you already use JPA or similar technology) and have your code physically separated by the main business logic code.

Same goes if you want that bean to be able to render itself in HTML or as a Swing GUI object.

That is the rationale behind the private fields in ITDs: fields required by the persistence layer or the GUI layer are private to those aspects only, so that you are forced to reduce coupling.

Simone

2010/5/29 Roger Gilliar <roger@xxxxxxxxxx>
Hi Simon

thanks a lot for this helpfull explanation.


ut still I would recommend to move ALL the code in the aspect, having those fields private, and having every method that must access those fields inside the same aspect, which reduces coupling a lot.

--------------------------------------------
since most of the code in my JFrame is accessing those gui elements I would have to move most of the code to the aspect. Not sure if this would be that helpfull. Nevertheless I was looking for a way to emulate the partial class concept from .Net in Java and it's now possible with Aspectj.


Regards
 Roger

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top