Support

Home Products Downloads News Store Support

Stan's Blog

Variable naming conventions

How to use Maxprog products Maxprog's Blog

Compatible with MS Windows Compatible with MacOS


Variable naming conventions

Topics

Today I came across an old document I created in June 2004 probably from some text I found on the internet or maybe from an old Xojo Forum post, to say the truth I am not sure where it comes from. Anyway, the thing is that the document in question is some kind of variable naming conventions now I realize I fully adopted it after reading it. This is what it recommends when naming things you are declaring in your code depending on their nature. For you to understand better, it is a list of heading characters you have to start names with. This is the list:

Local Variables: "a"
Global Variables: "g"
Constants: "k"
Input Parameters: "in"
Output Parameters: "out"
Input/Output Parameters: 'io"
Properites of Classes: "m"
Events: "ev"
Methods/Functions: descriptive name
Modules: DB_Module, System_Module
Methods/Functions in those modules: "DB_"
Properties in that module: "mDB_"
Constants in that module: "kDB_"


For example, you would never use 'file' but 'aFile' if it is a local variable or 'gFile' if it is global. That simple.

I believe it is a really good idea to follow those rules, it makes the code easier to read and it makes really difficult for a variable to conflict with an existing keyword, a problem also known as "naming collision".

I even later use the same approach with SQL databases tables and fields.

Database Names: "db_"
Table Names: "tbl_"
Column/field Names: 'fld_"


Again, it makes the code more clear, easier to read, and avoid the possibility of a conflict with an existing keyword. Example:

SELECT fld_name FROM tbl_customers

I recommend the use of those conventions. You will find more information soon this here.


Stan Busk Stan Busk
January 21, 2021






Recent questions from our users
  Mail rejected as SPAM UPDATED Screenshot
  How do I enter turboSMTP settings into MaxBulk Mailer YouTube Video
  How I can change the old activation key with the new one? YouTube Video
  Why do I get a Delivery Report message after each delivery? YouTube Video
  Setting DKIM on MaxBulk Mailer YouTube Video
  How do I add an Unsubscribe link to my messages
  How to import a Bank statement into iCash YouTube Video
  Is Maxprog software prepared for macOS 11 Big Sur? Screenshot
  How to transfer email lists between MaxBulk Mailer copies Screenshot
  How can I download files with sequential numbers in their name? YouTube Video
  Images are missing in the message preview Screenshot
  How to send an email with a picture in the body YouTube Video
  How can I send to a big list of emails with MaxBulk Mailer YouTube Video
  Mail-merge sender data using tags YouTube Video
  I set up my bulk email message but authentication fails YouTube Video

  [Valid RSS]  Subscribe to Maxprog's Knowledge Base

▾ Last videos, Online events and Q&A Sessions ▾

▾ Last customer reviews ▾


Did you like this post?


🔐 Site secured by Comodo SSL
🟢 UptimeRobot - Site Loaded properly