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 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?

share|improve this question
    
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 at 19:00
    
@GilbertLeBlanc So basically you have only one event handler method in each controller class? –  ben Jan 28 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 at 17:56

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.