... | @@ -374,9 +374,17 @@ repository](https://git-community.cs.odu.edu/tkennedy/python-workshop/-/tree/mas |
... | @@ -374,9 +374,17 @@ repository](https://git-community.cs.odu.edu/tkennedy/python-workshop/-/tree/mas |
|
Let us start with the Player class. Note that the code is fully documented with
|
|
Let us start with the Player class. Note that the code is fully documented with
|
|
pydoc documentation and type hints.
|
|
pydoc documentation and type hints.
|
|
|
|
|
|
*Note: The use of `class Player(object):` is a holdover from Python 2.* In
|
|
**Note:**
|
|
modern Python 3, it should not be used. The `(object)` should be omitted. The
|
|
|
|
line should be `class Player:`.
|
|
- The use of `class Player(object):` is a holdover from Python 2.* In modern
|
|
|
|
Python 3, it should not be used. The `(object)` should be omitted. The line
|
|
|
|
should be `class Player:`.
|
|
|
|
|
|
|
|
- The `Player` class as written violates the MVC (Model-View-Controller)
|
|
|
|
design pattern and S.O.L.I.D. The `Player` class should ony handled
|
|
|
|
representing a single player. All user interaction should be handled
|
|
|
|
outside the class.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```python
|
|
```python
|
... | | ... | |