{"id":6892,"date":"2012-12-10T08:40:00","date_gmt":"2012-12-10T14:40:00","guid":{"rendered":"http:\/\/bobbeaty.com\/wp\/?p=6892"},"modified":"2012-12-18T07:20:13","modified_gmt":"2012-12-18T13:20:13","slug":"fixed-issues-with-production","status":"publish","type":"post","link":"https:\/\/bobbeaty.com\/wp\/archives\/6892","title":{"rendered":"Fixed Issues with Production"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/bobbeaty.com\/wp\/wp-content\/uploads\/2007\/09\/bug.gif\" alt=\"bug.gif\" title=\"bug.gif\" border=\"0\" width=\"128\" height=\"115\" style=\"float:right; margin-left:10px;\" \/><\/p>\n<p>This morning I had a production problem that I'm sad to say I <em>probably<\/em> should have seen coming. I added some new data from Teradata into the system and it was a bunch of metrics for a bunch of deals, all aggregated up to the Merchant level, and thrown into a JSON file for parsing. The original code didn't allow for there not being data for a division, and it could have easily been solved with something like this:<\/p>\n<pre class=\"ruby\" style=\"font-family:monospace;\">  <span style=\"color:#0066ff; font-weight:bold;\">@division_cache<\/span> = source_data<span style=\"color:#006600; font-weight:bold;\">&#91;<\/span>division<span style=\"color:#006600; font-weight:bold;\">&#93;<\/span> <span style=\"color:#006600; font-weight:bold;\">||<\/span> <span style=\"color:#006600; font-weight:bold;\">&#123;<\/span><span style=\"color:#006600; font-weight:bold;\">&#125;<\/span><\/pre>\n<p>but I forgot the \"|| {}\", and so it was possible to return a nil. This caused a nil pointer problem, and that hurt.<\/p>\n<p>The solution was simple, and thankfully, I had time to re-run everything, but it was something that again I've strayed from - good, solid, defensive coding. I miss it.<\/p>\n<p>I wish I had more control over this project and could enforce this without the knowledge that it'll get ripped out in a few days by someone looking to \"improve\" the code.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This morning I had a production problem that I&#8217;m sad to say I probably should have seen coming. I added some new data from Teradata into the system and it was a bunch of metrics for a bunch of deals, all aggregated up to the Merchant level, and thrown into a JSON file for parsing. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,6],"tags":[],"class_list":["post-6892","post","type-post","status-publish","format-standard","hentry","category-coding","category-cube-life"],"_links":{"self":[{"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/posts\/6892","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/comments?post=6892"}],"version-history":[{"count":0,"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/posts\/6892\/revisions"}],"wp:attachment":[{"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/media?parent=6892"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/categories?post=6892"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/tags?post=6892"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}