2

I am developing an SWT application (it's basically an Eclipse plugin, so I need to use SWT). Currently my design is as follows:

  • Model: In model, I have POJOs which represents the actual fields in views.
  • View: It is a dumb layer, it contains just UI and contains no logic (not even event handlers)
  • Controller: It acts as a mediator b/w those two layers. Also it is responsible for creating view layer, handling events etc.

Basically I have created all of the controls in view as a static like this public static Button btnLogin and in controller I have a code like this:

public void createLoginView(Composite comp) {
    LoginFormView.createView(comp);  //This createView method is in view layer ie LoginFormView
    LoginFormView.btnLogin.addSelectionListener(new SelectionListener() {
        //Code goes here
    });  
}

Similalrly I have done for other views and controls. So that in main class and other classes I am calling just createLoginView of controller. I am doing similar thing for other views.

So my question, is what I am doing is correct? Is this design good? Or I should have followed any other approach. Since I am new to SWT and Eclipse plugin development (basically I am Java EE developer having 4+ years of exp). Any tips/pointers would be appreciated.

Pradeep Simha
  • 71
  • 1
  • 6

2 Answers2

1

The MVC Design Pattern that you implemented is definitely good, but I would also encourage you to implement the OOPs in it. It would only then serve your purpose better.

Here are few links, which should help you understand it better;

  1. N-Layer Architecture

  2. OOPS

JNL
  • 904
  • 2
  • 8
  • 18
0

I assume you have the eclipse plugin development guide at hand, it does not mention any specific design you should/could follow so I guess as long it it gets the job done. it's good.

Sunny Patel
  • 163
  • 3
  • Yes, I know it doesn't, I like to differ with your answer, generally these design are for future maintenance of the software. – Pradeep Simha Jul 02 '13 at 11:14
  • Yes, Your MVC style is good. It enables future maintenance to be easy as well as, additional functionality to be added with ease. So overall the design is a good. – Sunny Patel Jul 02 '13 at 11:19