Model View Controller

4 views
Skip to first unread message

tuxta

unread,
Jul 24, 2008, 2:35:38 AM7/24/08
to Gold Coast Java Users Group
Hi all,

Im a newbie, at University in my second year, so lots of java stuff is
still quite challenging for me.
Anyway, I was wondering what other people thought about using the
Model, View Controller method on small apps. I can totally understand
the reasons behind it, but with the small app I am working on at the
moment it just seems like extra code/maintenance for no real benefit.

Am I being naive? should I stick to the MVC pattern regardless as good
practice? Or is it not so evil in this case to pack the Model and View
together?

I know this is hardly the level of question this group will work with,
but as there was no other post I thought I would ask.

Tuxta

Keith

unread,
Jul 24, 2008, 5:01:39 AM7/24/08
to Gold Coast Java Users Group
Hi Tuxta,

Write your app without MVC, then rewrite it with. Then you are
learning!

Keith.

Lee Butts

unread,
Jul 24, 2008, 5:59:38 AM7/24/08
to gc...@googlegroups.com
I personally haven't written any proper Swing apps, but I know for web, MVC makes the most sense to me. For a really trivial application with little scope for re-using the model classes, it could be overkill.

I'd try some googling on swing design patterns, see what you turn up.

I also like Keith's suggestion (if you have time), try it both ways!

2008/7/24 Keith <davidso...@gmail.com>:

Steven Tucker

unread,
Jul 24, 2008, 7:38:44 AM7/24/08
to gc...@googlegroups.com
Hmm, good point.
Ill do that, and then I can make up my own mind.

Thanks Keith.

warwickhunter

unread,
Jul 26, 2008, 8:58:05 PM7/26/08
to Gold Coast Java Users Group
I have used various forms of MVC. Quite often the nature of
the platform or the framework you are using dictates the style
of MVC. In many cases the framework collapses the view and
controller into the one class. (e.g. Swing) In some cases such
as Android the view and controller are separate and leads you
to naturally go for the full MVC.

The most common practice I have used is to have a separate
model, even if you combine the view and controller into one.
The separate model has paid off when you have to implement
a GUI history to support the Back button and allow the user
to traverse back through the stack of screens. Having a separate
model in this case means you can just store the model in a
screen history list and not the entire screen. This can help
on low memory devices (STB, mobile phone etc).

Even if you don't need a screen history a separate model that
can be serialised can be useful for saving and restoring the
state of the GUI.

Warwick

Steve Dalton

unread,
Jul 27, 2008, 12:15:52 AM7/27/08
to gc...@googlegroups.com
That's cool - I understand some of the reasons for MVC in GUI apps -
but hadn't thought of the screen history angle.

You done much playing around with Android? I have something running on
my Nokia n810 - but have no apps for it at the moment. Have installed
the SDK and watched some of the videos - but haven't written anything
yet... hopefully will have a go soon... looks very cool.

Steve

--
I did have a signature, but the dog ate it.

google:steve.dalton | skype:spidieman | msn: m...@steve.dalts.net | yahoo:daltonsp
| aol: spidie100 | twitter: @spidie | mynetfone:09203861

Reply all
Reply to author
Forward
0 new messages