Changes between Version 72 and Version 73 of DeveloperGuidelines/CodeConventions

01/22/18 21:35:52 (4 years ago)
Dominic König



  • DeveloperGuidelines/CodeConventions

    v72 v73  
    5454* Function names for the global namespace should start with an "s3_" prefix (if they are not module-specific) or with the module prefix plus underscore.
    5555* Names for Eden-specific methods in subclasses of web2py classes also start with "s3_".
     56* Method names in Eden-specific classes do not need to (and thus should not) be prefixed
    5657* Names for Eden-specific subclasses of web2py classes and all classes which over-ride existing classes should have the suffix "S3".
    5758* S3Model subclasses in s3db should start with the all-uppercase module prefix, e.g. DVRCaseModel, PRImageModel (because the universal S3 prefix makes it harder to avoid name collisions between modules)
    6364* everything else (including table names and field names) should be all-lowercase with underscores as word separator.
    6465* Names should be obvious and explicit, but not overly verbose (i.e. as long as they need to be to not make people think). They shouldn't require someone to look in another file or solve a puzzle to figure out what they mean, but shouldn't take too long to write. Avoid inventing new acronyms. e.g. bad: {{{ s3_prm_lkp, method_that_allows_us_to_create_a_gis_layer }}}, good: {{{ s3_personnel_search, create_gis_layer }}}
     66* Names should not be Python keywords or standard library names
     67* Variable names should not start with _undersore (a trailing underscore_ is acceptable in local scope, though)
     68* Indexes in names should be avoided (e.g. file1, file2), except where they designate new versions of classes/functions (e.g. S3AddPersonWidget2)
    6569=== Comments and Docstrings ===