{"id":844,"date":"2017-11-16T07:11:51","date_gmt":"2017-11-16T12:11:51","guid":{"rendered":"https:\/\/www.maxprog.com\/blog\/?p=844"},"modified":"2021-01-21T03:37:49","modified_gmt":"2021-01-21T08:37:49","slug":"variable-naming-conventions","status":"publish","type":"post","link":"https:\/\/www.maxprog.com\/blog\/variable-naming-conventions\/","title":{"rendered":"Variable naming conventions"},"content":{"rendered":"<p>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 <a href=\"https:\/\/forum.xojo.com\" rel=\"noopener\" target=\"_blank\">Xojo Forum<\/a> 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:<\/p>\n<p><code>Local Variables: \"a\"<br \/>\nGlobal Variables: \"g\"<br \/>\nConstants: \"k\"<br \/>\nInput Parameters: \"in\"<br \/>\nOutput Parameters: \"out\"<br \/>\nInput\/Output Parameters: 'io\"<br \/>\nProperites of Classes: \"m\"<br \/>\nEvents: \"ev\"<br \/>\nMethods\/Functions: descriptive name<br \/>\nModules: DB_Module, System_Module<br \/>\nMethods\/Functions in those modules: \"DB_\"<br \/>\nProperties in that module: \"mDB_\"<br \/>\nConstants in that module: \"kDB_\"<\/code><\/p>\n<p>For example, you would never use &#8216;file&#8217; but &#8216;aFile&#8217; if it is a local variable or &#8216;gFile&#8217; if it is global. That simple.<\/p>\n<p>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 &#8220;naming collision&#8221;.<\/p>\n<p>I even later use the same approach with SQL databases tables and fields.<\/p>\n<p><code>Database Names: \"db_\"<br \/>\nTable Names: \"tbl_\"<br \/>\nColumn\/field Names: 'fld_\"<\/code><\/p>\n<p>Again, it makes the code more clear, easier to read, and avoid the possibility of a conflict with an existing keyword. Example:<\/p>\n<p><code>SELECT fld_name FROM tbl_customers<\/code><\/p>\n<p>I recommend the use of those conventions. You will find more information soon this <a href=\"https:\/\/en.wikipedia.org\/wiki\/Naming_convention_(programming)\" rel=\"noopener\" target=\"_blank\">here<\/a>. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54],"tags":[66,56],"class_list":["post-844","post","type-post","status-publish","format-standard","hentry","category-xojo","tag-programming","tag-xojo"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Variable naming conventions - Tips and tricks<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.maxprog.com\/blog\/variable-naming-conventions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Variable naming conventions\" \/>\n<meta property=\"og:description\" content=\"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 &hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.maxprog.com\/blog\/variable-naming-conventions\/\" \/>\n<meta property=\"og:site_name\" content=\"Tips and tricks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/maxprog\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/maxprog\" \/>\n<meta property=\"article:published_time\" content=\"2017-11-16T12:11:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-01-21T08:37:49+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@maxprog\" \/>\n<meta name=\"twitter:site\" content=\"@maxprog\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/variable-naming-conventions\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/variable-naming-conventions\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/#\\\/schema\\\/person\\\/94903012a832903f334e8b939c2ac916\"},\"headline\":\"Variable naming conventions\",\"datePublished\":\"2017-11-16T12:11:51+00:00\",\"dateModified\":\"2021-01-21T08:37:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/variable-naming-conventions\\\/\"},\"wordCount\":222,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/#organization\"},\"keywords\":[\"programming\",\"Xojo\"],\"articleSection\":[\"Xojo\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/variable-naming-conventions\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/variable-naming-conventions\\\/\",\"url\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/variable-naming-conventions\\\/\",\"name\":\"Variable naming conventions - Tips and tricks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/#website\"},\"datePublished\":\"2017-11-16T12:11:51+00:00\",\"dateModified\":\"2021-01-21T08:37:49+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/variable-naming-conventions\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/variable-naming-conventions\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/variable-naming-conventions\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Variable naming conventions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/\",\"name\":\"Tips and tricks\",\"description\":\"How to use Maxprog products\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/#organization\",\"name\":\"Maxprog\",\"url\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/04\\\/logo_maxprog_pict_white_with_blue_back_512x512.png\",\"contentUrl\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/04\\\/logo_maxprog_pict_white_with_blue_back_512x512.png\",\"width\":512,\"height\":512,\"caption\":\"Maxprog\"},\"image\":{\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/maxprog\",\"https:\\\/\\\/x.com\\\/maxprog\",\"https:\\\/\\\/www.instagram.com\\\/stanbusk\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/maxprog\",\"https:\\\/\\\/es.pinterest.com\\\/stanbusk\\\/\",\"https:\\\/\\\/www.youtube.com\\\/c\\\/Maxprog\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/#\\\/schema\\\/person\\\/94903012a832903f334e8b939c2ac916\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/49daac01857e4ec6646801107e47c7f62856c94d4ef7caf1a296f296c790fb81?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/49daac01857e4ec6646801107e47c7f62856c94d4ef7caf1a296f296c790fb81?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/49daac01857e4ec6646801107e47c7f62856c94d4ef7caf1a296f296c790fb81?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"description\":\"Software engineer at maxprog.com\",\"sameAs\":[\"https:\\\/\\\/www.maxprog.com\\\/\",\"https:\\\/\\\/www.facebook.com\\\/maxprog\",\"https:\\\/\\\/www.instagram.com\\\/maxprog8\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/maxprog\",\"https:\\\/\\\/www.pinterest.es\\\/stanbusk\",\"https:\\\/\\\/x.com\\\/maxprog\",\"https:\\\/\\\/www.youtube.com\\\/c\\\/Maxprog\",\"https:\\\/\\\/maxprog.tumblr.com\"]}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Variable naming conventions - Tips and tricks","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.maxprog.com\/blog\/variable-naming-conventions\/","og_locale":"en_US","og_type":"article","og_title":"Variable naming conventions","og_description":"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 &hellip;","og_url":"https:\/\/www.maxprog.com\/blog\/variable-naming-conventions\/","og_site_name":"Tips and tricks","article_publisher":"https:\/\/www.facebook.com\/maxprog","article_author":"https:\/\/www.facebook.com\/maxprog","article_published_time":"2017-11-16T12:11:51+00:00","article_modified_time":"2021-01-21T08:37:49+00:00","author":"admin","twitter_card":"summary_large_image","twitter_creator":"@maxprog","twitter_site":"@maxprog","twitter_misc":{"Written by":"admin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.maxprog.com\/blog\/variable-naming-conventions\/#article","isPartOf":{"@id":"https:\/\/www.maxprog.com\/blog\/variable-naming-conventions\/"},"author":{"name":"admin","@id":"https:\/\/www.maxprog.com\/blog\/#\/schema\/person\/94903012a832903f334e8b939c2ac916"},"headline":"Variable naming conventions","datePublished":"2017-11-16T12:11:51+00:00","dateModified":"2021-01-21T08:37:49+00:00","mainEntityOfPage":{"@id":"https:\/\/www.maxprog.com\/blog\/variable-naming-conventions\/"},"wordCount":222,"commentCount":0,"publisher":{"@id":"https:\/\/www.maxprog.com\/blog\/#organization"},"keywords":["programming","Xojo"],"articleSection":["Xojo"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.maxprog.com\/blog\/variable-naming-conventions\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.maxprog.com\/blog\/variable-naming-conventions\/","url":"https:\/\/www.maxprog.com\/blog\/variable-naming-conventions\/","name":"Variable naming conventions - Tips and tricks","isPartOf":{"@id":"https:\/\/www.maxprog.com\/blog\/#website"},"datePublished":"2017-11-16T12:11:51+00:00","dateModified":"2021-01-21T08:37:49+00:00","breadcrumb":{"@id":"https:\/\/www.maxprog.com\/blog\/variable-naming-conventions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.maxprog.com\/blog\/variable-naming-conventions\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.maxprog.com\/blog\/variable-naming-conventions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.maxprog.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Variable naming conventions"}]},{"@type":"WebSite","@id":"https:\/\/www.maxprog.com\/blog\/#website","url":"https:\/\/www.maxprog.com\/blog\/","name":"Tips and tricks","description":"How to use Maxprog products","publisher":{"@id":"https:\/\/www.maxprog.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.maxprog.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.maxprog.com\/blog\/#organization","name":"Maxprog","url":"https:\/\/www.maxprog.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.maxprog.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.maxprog.com\/blog\/wp-content\/uploads\/2019\/04\/logo_maxprog_pict_white_with_blue_back_512x512.png","contentUrl":"https:\/\/www.maxprog.com\/blog\/wp-content\/uploads\/2019\/04\/logo_maxprog_pict_white_with_blue_back_512x512.png","width":512,"height":512,"caption":"Maxprog"},"image":{"@id":"https:\/\/www.maxprog.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/maxprog","https:\/\/x.com\/maxprog","https:\/\/www.instagram.com\/stanbusk\/","https:\/\/www.linkedin.com\/company\/maxprog","https:\/\/es.pinterest.com\/stanbusk\/","https:\/\/www.youtube.com\/c\/Maxprog"]},{"@type":"Person","@id":"https:\/\/www.maxprog.com\/blog\/#\/schema\/person\/94903012a832903f334e8b939c2ac916","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/49daac01857e4ec6646801107e47c7f62856c94d4ef7caf1a296f296c790fb81?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/49daac01857e4ec6646801107e47c7f62856c94d4ef7caf1a296f296c790fb81?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/49daac01857e4ec6646801107e47c7f62856c94d4ef7caf1a296f296c790fb81?s=96&d=mm&r=g","caption":"admin"},"description":"Software engineer at maxprog.com","sameAs":["https:\/\/www.maxprog.com\/","https:\/\/www.facebook.com\/maxprog","https:\/\/www.instagram.com\/maxprog8\/","https:\/\/www.linkedin.com\/company\/maxprog","https:\/\/www.pinterest.es\/stanbusk","https:\/\/x.com\/maxprog","https:\/\/www.youtube.com\/c\/Maxprog","https:\/\/maxprog.tumblr.com"]}]}},"_links":{"self":[{"href":"https:\/\/www.maxprog.com\/blog\/wp-json\/wp\/v2\/posts\/844","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.maxprog.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.maxprog.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.maxprog.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.maxprog.com\/blog\/wp-json\/wp\/v2\/comments?post=844"}],"version-history":[{"count":2,"href":"https:\/\/www.maxprog.com\/blog\/wp-json\/wp\/v2\/posts\/844\/revisions"}],"predecessor-version":[{"id":1658,"href":"https:\/\/www.maxprog.com\/blog\/wp-json\/wp\/v2\/posts\/844\/revisions\/1658"}],"wp:attachment":[{"href":"https:\/\/www.maxprog.com\/blog\/wp-json\/wp\/v2\/media?parent=844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.maxprog.com\/blog\/wp-json\/wp\/v2\/categories?post=844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.maxprog.com\/blog\/wp-json\/wp\/v2\/tags?post=844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}