{"id":2218,"date":"2025-03-26T15:57:01","date_gmt":"2025-03-26T19:57:01","guid":{"rendered":"https:\/\/www.unliterate.net\/?p=2218"},"modified":"2025-03-26T15:57:45","modified_gmt":"2025-03-26T19:57:45","slug":"it-came-down-to-a-capital-t","status":"publish","type":"post","link":"https:\/\/www.unliterate.net\/index.php\/2025\/03\/26\/it-came-down-to-a-capital-t\/","title":{"rendered":"It came down to a Capital T&#8230;"},"content":{"rendered":"\n<p>I had an opportunity to take a <a href=\"https:\/\/github.com\/Elomi-inc\/software-engineer-interview\" target=\"_blank\" rel=\"noreferrer noopener\">coding challenge<\/a> from <a href=\"https:\/\/www.dorsia.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Dorsia<\/a> with very strict rules:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>No AI<\/li>\n\n\n\n<li>No googling for info<\/li>\n\n\n\n<li>Use your own code editor<\/li>\n\n\n\n<li>Share your screen and video<\/li>\n<\/ul>\n\n\n\n<p>Everything started perfectly. I was able to get the initial tests functional and things sailed very well. Then I had to write an exclusion routine and test cases for that. This is where the wall started to fall in&#8230;<\/p>\n\n\n\n<p>I spent over 40 minutes on a problem I couldn&#8217;t diagnose, which left the remainder of the challenge with minor doubts. After getting up and walking around things magically fell into place and it came down to the letter &#8220;T&#8221; that was sabotaging me, as well as my code editor.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">Approaching the problem<\/h2>\n\n\n\n<p>Firstly I kept getting a warning that I couldn&#8217;t really debug out. Without using Google this means I had to figure out how to extract the warning. My knowledge of phpunit execution and configuration didn&#8217;t really shine through so I couldn&#8217;t do something as simple as &#8220;turn on warnings&#8221;. A basic <a href=\"https:\/\/stackoverflow.com\/questions\/67544571\/how-to-see-full-warning-messages-during-phpunit-test\" target=\"_blank\" rel=\"noreferrer noopener\">stackoverflow article<\/a> gives the easiest solution ever:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public function setUp(): void\n{\n  # Turn on error reporting\n  error_reporting(E_ALL);\n}<\/code><\/pre>\n\n\n\n<p>Once this was done my error shone through like a sunbeam through a hole in the wall:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> .\/dorsia test it_does_not_include_times_that_are_excluded\nPHPUnit 10.5.5 by Sebastian Bergmann and contributors.\n\nRuntime:       PHP 8.1.27\nConfiguration: \/app\/phpunit.xml\n\n\nWarning: Undefined variable $endtime in \/app\/src\/DailyAvailability.php on line 33\nW\nWarning: Undefined variable $endtime in \/app\/src\/DailyAvailability.php on line 33\nF                                                                  2 \/ 2 (100%)<\/code><\/pre>\n\n\n\n<p>Of course my variable <code>$endtime<\/code> was actually declared as <code>$endTime<\/code>, and changing the variable to the one with the camelCase resolved all unit tests (See <a href=\"https:\/\/github.com\/mjheick\/dorsia-software-engineer-interview\/blame\/main\/php\/src\/DailyAvailability.php#L33\" target=\"_blank\" rel=\"noreferrer noopener\">line#33<\/a>)<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Lessons to learn<\/h2>\n\n\n\n<p>Firstly I shouldn&#8217;t let something as simple as &#8220;spaces vs. tabs&#8221; irk me out. My editor should&#8217;ve been able to bulk convert, and if not I should&#8217;ve done a find-replace or a <code>sed -i \"s\/\\s{4}\/\\t\/g\" DailyAvailability.php<\/code>. Regardless I&#8217;m certain I lost 5 minutes alone fighting around unnecessary spacing.<\/p>\n\n\n\n<p>Secondly I should&#8217;ve used more debugging and diagnostic methods to find this problem. Turning on warnings in something as simple as my php.ini should&#8217;ve been the primary thing to do so I didn&#8217;t have to worry about calling it in the <code>setUp()<\/code>.<\/p>\n\n\n\n<p>Thirdly I should not have trusted my code editor. When I double-clicked  <code>$endTime<\/code> and saw all the other instances highlighted I gained a false sense of &#8220;this is all correct where it matches&#8221; instead of scrutinized it more. This seems to be the default &#8220;trust&#8221; and action of Visual Studio but not of Sublime 3, so this lesson comes down to &#8220;pick the right tool for the right job&#8221;. To be clear: If I single-clicked the variable in Visual Studio I would&#8217;ve seen the issue, the double-clicking is what highlighted all case-insensitive matches, so &#8220;not rushing&#8221; should be a fourth lesson.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had an opportunity to take a coding challenge from Dorsia with very strict rules: Everything started perfectly. I was able to get the initial tests functional and things sailed very well. Then I had to write an exclusion routine and test cases for that. This is where the wall started to fall in&#8230; I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-2218","post","type-post","status-publish","format-standard","hentry","category-geek-instructions"],"_links":{"self":[{"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/posts\/2218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/comments?post=2218"}],"version-history":[{"count":4,"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/posts\/2218\/revisions"}],"predecessor-version":[{"id":2222,"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/posts\/2218\/revisions\/2222"}],"wp:attachment":[{"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/media?parent=2218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/categories?post=2218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.unliterate.net\/index.php\/wp-json\/wp\/v2\/tags?post=2218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}