{"id":3185,"date":"2019-01-14T09:52:40","date_gmt":"2019-01-14T15:52:40","guid":{"rendered":"http:\/\/www.mooreds.com\/wordpress\/?p=3185"},"modified":"2018-12-01T06:41:46","modified_gmt":"2018-12-01T12:41:46","slug":"ever-felt-like-your-codebase-was-out-of-control","status":"publish","type":"post","link":"https:\/\/www.mooreds.com\/wordpress\/archives\/3185","title":{"rendered":"Ever felt like your codebase was out of control?"},"content":{"rendered":"<p>I certainly have. A couple of times in my career the combination of technical debt, business model shift and lack of time for a proper fix have left me feeling out of control.<\/p>\n<p>But reading <a href=\"https:\/\/news.ycombinator.com\/item?id=18442637\">this post on Hacker News<\/a> made me realize that it all could have been so so much worse. A couple of &#8220;best ofs&#8221;:<\/p>\n<blockquote><p><span class=\"commtext c00\">To give you some examples, I originally came on as a contractor because they had some refactoring they wanted done. The entire system was home built (including the programming language) and there was a file size limit of 32,767 lines. They had many <i>functions<\/i> that were approaching this limit and they didn&#8217;t know what to do, so they hired me. <\/span><\/p><\/blockquote>\n<p>and:<\/p>\n<blockquote><p><span class=\"commtext c00\">Once upon a time, there was a search product and one of the data sources that it could search was a Solr\/Lucene database. This should be no problem, since search is what Solr does. It should be as simple as passing the user&#8217;s query through to Solr and then reading the response. The problem was, it was important to know exactly which parts of any matched records were relevant to the search.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>The Guy Before Me\u2122 decided that the best way to implement this would be to split the user&#8217;s search into individual words, perform a <i>separate<\/i> search query through Solr&#8217;s HTTP API for each <i>individual<\/i> word, and then do a bunch of very clever and complex post-processing on the result sets to combine them into a single set of results.<\/p><\/blockquote>\n<p>and (last one, I promise):<\/p>\n<blockquote><p><span class=\"commtext c00\">At my first gig I teamed up with a guy responsible for a gigantic monolith written in Lua. Originally, the project started as a little script running in Nginx. Over the course of several years, it organically grew to epic proportions, by consuming and replacing every piece of software that it interfaced with &#8211; including Nginx.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>There were two ingredients in the recipe for disaster. The first is that Lua comes &#8220;batteries excluded&#8221;: the standard library is minimalist and the community and set of available packages out there is small. That&#8217;s typically not an issue, as long as one uses Lua in the intended way: small scripts that extend existing programs with custom user logic (e.g. Nginx, Vim, World of Warcraft). The second is that Lua is a dynamic language: it&#8217;s dynamically typed, and practically everything can be overridden, monkey patched and hacked, down to the fundamental iterators that allow you to traverse data structures.<\/p><\/blockquote>\n<p><em>shivers<\/em>. There, but for the grace of God.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I certainly have. A couple of times in my career the combination of technical debt, business model shift and lack of time for a proper fix have left me feeling [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,37],"tags":[],"class_list":["post-3185","post","type-post","status-publish","format-standard","hentry","category-programming","category-tips"],"_links":{"self":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/3185","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/comments?post=3185"}],"version-history":[{"count":2,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/3185\/revisions"}],"predecessor-version":[{"id":3187,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/3185\/revisions\/3187"}],"wp:attachment":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/media?parent=3185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/categories?post=3185"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/tags?post=3185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}