{"id":411,"date":"2016-07-18T18:08:42","date_gmt":"2016-07-18T14:08:42","guid":{"rendered":"http:\/\/zxstudio.org\/blog\/?p=411"},"modified":"2016-12-23T00:46:43","modified_gmt":"2016-12-22T20:46:43","slug":"thoughts-code-quality","status":"publish","type":"post","link":"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/","title":{"rendered":"Some thoughts about code quality"},"content":{"rendered":"<p><a href=\"http:\/\/www.xkcd.com\/1695\/\"><img loading=\"lazy\" class=\"aligncenter\" title=\"It's like you tried to define a formal grammar based on fragments of a raw database dump from the QuickBooks file of a company that's about to collapse in an accounting scandal.\" src=\"http:\/\/imgs.xkcd.com\/comics\/code_quality_2.png\" width=\"531\" height=\"511\" \/><\/a><\/p>\n<p>Shocking truth, but significant part of Open Horizon&#8217;s code wouldn&#8217;t pass my own code review. It&#8217;s probably ok for pet-project, because if I will rewrite code every time I want, the project would be in development forever. The reason code isn&#8217;t perfect from the start is quite simple.<\/p>\n<p>First of all, I don&#8217;t know how the original game worked before some research so I write first implementation, then, when problems occurs, I research again with updated information, making new assumptions. This is a continuous process, but other code is already depends on what I wrote previously so every time such problems appears I can&#8217;t just rewrite it all.<\/p>\n<p>On the game mechanics side, I often choose ugly solutions right before the release, because I want it to be done already so I cut corners and struggle with my own architecture. While I&#8217;m complaining about architecture, the other aspects of the code quality, like checking ranges and pointers, are mostly fine, because it&#8217;s critical to the stability and sanity. Any unnoticed null pointer reduces game&#8217;s value to zero.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Shocking truth, but significant part of Open Horizon&#8217;s code wouldn&#8217;t pass my own code review. It&#8217;s probably ok for pet-project, because if I will rewrite code every time I want, the project would be in development forever. The reason code isn&#8217;t perfect from the start is quite simple. First of all, I don&#8217;t know how <a class=\"read-more\" href=\"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/\">[&hellip;]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[6],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v18.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Some thoughts about code quality - ZX Studio Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Some thoughts about code quality - ZX Studio Blog\" \/>\n<meta property=\"og:description\" content=\"Shocking truth, but significant part of Open Horizon&#8217;s code wouldn&#8217;t pass my own code review. It&#8217;s probably ok for pet-project, because if I will rewrite code every time I want, the project would be in development forever. The reason code isn&#8217;t perfect from the start is quite simple. First of all, I don&#8217;t know how [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/\" \/>\n<meta property=\"og:site_name\" content=\"ZX Studio Blog\" \/>\n<meta property=\"article:published_time\" content=\"2016-07-18T14:08:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-12-22T20:46:43+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/imgs.xkcd.com\/comics\/code_quality_2.png\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Razgriz\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/zxstudio.org\/blog\/#\/schema\/person\/0a2cf38b4b9456c20b27bf9837c90b78\",\"name\":\"MaxEd\",\"logo\":{\"@id\":\"http:\/\/zxstudio.org\/blog\/#personlogo\"},\"description\":\"I'm a video games programmer. I have worked in game industry since 2008 on MMOs and mobile games, but now I work for Owlcat Games on great old-school RPGs. In my free time, I like to play rock'n'roll on my guitar and travel.\"},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/zxstudio.org\/blog\/#website\",\"url\":\"http:\/\/zxstudio.org\/blog\/\",\"name\":\"ZX Studio Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"http:\/\/zxstudio.org\/blog\/#\/schema\/person\/0a2cf38b4b9456c20b27bf9837c90b78\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/zxstudio.org\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/imgs.xkcd.com\/comics\/code_quality_2.png\",\"contentUrl\":\"http:\/\/imgs.xkcd.com\/comics\/code_quality_2.png\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#webpage\",\"url\":\"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/\",\"name\":\"Some thoughts about code quality - ZX Studio Blog\",\"isPartOf\":{\"@id\":\"http:\/\/zxstudio.org\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#primaryimage\"},\"datePublished\":\"2016-07-18T14:08:42+00:00\",\"dateModified\":\"2016-12-22T20:46:43+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043c\u0435\u043d\u044e\",\"item\":\"http:\/\/zxstudio.org\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Some thoughts about code quality\"}]},{\"@type\":\"Article\",\"@id\":\"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#webpage\"},\"author\":{\"@id\":\"http:\/\/zxstudio.org\/blog\/#\/schema\/person\/f221fca82d9bc01ba45831b70ffc2b61\"},\"headline\":\"Some thoughts about code quality\",\"datePublished\":\"2016-07-18T14:08:42+00:00\",\"dateModified\":\"2016-12-22T20:46:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#webpage\"},\"wordCount\":182,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/zxstudio.org\/blog\/#\/schema\/person\/0a2cf38b4b9456c20b27bf9837c90b78\"},\"image\":{\"@id\":\"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/imgs.xkcd.com\/comics\/code_quality_2.png\",\"keywords\":[\"Open Horizon\"],\"articleSection\":[\"General\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#respond\"]}]},{\"@type\":\"Person\",\"@id\":\"http:\/\/zxstudio.org\/blog\/#\/schema\/person\/f221fca82d9bc01ba45831b70ffc2b61\",\"name\":\"Razgriz\",\"url\":\"http:\/\/zxstudio.org\/blog\/author\/razgriz\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Some thoughts about code quality - ZX Studio Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/","og_locale":"en_US","og_type":"article","og_title":"Some thoughts about code quality - ZX Studio Blog","og_description":"Shocking truth, but significant part of Open Horizon&#8217;s code wouldn&#8217;t pass my own code review. It&#8217;s probably ok for pet-project, because if I will rewrite code every time I want, the project would be in development forever. The reason code isn&#8217;t perfect from the start is quite simple. First of all, I don&#8217;t know how [&hellip;]","og_url":"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/","og_site_name":"ZX Studio Blog","article_published_time":"2016-07-18T14:08:42+00:00","article_modified_time":"2016-12-22T20:46:43+00:00","og_image":[{"url":"http:\/\/imgs.xkcd.com\/comics\/code_quality_2.png"}],"twitter_misc":{"Written by":"Razgriz","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Person","Organization"],"@id":"http:\/\/zxstudio.org\/blog\/#\/schema\/person\/0a2cf38b4b9456c20b27bf9837c90b78","name":"MaxEd","logo":{"@id":"http:\/\/zxstudio.org\/blog\/#personlogo"},"description":"I'm a video games programmer. I have worked in game industry since 2008 on MMOs and mobile games, but now I work for Owlcat Games on great old-school RPGs. In my free time, I like to play rock'n'roll on my guitar and travel."},{"@type":"WebSite","@id":"http:\/\/zxstudio.org\/blog\/#website","url":"http:\/\/zxstudio.org\/blog\/","name":"ZX Studio Blog","description":"","publisher":{"@id":"http:\/\/zxstudio.org\/blog\/#\/schema\/person\/0a2cf38b4b9456c20b27bf9837c90b78"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/zxstudio.org\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","@id":"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#primaryimage","inLanguage":"en-US","url":"http:\/\/imgs.xkcd.com\/comics\/code_quality_2.png","contentUrl":"http:\/\/imgs.xkcd.com\/comics\/code_quality_2.png"},{"@type":"WebPage","@id":"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#webpage","url":"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/","name":"Some thoughts about code quality - ZX Studio Blog","isPartOf":{"@id":"http:\/\/zxstudio.org\/blog\/#website"},"primaryImageOfPage":{"@id":"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#primaryimage"},"datePublished":"2016-07-18T14:08:42+00:00","dateModified":"2016-12-22T20:46:43+00:00","breadcrumb":{"@id":"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043c\u0435\u043d\u044e","item":"http:\/\/zxstudio.org\/blog\/"},{"@type":"ListItem","position":2,"name":"Some thoughts about code quality"}]},{"@type":"Article","@id":"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#article","isPartOf":{"@id":"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#webpage"},"author":{"@id":"http:\/\/zxstudio.org\/blog\/#\/schema\/person\/f221fca82d9bc01ba45831b70ffc2b61"},"headline":"Some thoughts about code quality","datePublished":"2016-07-18T14:08:42+00:00","dateModified":"2016-12-22T20:46:43+00:00","mainEntityOfPage":{"@id":"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#webpage"},"wordCount":182,"commentCount":0,"publisher":{"@id":"http:\/\/zxstudio.org\/blog\/#\/schema\/person\/0a2cf38b4b9456c20b27bf9837c90b78"},"image":{"@id":"http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#primaryimage"},"thumbnailUrl":"http:\/\/imgs.xkcd.com\/comics\/code_quality_2.png","keywords":["Open Horizon"],"articleSection":["General"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/zxstudio.org\/blog\/2016\/07\/18\/thoughts-code-quality\/#respond"]}]},{"@type":"Person","@id":"http:\/\/zxstudio.org\/blog\/#\/schema\/person\/f221fca82d9bc01ba45831b70ffc2b61","name":"Razgriz","url":"http:\/\/zxstudio.org\/blog\/author\/razgriz\/"}]}},"_links":{"self":[{"href":"http:\/\/zxstudio.org\/blog\/wp-json\/wp\/v2\/posts\/411"}],"collection":[{"href":"http:\/\/zxstudio.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/zxstudio.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/zxstudio.org\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/zxstudio.org\/blog\/wp-json\/wp\/v2\/comments?post=411"}],"version-history":[{"count":16,"href":"http:\/\/zxstudio.org\/blog\/wp-json\/wp\/v2\/posts\/411\/revisions"}],"predecessor-version":[{"id":589,"href":"http:\/\/zxstudio.org\/blog\/wp-json\/wp\/v2\/posts\/411\/revisions\/589"}],"wp:attachment":[{"href":"http:\/\/zxstudio.org\/blog\/wp-json\/wp\/v2\/media?parent=411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zxstudio.org\/blog\/wp-json\/wp\/v2\/categories?post=411"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zxstudio.org\/blog\/wp-json\/wp\/v2\/tags?post=411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}