Code Cleanup - GlimmerLabs/MathOverImages GitHub Wiki

At the end of the semester (probably in week 11), we will do a large code cleanup. Once we've cleaned up the code, everything in the Site directory will move to a new repository.

General

[ ] Look for unused files/libraries and remove them
    [ ] mist-animation.js could probably be removed
    [ ] Much of mistui-menus could probably be removed
[ ] Remove unused or deprecated functions.  (Need to make sure they aren't used.)
[ ] Uniform file naming.
    * Only lowercase, dashes, and dot-suffix.
    * All the mistgui stuff should go in mistgui-whatever.js
    * Etc.
[ ] Look for more opportunities to refactor.
[ ] Consistency in naming the parts of a service (e.g., it's confusing that we have four different file names for the single image page).

General Javascript

[ ] All functions have short intro comment.
[ ] Capitalization conventions.

Backend Javascript

[ ] Break database.js into separate files
    [ ] Things related to the user (login, info, etc) go in user.js (new)
    [ ] Administrative tasks go in admin.js (new)
    [ ] Image-related stuff goes in image.js (old)
    [ ] Etc.
[ ] Look for common patterns for using database.query and write code that
    encapsulates them better.  (`queryBoolean`, `querySequenceAll`, and
    `querySequenceAny` are a start).

Backend other

[-] Rewrite all Jade files to .gejs or equivalent.
    [x] normal pages
    [ ] non-standard pages
        [ ] index
        [ ] tutorials/embed

GUI

[ ] No "code executes when you load this file".  All code goes in functions, which are called at appropriate times.
[ ] Need GUI object.  

Database

[ ] All foreign keys in database should be designated as such.
[ ] All ids that serve as primary keys the database should be called 'id', marked as primary keys, and appear first.
[ ] Standard naming for foreign keys (e.g., an id in the images table should be `imageid`, not `onImage`)

CSS

[x] Get rid of the silly indirect loads.

Misc.

[ ] All the ugly code should go in a separate directory (e.g., js/ugly/mist.js)
[ ] All the compound code should go in a separate directory (e.g., js/combined/mist.js)
[ ] No more loading individual files