Skip to content

Code review #1

Description

@GraphtyLove

Code review

You did well

  • Good readme, well explained.
  • Adding liscence and explainations for contributing.
  • Code is working fine.
  • Details you added like drawing.
  • Good usage of recursivity.

Can can improve

Repo

  • Separate dev requirements from prod requirements.
  • If you use pre-commit hooks explain what it is and how to set-it-up in the readme.
  • You can put your code in a src folder to divide 'configs' and repo-related files from the code.for example:
/
  | .gitignore
  | .pre-commit-config.yaml
  | README.md
  | LICENSE.txt
  | requiremetns.txt
  | src
  |  | main.py
  |  | utils
  |  |  | __init__.py
  |  |  | game.py
  |  |  | string_utils.py

Code

  • No need to specify that __init__() is a constructor, try to avoid obvious comments to keep the code clean.

  • Bad usage of __ to make attributes/methods private. Read more about it here remember that:

    • _foo: this is just a convention, a way for the programmer to indicate that the variable is private.

    • __foo: this has real meaning: the interpreter replaces this name with _classname__foo as a way to ensure that the name will not overlap with a similar name in another class.

  • Use clear variables names. Example: what is gen? What for i in gen is meaning?

  • Don't use i in a for loop if it's not an index.

    • for name in names is ok
    • for i, name in enumerate(names) is ok
  • Comments focus on the why more than the waht. Ex: pluralize doc string. + no need to type function + type doctring.

  • Declare your attributes in the constructor intead of in __initialize_game it makes think clearer. Then you just need to re-define the values in __initialize_game.

  • Why do you define a getter for the errors while not doing it for the rest? Try to stay consistant.

  • You can use "\n" in prints to do line breaks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions