Wich class of the Square Dance Game represents the Model, View and Controller

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Wich class of the Square Dance Game represents the Model, View and Controller

BigBang
I've already finished the course. It was an incredible experience.

In retrospect, some questions still remain unanswered for me. For example, I would like to understand the MVC model better.

The Coursera course explained that the SquareGame class represents the controller. Since the Square class handles graphical elements, I assume that is the class for view. The Main class remains for the model.

Because the Squaregame class takes care of the logical aspects, doesn't it also take on the role of model? Can someone explain the concept to me in more detail using the Square Dance Game?
Reply | Threaded
Open this post in threaded view
|

Re: Wich class of the Square Dance Game represents the Model, View and Controller

Neleus
Square Dance Game does not really have much logic at all, it is a simple application which simply moves the square as far as possible in current direction and then changes direction based on user input, that's it. One could argue that really the program only has a View and a Controller. Main doesn't really do much else than start the application by calling run in SquareGame.

While I don't think Square Dance Game is a good example in showcasing the distinct areas of responsibility that Model, View, and Controller should have according to the pattern's theory, it still showcases the inherent principle: Controller mediates between Model and View while Model and View are not aware of each other. That's the gist of MVC I took away from learning the pattern in university.