-
Notifications
You must be signed in to change notification settings - Fork 0
Refactoring Notes
These are some notes that for refactoring this repository. The first two headings (Javascript and PHP) contain points about general or universal changes that could be made. The third heading is more detailed notes about specific files to keep track of certain functions that could be refactored in addition to aspects that could benefit from some more clarification in the the code. More will be added to these notes over time.
-
ADD COMMENTS!!!
- parameters
- what a function/file does and what situations it is used in.
- return/output
-
Set up separate namespaces for existing Javascript functions to better encapsulate and organize code. Here is a list of some possible name- spaces that could be added:
- admin (functions concerning admin features)
- citation (functions handling citations or citation properties)
- collection
- ui or userInterface (for webpage altering functions)
- request (maybe?)
- view (for different citation views. Maybe even citation.view)
- checkbox (there seems to be a handful of functions that are all devoted to setting checkboxes)
- parse
- html/html_message/panel/panel_message
- feedback
- format
- user
- proxy
-
In addition to adding separate namespaces, set up interfaces for the functions that end in '_request' and '_response' (and any other similar code patterns that show up).
-
Utilize JQuery in applicable sections of code instead of plan Javascript.
-
Set up some type of documentation for all the Javascript
-
Could some, if not all, helper function be merged into the actual function be removed?
-
ADD COMMENTS!!!
-
Identify .php files that render html and put them in a separate section apart from .php files that only do computation.
-
Possibly look into html templates?
-
In
index.php(along with any other files that involve the panels), possibly rename the panels to have HELPFUL id names instead of having to add html comments to clerify the purpose. (EX:index.php:274-287).
###Page.js
-
Page.inputMethod- What are the different input methods and what are they doing?
- What situations do different input methods occur in?
- Could they be rewritten as strings that are descriptive?
-
Page.print_r&Page.print_r2- What are they doing and could the functions be renamed?
-
What is the arr variable that appears in multiple functions (EX:
Page.inArray(val, arr))
###CollectionsBroken.js
- Based solely off the name, is this file used? If so, what is the importance/meaning of the filename. If not, why is it still there?
- line 572,
onResponseGetCitationsGivenCollectionID()- Could this be renamed to be more generic? the body of the function doesn't say anything obviously limited to anything.
###js.js
- The name. This file needs a MUCH more descriptive name. 'misc.js' at least would be an acceptable change.
- Most of the code in this file seems like it would fit in a namespace like ui or panel
###validate.js
- The majority of this file is commented out. Are those functions necessary to keep around? Could they Otherwise be moved to some "notes/unused functions" file? Or could they be completely removed from the file?