{"id":11856,"date":"2011-06-02T23:08:59","date_gmt":"2011-06-03T04:08:59","guid":{"rendered":"http:\/\/www.shamusyoung.com\/twentysidedtale\/?p=11856"},"modified":"2011-06-02T23:08:59","modified_gmt":"2011-06-03T04:08:59","slug":"ask-me-a-question-software-bugs","status":"publish","type":"post","link":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=11856","title":{"rendered":"Ask Me a Question: Software Bugs"},"content":{"rendered":"<p><table   class=\"\" cellpadding='0' cellspacing='0' border='0' align='center'><tr><td><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/minecraft_chest.jpg' class='insetimage'   alt='minecraft_chest.jpg' title='minecraft_chest.jpg'\/><\/td><\/tr><\/table><\/p>\n<p>Here is <a href=\"http:\/\/www.shamusyoung.com\/twentysidedtale\/?page_id=7305&#038;cpage=3#comment-215140\">a question<\/a> from reader cody:<\/p>\n<blockquote><p>Me and my brother got into an argument recently and I figured you could help us settle it. It started when an update for Minecraft was released that caused the game to crash when shift clicking items into a full inventory. He thought this was incompetent coding on behalf of the developers and that any problem like that would be obvious and easy to fix. I told him that it&#39;s a lot more subtle than that and any number of seemingly insignificant bits of code could break the game in major ways. In the end we both agreed that computers only do exactly what you tell them to, our opinions on what that means are different though. He thinks that it means if you tell them to do something that breaks the game you&#39;re bad at making games.<\/p><\/blockquote>\n<p>There&#8217;s an old saying among writers:  <em>Writing is re-writing<\/em>. The real work isn&#8217;t having an idea or putting the words down, the real work is when you&#8217;re done with that and you have to go back and polish, cut, and expand until the work flows.<\/p>\n<p>There&#8217;s a parallel saying for software engineers:  <em>Programming is debugging<\/em>.  Yes, a terrible programmer will write bad code. But a normal programmer and an exceptional programmer will write good code.  The difference between the two appears when it comes time to locate an obscure bug or intuit the source of a problem based on the non-technical ramblings of an end user.  A task like that can take a day or five minutes, and it all comes down to how deeply the programmer understands the discipline. <\/p>\n<p><!--more-->The thing is, ALL programmers write bugs.  <a href=\"http:\/\/en.wikipedia.org\/wiki\/John_D._Carmack\">John Carmack<\/a> is one of the most brilliant software engineers alive today. He&#8217;s a visionary, an inventor, a member of Mensa and  yes, <a href=\"http:\/\/en.wikipedia.org\/wiki\/John_D._Carmack#Armadillo_Aerospace\">he&#8217;s also a rocket scientist<\/a>.  Yet he writes bugs just like the rest of us.  It&#8217;s unavoidable. Saying a programmer should never make bugs is like saying writers should never make typos.  A good one will make fewer than a bad one, but they happen to everyone. (In fact, it&#8217;s probably pretty even between great coders and average coders, because we all seek our own level.  If you&#8217;re able to write something completely bug-free, then you&#8217;re under-utilizing your abilities and you&#8217;re probably bored at your job. We all want to hit that sweet spot where the work is challenging enough to be interesting and rewarding, but still easy enough to avoid frustration.)<\/p>\n<p>But this Minecraft bug isn&#8217;t about programming skill.  That&#8217;s a playtesting problem.  Writing the bug was a trivial mistake. Releasing the bug was less so.  This began as a one-man hobby project with low expectations and is now a multi-million dollar project with a team and an immense base of customers with the usual consumer demands.  Mojang is going to go through some growing pains as they develop a production pipeline and company policy regarding releases.  <\/p>\n<p>Having said that, let&#8217;s keep this in perspective.  As I said on <a href=\"http:\/\/twitter.com\/#!\/shamusyoung\">Twitter<\/a> a few days ago:<\/p>\n<blockquote><p>Today&#8217;s Minecraft beta was SO BUGGY that I nearly thought it was a post-release AAA game from Bethesda!<\/p><\/blockquote>\n<p>I&#8217;m not usually an apologist for companies who put out buggy software, but the game <em>is<\/em> in beta. This was one bug, released during beta testing and patched soon after.  If this is the wost sin of Mojang, then they are way, <strong>way<\/strong> ahead of just about every other studio on the planet. <\/p>\n<p>As for how such a simple thing could lead to a crash? Pfft.  There&#8217;s a thousand things that could to that.  Here&#8217;s a hypothetical:<\/p>\n<p><table   class=\"\" cellpadding='0' cellspacing='0' border='0' align='center'><tr><td><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/minecraft_inventory.jpg' class='insetimage'   alt='minecraft_inventory.jpg' title='minecraft_inventory.jpg'\/><\/td><\/tr><\/table><\/p>\n<blockquote><p>The feature is: When you open a container and shift-click on an item in your inventory, it transfers the whole stack into the container for you.  If you click on something in the container, the whole stack is moved back to inventory. <\/p>\n<p>But of course, some containers are joined with other ones, making double-sized containers. Additionally, these joined containers must act as one, so that clicking on either one will present the same list of items in the same order.  (As opposed to listing the one you clicked on first, followed by the &#8220;other&#8221; one, which would confuse users, since it would look like items were &#8220;re-arranged&#8221; in their box.)    If one container is full, your shift-click should send the items into the second container.  Containers are joined in pairs, and these pairs can be formed by any two adjacent cubes on the same vertical plane. <\/p>\n<p>If the logic for this was messed up, then it can end up trying to put items into a container that doesn&#8217;t exist. Boom. Welcome to crash city.<\/p>\n<p>Maybe Notch wrote the feature, built a single box, tried it, and concluded it was done, without testing it on double boxes.  Maybe it worked fine at first, but later making changes to how the server and client transfer container data resulted in a shift-click causing a crash.  <\/p><\/blockquote>\n<p>Note: This is not an informed guess.  Or even a wild guess.  This is an illustrative example to show that the complexity of a feature has nothing to do with how simple it is to USE.<\/p>\n<p>Notch single-handedly wrote a rendering engine, an interface, a character animation system, and a client-server architecture.  No, he&#8217;s not a bad programmer.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is a question from reader cody: Me and my brother got into an argument recently and I figured you could help us settle it. It started when an update for Minecraft was released that caused the game to crash when shift clicking items into a full inventory. He thought this was incompetent coding on [&hellip;]<\/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-11856","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/11856","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11856"}],"version-history":[{"count":0,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/11856\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11856"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11856"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11856"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}