Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2007

Tip: Looking for answers? Try searching our database.

MVC Design Pattern

Thread view: 
M. Hamzah Khan - 04 Jun 2007 18:03 GMT
Hi everyone,

I'm not really sure if this is the right place to be posting this since
its more of a general programming question but, I'm making a small
program in Java which I'm trying to use the MVC design pattern.

In this program I need to make the "computer" find a solution for a game
when the user enters some values.

So I was wondering, would the "computer" be inside the model or the
control? And I was also wondering, would you make a new class for the
"computer", and invoke its methods through the control, or just include
it in the control class?

I was thinking it would be in the control, but I just wanted to know
what everyone else thinks.

Hamzah Khan

- --
M. Hamzah Khan
Website: http://www.hamzahkhan.com
Richard Reynolds - 04 Jun 2007 23:19 GMT
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
[quoted text clipped - 29 lines]
> =SXLF
> -----END PGP SIGNATURE-----

a
Are you sure MVC is suitable for this problem? Do you have any data that
could be considered your "model"?
M. Hamzah Khan - 04 Jun 2007 23:35 GMT
> Hi everyone,
>
[quoted text clipped - 14 lines]
>
> Hamzah Khan

> a
> Are you sure MVC is suitable for this problem? Do you have any data that
> could be considered your "model"?

I'm actually just using MVC just to see how to use it, but the game is
supposed to a board on which there are "pegs" which will be removed by
the computer.

I'm considering the model to be the board.

Is that not correct? :S

It should still work OK with MVC, although I guess its not the best
place to use it, right?

Hamzah

- --
M. Hamzah Khan
Website: http://www.hamzahkhan.com
Corona4456 - 04 Jun 2007 23:55 GMT
Your board is your view, the status of the board (i.e. which pegs are
still on the board and where) is the model, the computer is your
controller.  User clicks on a peg on the view, the computer reacts to
that click and tells the model to remove the peg at the given position
and the model then tells the view to update itself.
M. Hamzah Khan - 05 Jun 2007 09:28 GMT
> Your board is your view, the status of the board (i.e. which pegs are
> still on the board and where) is the model, the computer is your
> controller.  User clicks on a peg on the view, the computer reacts to
> that click and tells the model to remove the peg at the given position
> and the model then tells the view to update itself.

Ahhh that makes sense now.

Thank you :D

Hamzah

- --
M. Hamzah Khan
Website: http://www.hamzahkhan.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.