{"id":645,"date":"2020-03-06T11:47:00","date_gmt":"2020-03-06T18:47:00","guid":{"rendered":"https:\/\/www.great-white-software.com\/blog\/?p=645"},"modified":"2020-03-02T12:02:24","modified_gmt":"2020-03-02T19:02:24","slug":"programming-thought-experiments","status":"publish","type":"post","link":"https:\/\/www.great-white-software.com\/blog\/2020\/03\/06\/programming-thought-experiments\/","title":{"rendered":"Programming thought experiments"},"content":{"rendered":"\n<p>Some companies like to pose certain programming questions as part of their interview process.<\/p>\n\n\n\n<p>I&#8217;ve run into a variety of these. They&#8217;ve been SQL related questions, code writing, and algorithm descriptions. Some were fairly straight forward. Some less so.<\/p>\n\n\n\n<p>One of the best I heard was a series of &#8220;How would you write this code if you had to write it &#8230;&#8221; with varying restrictions put on things. And the code was pretty simple. Write code to count all the upper and lower case letters in a string of ASCII characters.<\/p>\n\n\n\n<p>First write the code however you wanted. Loops, if then else, select case.<\/p>\n\n\n\n<p>Depending on which branching style you used the first time then the follow on was to write it using the other. If you first used a massive if then elseif statement then switch to using a select case. <\/p>\n\n\n\n<p>And of course take into account that Xojo IS not case sensitive with string comparisons.<\/p>\n\n\n\n<p>And finally to not use a branching type at all. This requires some out of the box thinking. Literally &#8220;count all the upper and lower case ASCII letters without the use of IF, SELECT or any other branching control.&#8221; All you have to use is a loop (while\/wend, for\/next whatever you wanted)<\/p>\n\n\n\n<p>This first two bits are fairly straight forward.<\/p>\n\n\n\n<p>The third however is still one of my favourite &#8220;thinking out of the box&#8221; approaches.<\/p>\n\n\n\n<p>Anyone care to take a guess at how to achieve that one ?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some companies like to pose certain programming questions as part of their interview process. I&#8217;ve run into a variety of these. They&#8217;ve been SQL related questions, code writing, and algorithm descriptions. Some were fairly straight forward. Some less so. One of the best I heard was a series of &#8220;How would you write this code &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.great-white-software.com\/blog\/2020\/03\/06\/programming-thought-experiments\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Programming thought experiments&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-645","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts\/645","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/comments?post=645"}],"version-history":[{"count":1,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts\/645\/revisions"}],"predecessor-version":[{"id":646,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts\/645\/revisions\/646"}],"wp:attachment":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/media?parent=645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/categories?post=645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/tags?post=645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}