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:
- turnis an instance variable of the- Gameclass. Is it better design for- turnto be a local, instance, or class variable? Justify your answer.
- user_inputis a local variable in the- getInputmethod of the- ConnectFourclass. Is it better design for- user_inputto be a local, instance, or class variable? Justify your answer.
- RANKSis a class variable of the- Cardclass. Is it better design for- RANKSto be a local, instance, or class variable? Justify your answer.
- tokensis an instance variable of the- ConnectFourclass. Is it better design for- tokensto be a local, instance, or class variable? Justify your answer.
- Playeris a class in- warGame.py. Is it better design for the- Playerclass to be defined in- warGame.pyor in- game.py? Justify your answer.
- WarGame's- stepmethod takes as a parameter- dummyInput. 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.