MVC Design Pattern

Discussion in 'Java' started by M. Hamzah Khan, Jun 4, 2007.

  1. -----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-----
     
    M. Hamzah Khan, Jun 4, 2007
    #1
    1. Advertisements

  2. a
    Are you sure MVC is suitable for this problem? Do you have any data that
    could be considered your "model"?
     
    Richard Reynolds, Jun 4, 2007
    #2
    1. Advertisements

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


    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-----
     
    M. Hamzah Khan, Jun 4, 2007
    #3
  4. M. Hamzah Khan

    Corona4456 Guest

    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.
     
    Corona4456, Jun 4, 2007
    #4
  5. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1
    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-----
     
    M. Hamzah Khan, Jun 5, 2007
    #5
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.