MVC Design Pattern

M

M. Hamzah Khan

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGZEXMy+Jv+Mp4qC8RAnI4AKCUucKeDUBth/jdtVkDtHKIBHxjFgCfXBkR
hGevqaDYivOms+73m6srv5Q=
=SXLF
-----END PGP SIGNATURE-----
 
R

Richard Reynolds

M. Hamzah Khan said:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGZEXMy+Jv+Mp4qC8RAnI4AKCUucKeDUBth/jdtVkDtHKIBHxjFgCfXBkR
hGevqaDYivOms+73m6srv5Q=
=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

M. Hamzah Khan

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Richard said:
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
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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGZJOky+Jv+Mp4qC8RApZyAJ98Wu4awjmU8f19Oignh6f0xsuWNQCdFE4f
cyqYNLSCDTVj4mRwMSNOHDM=
=zR/h
-----END PGP SIGNATURE-----
 
C

Corona4456

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

M. Hamzah Khan

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGZR6wy+Jv+Mp4qC8RApCuAJ4hvBU8o5KSUAVWHDTwv8vzm2NJ3gCeNBg/
dbsnyttJqTJ0z/aYagdBqGo=
=2Vvn
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top