{"id":1016,"date":"2011-01-25T12:50:03","date_gmt":"2011-01-25T12:50:03","guid":{"rendered":"http:\/\/positech.co.uk\/cliffsblog\/?p=1016"},"modified":"2011-01-24T20:48:27","modified_gmt":"2011-01-24T20:48:27","slug":"the-mental-coding-stack-and-avoiding-interruptions","status":"publish","type":"post","link":"https:\/\/www.positech.co.uk\/cliffsblog\/2011\/01\/25\/the-mental-coding-stack-and-avoiding-interruptions\/","title":{"rendered":"The mental coding stack, and avoiding interruptions"},"content":{"rendered":"<p>I was coding something in G4 recently, and it was in theory a simple thing. I was trying to work out why a certain unit in my game was not opening fire on another unit when I knew it should be.<\/p>\n<p>When I was looking at the unit onscreen, it was one of several, and stepping through code is frustrating if you aren&#8217;t sure who is who. The best solution in this case was for me to overlay a range UI on the screen so I could check it wasn&#8217;t a range issue. That meant writing some new code to display the range UI, which is fine. The problem is that meant getting the range for that unit into the GUI code, and there was no simple way to do that yet. That meant writing some new code to make a note of the range for that unit elsewhere&#8230;<\/p>\n<p>In an office, this is normally the point where someone taps you on the shoulder or asks you a question&#8230; And then it all falls apart. At this point my mental &#8216;stack&#8217; is this:<\/p>\n<pre style=\"padding-left: 30px;\">Working on G4<\/pre>\n<pre style=\"padding-left: 60px;\">...Debugging the firing bug<\/pre>\n<pre style=\"padding-left: 90px;\">...Adding a range overlay<\/pre>\n<pre style=\"padding-left: 120px;\">...Writing code to access max range<\/pre>\n<p>The longer that list gets, the longer it takes to get back into what you are doing. With really bad bugs (I coded a neural newtork once&#8230;eeeek) you can be 10-15 layers in. It can take a good 15 minutes to mentally rebuild that stack accurately if it gets lost, and it *will* get lost the moment you lose your train of thought.<\/p>\n<p>Short summary: Make sure nobody interrupts you when you are coding.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was coding something in G4 recently, and it was in theory a simple thing. I was trying to work out why a certain unit in my game was not opening fire on another unit when I knew it should be. When I was looking at the unit onscreen, it was one of several, and<\/p>\n<p class=\"text-right\"><span class=\"screen-reader-text\">Continue Reading&#8230; The mental coding stack, and avoiding interruptions<\/span><a class=\"btn btn-secondary continue-reading\" href=\"https:\/\/www.positech.co.uk\/cliffsblog\/2011\/01\/25\/the-mental-coding-stack-and-avoiding-interruptions\/\">Continue Reading&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1016","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts\/1016","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/comments?post=1016"}],"version-history":[{"count":1,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts\/1016\/revisions"}],"predecessor-version":[{"id":1017,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts\/1016\/revisions\/1017"}],"wp:attachment":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/media?parent=1016"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/categories?post=1016"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/tags?post=1016"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}