Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

MVC in Java

Name: Anonymous 2009-05-09 4:33

Hay guise. There are a bunch of sites out there that praise the MVC pattern up and down, but I can't seem to find anything but extremely trivial examples of it being put to use.

The deal is, I'm working on a Java project for school (it's a calendar.. how fun) and we're supposed to be utilizing MVC. To maintain a strict separation of view and controller, which is the usual problem spot for overlapping functionality, we simply moved all of the action and mouse listeners for the various windows and components into one huge controller class. To determine where events are coming from we either A) set action commands if it's an actionlistener, or B) name each component and have a bunch of if/else statements to see how we should handle the event.

This worked out ok in the beginning, but now it's just a huge clusterfuck. Everything would be so much easier if we could just use the traditional addActionListener(this) + implementing actionListenerfor each class or the good old addActionListener(new ActionListener(){... method, especially because a lot of the actual events don't even touch the backend, they just deal with modifying the view.

I guess the question I have is, how do you actually implement an MVC pattern in a real program? Should only the actions that will directly interface with the backend of the program be handled by the controller? There has to be a better way >:O

Name: Anonymous 2009-05-09 8:43

>>5
Ok, Java programmers considered harmful then.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List