Skip to content

Instantly share code, notes, and snippets.

@squallcs12
Last active November 16, 2016 04:30
Show Gist options
  • Save squallcs12/af5cf63ff9c585d83f291b5a16d22cf2 to your computer and use it in GitHub Desktop.
Save squallcs12/af5cf63ff9c585d83f291b5a16d22cf2 to your computer and use it in GitHub Desktop.

Generally

I think all features has been implemented in rush, thus there too many coding standard has been violated

Python code style

not follow pep8 standard for python code

  • using tabs intention instead of spaces, spaces is recommended for replacing tabs long ago.
  • no space after : in dict declaration
  • import statements is not grouped and sorted
  • too many code duplication, eg: generating unique id in models
  • module level definition (class, module's method) is separated by only 1 empty line instead of 2 empty lines

Django code style

  • There is no admin in account and videos mean it's really hard to control the behavior of the system, also it's hard for QA testing too
  • All view have been implemented in only 1 file views, which is really hard for adding new features later, also it increases the changes of having code conflict when have multiple engineers work on same file.
  • The JSON response is not well defined. Sometime I see JSONResponse({"d"}, status=400), sometime JSONResponse("Unknown Video", status=400)
  • Since we use djangorestframework, we can use the defined statuses in that package, instead of using raw number response code
  • Test is mostly check for the response status code, not the expected result and behavior of the system, we can add more assertion to make tests have more meaningful.
  • Some part of code are not necessary, like this one
from email_info import *
EMAIL_USE_TLS = EMAIL_USE_TLS
EMAIL_HOST = EMAIL_HOST
EMAIL_HOST_USER = EMAIL_HOST_USER
EMAIL_HOST_PASSWORD = EMAIL_HOST_PASSWORD
EMAIL_PORT = EMAIL_PORT```
The last 5 lines is not eccessary
- what




> Written with [StackEdit](https://stackedit.io/).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment