Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

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

share|improve this answer

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.

share|improve this answer
    
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 2 '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 2 '13 at 11:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.