Skip to content

Coding Guidelines

Logan Pulley edited this page Oct 3, 2020 · 2 revisions

Sorry if this document isn't super organized yet. I'm just going to jot a bunch of things down for now.

Web page structure

  • Use the REST API as much as possible to communicate with the server
    • scoring events, and game starts or pauses, etc.
  • Don’t use Django templating to load in data (use the API)
    • This reduces initial page load times and work for the server (since the server doesn't build the templates)
    • This also simplifies how we design the pages, since often we would have to update the data on the page dynamically anyways after we created it with templates. Therefore we designed 2 different methods of building certain parts of each page
  • Use websockets only when it is necessary to push updates to the client
  • Serve static javascript files (no django templating in the js)
    • serving static files with nginx is the most efficient way to serve data, so we want to serve what we can with it.
  • Namespace element IDs, so there is no confusion or duplicate IDs
    • this means the 6th button's ID should be something like 'button6'

Coding Style

Python

  • Variables & Functions: snake_case
  • Classes: UpperCamelCase

See here: https://www.python.org/dev/peps/pep-0008/#prescriptive-naming-conventions

JavaScript

match the Python schemes for this project

Clone this wiki locally