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.

asked Jul 2, 2013 at 6:07

2 Answers 2

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

answered Jul 2, 2013 at 15:46
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.

answered Jul 2, 2013 at 11:10
2
  • Yes, I know it doesn't, I like to differ with your answer, generally these design are for future maintenance of the software. Commented Jul 2, 2013 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. Commented Jul 2, 2013 at 11:19

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.