{"id":8266,"date":"2004-11-27T12:03:23","date_gmt":"2004-11-27T10:03:23","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/2004\/11\/27\/on-variable-naming-conventions\/"},"modified":"2005-04-10T01:55:51","modified_gmt":"2005-04-09T22:55:51","slug":"on-variable-naming-conventions","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2004\/11\/27\/on-variable-naming-conventions\/","title":{"rendered":"On variable naming conventions"},"content":{"rendered":"<!-- google_ad_section_start -->\n<p>Naming variables (that includes functions) is one of the most flamed subjects in the computer programming world.  Some people say you should use underscore (_) to separate words in the multiword names, like this_is_my_variable.  Others believe that separation should be done by capitalizatioon like thisIsMyVariable.  Agreeing on what should come first &#8211; a verb or a noun (display_form vs form_display)- is yet another question.<\/p>\n<p>This reminds me of an old joke.  There is an exam in C programming class at college and one of the students finishes first just a few minutes after the test started.  So the professor comes up to him checks his code and says: &#8220;Very good, young man.  You can use the remaining time to fix names of your variables.  Make them all self descriptive.&#8221;  Student nods in agreement and starts to work.  Few moments later he is finished again and shows the result to the professor.  And what does the professor see?  All the &#8216;i&#8217;s, &#8216;j&#8217;s, and other one letter variables were converted to selfdescriptivevariable1, selfdescriptivevariable2, selfdescriptivevariable3, etc.<\/p>\n<p>Why did I start this post today?  Oh, well.  <a href=\"http:\/\/c133.org\/blog\/tech\/KDE\/youre_not_gonna_do_it_are_you.html\">Something<\/a> got me started.<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>Naming variables (that includes functions) is one of the most flamed subjects in the computer programming world. Some people say you should use underscore (_) to separate words in the multiword names, like this_is_my_variable. Others believe that separation should be done by capitalizatioon like thisIsMyVariable. Agreeing on what should come first &#8211; a verb or &hellip; <a href=\"https:\/\/mamchenkov.net\/wordpress\/2004\/11\/27\/on-variable-naming-conventions\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">On variable naming conventions<\/span><\/a><\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_links_to":"","_links_to_target":""},"categories":[1,62],"tags":[2418],"keyring_services":[],"class_list":["post-8266","post","type-post","status-publish","format-standard","hentry","category-general","category-technology","tag-humor"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":27727,"url":"https:\/\/mamchenkov.net\/wordpress\/2017\/06\/27\/using-non-breakable-spaces-in-test-method-names\/","url_meta":{"origin":8266,"position":0},"title":"Using non-breakable spaces in test method names","author":"Leonid Mamchenkov","date":"June 27, 2017","format":false,"excerpt":"Using non-breakable spaces in test method names is a great example of how something can start as a joke and quickly turn into something very practical and useful. if we decide to not follow PSR-2 naming for test methods because of readability, we might as well use non-breakable spaces since\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2017\/06\/nbsp-code-500x80.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":42682,"url":"https:\/\/mamchenkov.net\/wordpress\/2019\/06\/05\/notes-to-myself-on-software-engineering\/","url_meta":{"origin":8266,"position":1},"title":"Notes to Myself on Software Engineering","author":"Leonid Mamchenkov","date":"June 5, 2019","format":false,"excerpt":"I came across these \"Notes to Myself on Software Engineering\", with which I agree wholeheartedly. Some of these I've learned \"the hard way\". For most of these, I wish I knew them earlier. They would make my life a lot easier. Here a few to get you started, but make\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":9014,"url":"https:\/\/mamchenkov.net\/wordpress\/2005\/05\/27\/handling-arguments-with-spaces-in-bash\/","url_meta":{"origin":8266,"position":2},"title":"Handling arguments with spaces in bash","author":"Leonid Mamchenkov","date":"May 27, 2005","format":false,"excerpt":"Way to often I get it wrong, so I decided to right this down... When processing the list of arguments in your bash script, remember that often arguments such as file names contain spaces. The wrong way to go about this is: #!\/bin\/bash for FILE in $* do echo \"$FILE\"\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":22534,"url":"https:\/\/mamchenkov.net\/wordpress\/2014\/09\/16\/phpdotenv-loads-environment-variables-from-env-file-to-getenv-_env-and-_server-automagically\/","url_meta":{"origin":8266,"position":3},"title":"phpdotenv &#8211; Loads environment variables from .env file to getenv(), $_ENV and $_SERVER automagically","author":"Leonid Mamchenkov","date":"September 16, 2014","format":"link","excerpt":"phpdotenv - Loads environment variables from .env file to getenv(), $_ENV and $_SERVER automagically","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":16602,"url":"https:\/\/mamchenkov.net\/wordpress\/2012\/08\/03\/metasyntactic-variable\/","url_meta":{"origin":8266,"position":4},"title":"Metasyntactic variable","author":"Leonid Mamchenkov","date":"August 3, 2012","format":"link","excerpt":"Metasyntactic variable A \"standard list of metasyntactic variables used in syntax examples\" often used in the United States is: foo, bar, baz, qux, quux, corge, grault, garply, waldo, fred,\u00a0plugh,\u00a0xyzzy, thud.\u00a0The word\u00a0foo\u00a0occurs in over 330\u00a0RFCs\u00a0and\u00a0bar\u00a0occurs in over 290.\u00a0[...] Due to English being the foundation-language, or\u00a0lingua franca, of most computer programming languages\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":22166,"url":"https:\/\/mamchenkov.net\/wordpress\/2014\/07\/10\/git-branch-names-support-forward-slashes\/","url_meta":{"origin":8266,"position":5},"title":"Git branch names support forward slashes","author":"Leonid Mamchenkov","date":"July 10, 2014","format":false,"excerpt":"Oh. My. God! \u00a0I've been using git for years now and I only learned this today - git branch names support forward slashes! How awesome is that?! \u00a0You can do things like this: Grouping branches like this is much easier indeed! I came across this while reading CakeDC's CakePHP Plugin\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/8266","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=8266"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/8266\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=8266"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=8266"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=8266"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=8266"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}