I added a boolean attribute that keeps record of ‘cheated’ status to each TrueFalse object.[/quote]
Even if it sounds as a good solution it is conceptually wrong as it merges the model with the controller (Always keep in mind the MVC pattern). If avoidable you should not try to modify the model of your program and try instead to encapsulate all the logic inside the controller.
if you also want to solve the “fourth challenge” …[/quote]
Personally I feel that putting a boolean property “DidCheat” in the TrueFalse class is a good (and proper) solution. It is, after all, tied to the question… Did the user cheat on this question? This is part of the model data. As an analogy, if you had a car object in a game and the user painted it red, would you not want to update the model data to indicate the new color? So, to me, this is the same type of scenario. What aspects of the question do we want to model? Of course the question itself and the correct answer… but also if the user cheated on it, or “painted it red”. Now if you want to use that model in another app, you are already set to be able to keep track of cheating on questions, no additional work or a new array is necessary.
In addition, this makes solving the “fourth” challenge incredibly easy. When the cheat button is pressed, just check the model data to see if that question was already cheated on, and if so remind the user they already cheated, what the answer was, and don’t go to the CheatActivity again.
Saying that “you should not try to modify the model of your program” seems kind of odd. Things in the real world change, and if we are attempting to model real world objects that the user can change in the real world, then that has to be reflected in the model. Again, back to the car model analogy. When you instantiate the car in a game, you might set a property IsBrandSpankingNew to true in the model. After driving the car off of the lot, you would want to modify that to false. So user hits button “Buy Car” and the model indicates that the car is new. Now user hits button “drive car” and you would want to change that to false. And the user may buy many cars and you want to keep track of this “new” status for all cars… what better place than in the car model? I see no difference here.
Just my .02