0

I am working on a large Java project which employs the model-view-controller pattern. Should I use a different event for each action (to let the views communicate with their respective controllers)? Or is it better to use the same event multiple times to reduce overhead? The events I am talking about are only triggers, i.e. they do not carry additional information. I tend to implement the first option, but have a lot of similar (except for the name) event classes now.

What is considered "good" programming practice?

  • I generally use a different controller class for each event because I prefer simplicity over reducing code duplication in my designs. – Gilbert Le Blanc Jan 26 '15 at 19:00
  • @GilbertLeBlanc So basically you have only one event handler method in each controller class? – ben Jan 28 '15 at 16:38
  • Yes, one event handler method. I may have other methods depending on the complexity of the controller logic – Gilbert Le Blanc Jan 28 '15 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.