{"id":42,"date":"2014-01-24T17:54:08","date_gmt":"2014-01-25T00:54:08","guid":{"rendered":"https:\/\/blogs.ubc.ca\/coetoolbox\/?page_id=42"},"modified":"2016-09-15T16:24:46","modified_gmt":"2016-09-15T23:24:46","slug":"style","status":"publish","type":"page","link":"https:\/\/blogs.ubc.ca\/coetoolbox\/vba\/style\/","title":{"rendered":"Coding Style Rules"},"content":{"rendered":"<p>It is important to write your code in a clear and organized fashion so other programmers can understand <strong><em>what<\/em> <\/strong>you did and <strong><em>why<\/em> <\/strong>you did it. Here are some rules you should follow whenever you develop an application in VBA:<\/p>\n<ol>\n<li>Use names for procedures and variables that make sense with respect to the problem.<\/li>\n<li>When declaring a procedure, always include its purpose as a comment.<\/li>\n<li>Definition names of variables and functions should use <a title=\"CamelCase\" href=\"http:\/\/en.wikipedia.org\/wiki\/CamelCase\" target=\"_blank\">camel case<\/a>\u00a0Eg. <span style=\"color: #0000ff;\">LogBaseN<\/span> rather than <span style=\"color: #0000ff;\">Log_Base_N<\/span> or <span style=\"color: #0000ff;\">logbasen<\/span><\/li>\n<li>Don&#8217;t perform multiple tasks in a single line. As a result, no code line should span more than your screen width.<\/li>\n<li>Break long procedures into shorter, simpler procedures. No procedure should span more than ten to twenty lines.<\/li>\n<li>Avoid hard coding or\u00a0embedding input or configuration data directly into the source code. For example, instead of saying x=10*y, define a new variable a=10 and say x=a*y.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is important to write your code in a clear and organized fashion so other programmers can understand what you did and why you did it. Here are some rules you should follow whenever you develop an application in VBA: Use names for procedures and variables that make sense with respect to the problem. When [&hellip;]<\/p>\n","protected":false},"author":22982,"featured_media":0,"parent":2,"menu_order":1,"comment_status":"open","ping_status":"closed","template":"page-templates\/full-width.php","meta":{"footnotes":""},"class_list":["post-42","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/pages\/42","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/users\/22982"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/comments?post=42"}],"version-history":[{"count":9,"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/pages\/42\/revisions"}],"predecessor-version":[{"id":1489,"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/pages\/42\/revisions\/1489"}],"up":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/pages\/2"}],"wp:attachment":[{"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/media?parent=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}