Design Discussion Lab
Due Friday at the beginning of class
Objectives
- To analyze software design decisions
Motivation: Throughout this class, we'll talk a lot about design decisions. You and/or your professors have been making design decisions for awhile.
Design Discussion
Let's consider some design decisions from the provided code. For each of the following questions, first confirm my first intro/set up statement. Then, in a document, answer the questions:
turn
is an instance variable of theGame
class. Is it better design forturn
to be a local, instance, or class variable? Justify your answer.user_input
is a local variable in thegetInput
method of theConnectFour
class. Is it better design foruser_input
to be a local, instance, or class variable? Justify your answer.RANKS
is a class variable of theCard
class. Is it better design forRANKS
to be a local, instance, or class variable? Justify your answer.tokens
is an instance variable of theConnectFour
class. Is it better design fortokens
to be a local, instance, or class variable? Justify your answer.Player
is a class inwarGame.py
. Is it better design for thePlayer
class to be defined inwarGame.py
or ingame.py
? Justify your answer.WarGame
'sstep
method takes as a parameterdummyInput
. What purpose does it serve?
Synthesis and Reflection
- Hopefully, in your process of writing the explanations, you got some clarity about how to determine what kind of variable should be used to represent various information. Go back and refine your answers, as applicable, with the clarity you had at the end.
- With that clarity, what questions should you ask to determine if a variable should be a local, instance, or class variable? Answer in your document.
- What made reading/understanding the code easy? What made it difficult? How could it be improved to make it more readable/understandable?
Submitting your assignment
Show Professor Sprenkle your assignment during the beginning of class on Friday.
Grading (10 pts)
You will be graded on making a good-faith effort in answering the design questions.