Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7847061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:46:45+00:00 2026-06-02T17:46:45+00:00

Views are, by definition, supposed to be logicless. When a user interacts with a

  • 0

Views are, by definition, supposed to be logicless. When a user interacts with a view, it notifies its controller. When state changes in the app, the controller notifies the view. But I’m confused as to the nature of the communication between view and its controller when it’s time to re-render some or all of the view.

Let’s pretend I’m making a two player card game. The view is responsible for showing the deck, the discard pile, the cards in players’ hands, and any other UI components. When a player plays a card, the view needs to reflect this change, and it’s the controller’s job to notify the view to do so. Which of these options is the best way to handle this event?

  1. The controller tells the view simply to re-draw. The view, through the controller, has access to all the parameters of the game state. It uses these parameters to re-draw everything including the deck, both player’s hands, etc.

  2. The controller tells the view that a player played a card. The view knows that when a player plays a card, only that player’s hand needs to be re-drawn. Like option 1, the view uses the parameters of the game state to determine how to re-draw the player’s hand.

  3. (Similar but different from 2) The controller tells the view to re-draw that player’s hand and passes it all the parameters needed to do so. The view has no access to game parameters.

  4. Any other approach I’m missing?

Option 1 seems to be the easiest two write because the view is stateless — it just re-draws everything every time. But for that same reason, it is very wasteful. We don’t need to draw both player’s hands when just one player played a card. It’s also difficult to do things like animation because every time we re-draw, we’re essentially throwing away our old canvas and building a fresh one with all new view components.

On the other end of the spectrum, option 3 seems to be best in terms of removing logic from a view, but it comes with some issues. First, I’ve found it more difficult to write because it’s imperative that all the proper messages are sent to the view. If any are missed, the view won’t properly reflect the state of the app. Second, it seems like a full re-draw is still necessary at times for when, say, the user is restoring a saved game in progress.

In both options 1 and 2, the view “pulls” data about the game state whereas this data is “pushed” to it in option 3. Should views be able to request information like this, or does this imply that there’s too much logic in the view?

Thanks in advance for any light you can shed on this topic!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T17:46:46+00:00Added an answer on June 2, 2026 at 5:46 pm

    MVC is not the best fit for all applications. It also depends on what kind of frameworks which are available.

    By not taking the platforms/frameworks into account I’ll say that HMVC (Hierarchical model–view–controller) or PAC (Presentation–abstraction–control) is a better fit for you since a page can be splitted up into several parts (three views: hands & deck).

    When it comes to native applications (GUI) it seems like MVP is preferred over MVC.

    Martin Fowler has a nice article about the different GUI patterns here: http://www.martinfowler.com/eaaDev/uiArchs.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In django/contrib/auth/views.py there is the definition of the logout view : def logout(request, next_page=None,
I have the following view definition in my asp.net mvc website: <% Using Ajax.BeginForm(UsrCtlChangePassword,
I tried to execute scripts from [1] in model database and user-defined databases but
Ok, What the app is supposed to do: displays a start button, when pressed
Context: creating a jsonP service with mvc controller methods which provides a definition of
I'm trying to restructure tightly coupled portions of an ember.js app, particularly views and
I am a little confused as to the definition of classes as Models or
In this rails app: https://github.com/ryanb/govsgo/blob/master/app/views/authentications/index.html.erb There is a form that as 'new_user_path' Where is
Ok, back with not necessarily a true definition of a question but need some
I have inserted a definition for a view in $template_dir/sql/$someTableName.sql file. (create or replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.