Name
STYL-02: Adopt logical, consistent naming conventions for modules and data structures
Synopsis
Adopt and promote standard ways to define names of program elements. Choose a level of "formality" of naming conventions based on your needs. If, for example, you have a team of two developers working on a small code base, you can probably get away with naming conventions that don't go far beyond "use meaningful names." If you are building a massive application involving dozens of developers, you probably need to define more comprehensive rules.
Here are some general recommendations for conventions:
Identify the scope of a variable in its name: A global variable can be prefaced with
v_, for example.Use a prefix or suffix to identify the types of structures being defined: Consider, for example, declarations of cursors. A standard approach to declaring such a structure is
<name>_csr. Cursors are quite different from variables; you should be able to identify the difference with a glance.Use a readable format for your names: Since the stored program language isn't case sensitive, the "camel notation" (as in
minBalanceRequired), for example, is probably not a good choice for constructing names. Instead, use separators such as _ (underscore) to improve readability (as inmin_balance_required). While MySQL allows names to be extremely long (compared with other databases and/or languages), keep them short, as well as readable.Consider portability: If you ever want to port your code to an alternate ...