Coding Standards for TSUGI

This document describes the coding standards for the PHP version of TSUGI. Here are the sources for inspiration for the style we use in TSUGI:

Generally every table must link to one of the core lti tables with an explicit foreign key. The typical tables might be lti_key, lti_context, lti_user, or lti_link. The preferred approach is to use the CASCADE option as this allows easy deletion or disabling of a user, course, or even tenant with a simple statement.

In terms of capitalization, I struggled with the right approach and you can see in the early commit history that I changed my mind several times. Classic PHP global functions and Moodle tend to use Snake Case for methods, while PHP-FIG and newer PHP capabilities like PDO tend to use Camel Case for methods. Given that I see TSUGI implemented in other languages like Java I figured to simply use Camel Case across the board. Also for purposes of capitalization, acronyms like URL, JSON, TCP are all treated as "words" - so the proper capitalization in Camel Case for these is "getUrl", "getJson", and "getTcp".

These are early days for the project and we are still small enough that a refactor can easily be done. And in particular with only one developer in the project so far - I am sure that mistakes have been made and I am looking forward to other people looking at these decisions, commenting on these decisions and then pushing TSUGI in different directions as the project goes forward towards more broad adoption.

While the coding style has not yet ben reviewed by someone senior in the Moodle community - I am looking forward to that review and expect TSUGI to be changed as a result of that review. I want this to be a collective project as it goes forward and moves from an experiment by one person to a learning ecosystem.

Chuck Sun Jun 8 11:44:56 EDT 2014