Question

I was looking to better the framework that we had built for our Swing application. I wanted to bring in Spring and introduce aspects. I am new to both Spring and aspects. I was wondering, is it good practice to say layout the components as an aspect? For example:

The below is my class in a typical swing panel:

public class Panel extends JPanel{
    public Panel(){
        initComponents();
        layoutComponents();
    }
} 

I was wondering, if I remove the call to layoutComponents and apply it as an aspect in the spring config file. Have a separate class that performs the 'layout-ing' and apply that as an aspect rather than do the layout in the Panel class. Is this the kind of scenario an aspect is used for?

Was it helpful?

Solution

I don't think this will be useful, since aspects are related to cross-cutting concerns, while here you are trying to lay out components of a widget within the widget itself. So where is the cross-cutting?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top