Names

  • 66 views
  • Added
  • Author:
I use two/three letter names for Modules and some often used variables and these are standard across almost every project that I make. 
This is against 'best practice' but if you keep it to a minimum for the most frequently used elements in your applications, then it will increase your programming speed and debug time.

Module Names:
AG - Application General - Global variables and subroutines that are standardised across all of my projects.
AE - Application Errors = An error management module that takes input from subroutines and the error class and creates a form to assist with diagnosis.
AV - Application Variables = Any global variable that is specific to this Application.

Note# Modules load alphabetically in Gambas, so if must you have dependcies between them, keep that in mind. 

Toolbox Class identifiers:  
DT - Data Tables - This is a list of all data tables used in the database for the application.
TB - *sigh* Initially it was a toolbox of subroutines to manage database IO and I should have changed the name but now I'm sort of attached to it from a historical perspective. It was the first toolbox class that I created in Gambas.


DBC - Database connection

Why 2-3 letters?

Take the Data tables example.

The class contains a variable for each table that I use in my database.

Public Const TableName as String = "TableName" 

I declare the DT class in the AG Module
Public DT as new Class Cls_SQL_ DataTables so I can reference any table in my data base as AG.DT.TableName
I NEVER refer to a table identifier by other than this standard. It minimises errors and alows you to change the table name once and you don't have to rewrite the code across your applicaiton.

I reference table names constantly.   So it comes down to using ApplicationGeneral.DataTables.TableName OR AG.DT.TableName.

The reason why I do this abrieviation is that I want to be able to see as much of the calling subroutine code as I can without having to scroll the screen. It makes error diagnosis faster and easier.

This is an actual use case to demonstrait loading a combo box with records from a table.

In the toolbox class (TB) it is delared as Public Sub LoadComboBox(InTable As String, InField As String, InCriteria As String, OrderBy As String, InCombo As ComboBox, Clear As Boolean, Title As String)

TB.LoadComboBox(
AG.DT.Category, "CategoryName", "ParentId=0", "", Cmb_CategoryParent, True, "* Select Parent *")




 

Rating

Item has a rating of 5 (Liked by sholzyLiked by gbWilly) 2 votes