Converting app to MVC and running it in both console and gui

Posted by terence6 on Stack Overflow See other posts from Stack Overflow or by terence6
Published on 2010-06-12T16:45:03Z Indexed on 2010/06/12 16:52 UTC
Read the original article Hit count: 331

Filed under:
|
|
|

I have a simple java gui calculator, with 3 number systems (there are some bugs but that doesn't matter now). Currently all code is in one file. My task is to rewrite it as MVC, and add possibility to run it in either gui or console mode. How should I divide this program to organise it as M-V-C ? Is it written properly enough to add console functionality to it? (guess I'll have to change all methods invoking to JLabel Output to something simply storing an output String as a model argument and then having View to get it).

Here's the starting code :

http://paste.pocoo.org/show/224566/

Here's what I already have :

Main :
http://paste.pocoo.org/show/224567/
Model :
http://paste.pocoo.org/show/224570/
View :
http://paste.pocoo.org/show/224569/
Controller :
http://paste.pocoo.org/show/224568/

I don't have view in my model so I can't call to Output. That's the first problem I can see.

© Stack Overflow or respective owner

Related posts about java

Related posts about mvc