The Right Glue
2010 archives

Minecraft

By Dean

Let's start by pretending that you haven't heard of Minecraft. Minecraft is a game where everything is a cube, including you for the most part, and you and your friends have to survive the wilderness together. You can do this in any number of ways, from digging underground to find precious iron, gold and diamond cubes, to farming trees and building a nice little house on the surface. Or you can do something completely different. It's really up to you. Minecraft's open nature is a big part of what draws people to it.

But let's make one thing clear: the creator of Minecraft, Notch, is crazy. You're going to understand why by the end of this post. It's not just because he's Swedish. At least I don't think it is. It has to do with Minecraft's insane bugs. Remember my last post? I wrote it so that I wouldn't have to explain what an insane bug is while talking about Minecraft. I'm going to assume you've already read that post from this point on.

Working from the insane bug proposition, it follows that I can prove that Minecraft's codebase is full of architectural nightmares if I can show that it contains insane bugs. It also follows that Notch is crazy if Minecraft's design is a horrible topology the likes of which not even Cthulhu could generate.

Latest comments:

Insane bugs

By Dean

There are a lot of differences between marketable-product code and hobbyist code. This isn't really subject to debate: the hobbyist will write quick and dirty applications for himself and maybe a few of his friends. When feature requests come in, the hobbyist will typically just hack them on. It's a method that breeds a lot of bugs since, instead of taking the time to refactor the codebase to accommodate the new functionality at the right level of abstraction, the hobbyist will break every rule in the book in order to get it done faster.

That's what I did the very first time I added Markov chaining to KevBot. The result was sloppy, slow and unreliable. That's why I took the time later to make several improvements to the codebase to do it properly. Not that KevBot is anywhere near marketable-product-level code, but its architecture is at least not wrong for its functionality.

For a software product to be marketable its code really ought to be organized in the simplest manner possible, for many reasons: multiple programmers need to understand the software the same way (the more complex the organization, the more likely two different programmers will understand something differently), simpler code that is broken into proper abstractions is easier to prove correct and bug-free and, perhaps most importantly, bugs become isolated when code is loosely coupled and simple.

How I learned to do things backward

By Dean

My typical approach to everything is to figure things out at a high level, then dive into various parts to fill in the details. That's usually how I do software design and implementation, it's how I figure out how to make food, it's just a basic philosophy for me. I do it naturally whenever I have to do anything.

Or rather that's what I've been telling myself for the last couple of years. Some of my recent experiences have shown me that no, this is not how I approach problems in general. This is definitely for the best, since if I always used the same approach I would start to think of it as a silver bullet, and that's a trap I'd like to avoid.

Lately I've been running an RPG game with some of my friends, and I've been planning another RPG setting that I'll be starting up soon. (RPGs are a great way to kill your friends outside of video games, by the way.) When I first started out, I tried to figure out a plot at a high level and tried to fit characters and settings into that theme. When I ran a few sessions doing things that way I quickly realized that the players were overpowering my characters and were finding holes in my plot.

Latest comment:

Resistance to usability

By Dean

I'd like to share an idea that has been brewing in my head for a few months now. Ever since I read The Inmates Are Running the Asylum by Alan Cooper, I've started noticing something in how "computer literate" people behave with respect to new, presumably better software. You don't have to buy and read the book, since I will paraphrase for you the relevant parts. It might take a paragraph or two, though, so bear with me.

I'm going to start by defining some terminology that Alan uses in his book regarding two types of software users: survivors and apologists. The fundamental argument of Alan's book is that software systems are designed in a way that disregards human sensibilities, creating artificial difficulties in how humans use applications. There are two approaches that people take when using these difficult systems.

The first is those who, in trying to work with strange software, learned the strange rules that drive software and are complacent (if not comfortable) with the arbitrary nature of computing. They are called apologists because they needed to learn about computers in order to understand the software they use and because of this they recognize the difficulty of making friendly systems. They apologize, not unlike Stockholm syndrome patients, for the software creators' sloth and lack of humanitarianism. Apologists will often tell themselves that they have gained a great deal of power by thinking slightly more like machines in order to operate computers successfully. Sufficiently advanced apologists even go on to become programmers themselves (like me), perpetuating overcomplicated software (hopefully not like me).

Latest comment:

Algorithmic depths

By Dean

In a manner most typical of me, I have once again added a new annoying feature to my wonderfully retarded artificial son KevBot. If you'll recall, the last feature I added was the ability for KevBot to masquerade as IRC users (provided they have given enough data to KevBot for it to form a decent Markov model for that user). This time I am spelunking, not unlike the player in Minecraft, into the depths of recursion.

Now I'm aware that not everyone who reads my blog is a computer scientist and I'm also aware that I have a reputation of explaining things well that I have to maintain should those non-computer-scientist people follow the rest of this post and therefore stick around and leave comments (the cardinality of comments left on my blog being a measurement of my worth as a human being (I like run-on sentences (and parenthetical nesting))).

To put it tersely, recursion is defining something in terms of itself. To understand how that makes any sense, think of a Matryoshka doll. Let's define a Matryoshka doll as a hollow doll with a Matryoshka doll inside of it. So a Matryoshka doll can be defined in terms of Matryoshka dolls. Look at me, I'm using recursion!

Latest comments:

Design patterns

By Dean

Australia is spiting me again, this time with a blog post I found in a thread on The Daily WTF's forum. The post is called Design patterns have (mostly) flopped. You can read it if you want, but I can summarize it for you.

Basically in this article the author makes the claim that knowing a lot of design patterns is supposed to arm programmers with the terminology required to communicate complex designs to each other. (This is on top of the usual benefit of patterns — which is taking advantage of the fact that someone has already solved your problem for you.) He goes on to say that patterns have failed to accomplish this goal because so few programmers know what design patterns are and those that do tend to not know very many of them.

I'm going to try to show why design patterns are a poor choice for communicating designs and why memorizing design patterns is a silly idea in and of itself. Also I am really getting tired of Australia.

Latest comments:

Spam and captchas

By Dean

If you remember that weekend I coded up a website just to prove that I could, you'll remember that I put a lot of focus on GBDB's ease of use for casual users. Well it turns out I made it too easy to use because one little spambot decided to fill its queue up with over 30 pages of the worst kind of spam. (Nashville spam — FYI.)

On the Right Glue I've already had to deal with spammers albeit on a much smaller scale. The particular scheme I use here is called a honeypot, which is essentially a hidden field that bots find irresistible which makes it obvious that they are not human.

But GBDB was being targeted repeatedly by a real spambot tailored to the site — adding a honeypot wouldn't be effective because the bot was already designed to fill in just the fields it needs. I needed something bigger, something that bots cannot figure out (not even KevBots).

Latest comments:

Contradictions

By Dean

So now that I'm living in Toronto and finally have an Internet connection set up I'd like to talk about something I experienced multiple times while getting services set up in the area.

I am amazed at the fact that everything requires a phone number as contact information — including the phone service provider. Yes, you read that correctly: in order to set up a phone connection I needed to provide the company with a phone number.

Obviously I didn't have a phone number since I disabled my New Brunswick phone service because I moved away. Rather than let logic tell them that as a phone service provider, requiring a phone number doesn't make sense, the company requested that I give them a friend's phone number instead. After much complaining about how silly this was, I complied.

Latest comments:

Moving to Toronto

By Dean

In lieu of a normal post I'm going to just leave you with some quick advice while I pack up for my move to the Toronto. First of all, while I'm moving my server the website will be down. Oh no, how will you read my amazing post?! If you're like most of my readers you're using an RSS reader so you should be fine. You'll just have to live with not looking at my cool side images for about a week or so.

But enough about that, while leaving my current position I've rediscovered the importance of showing off your code to other people. Since I've had to teach other people the software that I've been writing and supporting so that my company doesn't explode due to lack of maintainance after I leave. It's terribly important even though explosions are awesome.

We've all experienced this when explaining something to someone else: the act of converting your understanding of a system into words to describe to someone else shows you flaws or oversights in the system you're trying to describe. Thinking about the system from a point of view that you don't normally use (i.e., someone else) will often reveal to you very obvious flaws in your designs. Things that are completely obvious but for whatever reason you would have never noticed them while doing your normal work.

Coding mistrust

By Dean

Lately I've been having another bout with the southern hemisphere. Australia, lying broken and defeated before me, has been usurped by its ally South America. This time the barrier isn't the misalignment of time zones but rather a misalignment of language.

You see, South America, being a part of Spain, speaks Spanish and Portugese instead of English (which is, according to some sillywhistling vampire, the lingua franca language of programmers). Therefore when South America wants me to do things I need someone else to translate it for me. But that's not even the half of it. Even if they spoke a language I understood I would have still had a problem with the fact that, apparently, South America likes to omit very important details from its documentation and just assumes that everyone knows it, or something like that. I don't presume to understand the mind of South America.

Not having important details makes programming very hard. I don't think I can stress that enough: programming a computer is like teaching a child to tie his shoes by telling him exactly which muscles to move, with how much force, at specific points in time. Detail, or rather specificity, is paramount in the field of software development. I have had to work far outside of my specificity comfort zone on behalf of my dear friend South America and I'd like to talk about how this makes programming a nightmare.

Latest comment:

How wrong you are

By Dean

It's time to talk about what I've learned about teaching from Stack Overflow. I can sum this post up in one complicated sentence that hopefully with spur you into reading on: in order to teach someone who has preconceived notions of what he's learning about, you need to learn what he thinks, first, in order to use it to frame your approach in teaching him. If you know what I mean you can stop reading now. Not that you should, but you can.

The fundamental problem with people who ask questions on Stack Overflow is lack of knowledge. Obviously this is the case since people who already know the solutions to their problems don't bother asking questions on Stack Overflow in the first place. So we can proceed under the assumption that there is a general lack of knowledge in people who ask questions on SO.

Among those, there two broad categories: people who are truly here to learn and people who are just lazy. Since I've already written about those who are just plain lazy, I'd like to focus this post on people who have legitimate questions they can't solve by themselves.

Latest comments:

Algorithmic doppelganging

By Dean

It's been a while since I have visited a subject close to my heart: Markov chains. In case you're new here (doubtful) or just love my writing so much that you want to read my earlier posts on the subject (also doubtful) feel free: first I explain Markov chains in lay terms, then I improved my original algorithm, I completely changed the way I was collecting and organizing data and then finally I replaced that structure with a MySQL table (which I haven't posted about yet).

Lately KevBot has been having trouble with its chaining because its word-pair table was approaching three million records. This table was a slapped-together idea that I whipped up on the fly because the previous graph was taking up too much space. The table was as simple as they come: one record for every recorded word pair. That means that every time someone says anything, a record is added to this table for every two words he said, even if those pairs were already there before. In fact, repetition was necessary to this structure because that is how the weight problem was solved.

See, if one pair of words is more common (statistically speaking) than another, KevBot needs to be able to pick that word pair over the other. So KevBot needs some way to assign extra weight to the more common word pairs. The simplest and most naive way to do this is to just repeat records: if a record is common, it will be there more often, so a random selection by definition accounts for the weights without any extra work. It's a very easy solution, but it doesn't scale well: every time someone says something it adds more records to the table.

Latest comments:

You humans confound me so

By Dean

It's time to go on a journey into what I do at my place of work. A lot of what I do is interfacing — you know, making different applications talk to each other even though they speak different languages and were originally designed by different rooms of monkeys each with different types of brain damage.

One particular monkey-written application we have here stores product information. I'm going to call this application "the source". We also have another application that stores product information, but slightly different types of information and for different reasons. I'm going to call it "the target". Now, the target's room of monkeys decided to skip testing when they wrote their software so it happens to be rather fond of breaking.

In particular, its data-import process tends to freeze up for no particular reason and the only way to fix it is to restart the whole thing (like Windows 98!). I'll spare you the details, but basically we've talked with its simian creators and they all agree that the only solution to the problem is to restart it when it freezes. So just trust me that we tried our best to figure out why this piece of shit freezes and ultimately we settled on just restarting it when it happens.

Latest comments:

Jeff is a fountain of silliness

By Dean

Jeff Atwood has done it again, folks. I have a new favourite MMORPG (replacing Stack Overflow as my previous favourite) called Area 51 (which is currently in password-protected beta, but if you ask me nicely I might be persuaded to give you the secret password to get you in).

Let me try to explain Area 51, at least insofar as I understand it. That vampire and Joel had originally released a version of Stack Overflow's backend software called Stack Exchange that would be sold as a service to anyone who wanted to create his own Q&A site. That had been going on for a little while and created a few successful sites, notably Math Overflow. The basic idea was that people with good enough ideas could attract a lot of experts to their Q&A sites and be able to make a profit from ad revenue.

Unfortunately for those who had opted into this scheme, the Stack Overflow team decided to scrap that idea in favour of an even stranger idea: a site dedicated to proposing new Q&A-site ideas coupled with a system to see these proposals from their initial stages all the way through to a fully operational semi-independent Q&A site. The basic idea here is that the sites will have a following from inception instead of being created first and gathering support second. A much more complicated explanation as written by Joel is available on the Stack Overflow blog if you feel like reading a lot of words (but then again this blog is a lot of words so you must be in that mood by definition already). This staging area where new site ideas are proposed is called Area 51.

Latest comments:

The things I do in my free time

By Dean

My friend Seth and I get banned from a lot of things, usually because we hate whiners and because most of the time whiners make servers so that they can feel like they're in control. Suffice it to say that Seth and I severely enjoy getting banned for doing absolutely nothing wrong to the point that we actively seek bans in lieu of a normal, silent exit. We've been doing this for years and have been met with a problem: we forget our amazing ban stories because there are simply too many of them.

So we had been skirting around the idea of having a repository for these stories for a while, but neither of us particularly had the drive to see it through. Then in the middle of April the idea sprang up again, and on that particular day I had been reading about HTML 5 and had been wanting to cut my teeth on some of the web technologies I had been neglecting (purposefully — since I want to keep The Right Glue as low-tech as possible) so I decided that I would see how fast I could bang out a fully functional website using semi-unfamiliar technology and so that I could have something to show off in case anyone ever wants to know how awesome I am.

Seth and I started talking about what the site should be able to do. We, of course, based our feature set on the well-known anecdote sites QDB and bash.org since they have been around practically forever and have pretty good interfaces. Those sites' focus is similar to ours in that we want to share stories and allow users to vote on them, allow stories to be searched easily and viewed individually. On top of that base we also had some extra features of our own to add, the most important of which is categorization. We thought about tags, or general categories, but we ultimately settled on "media", as in "the medium from which the author of this anecdote was banned". That kind of phrasing lets us include video games, forums, IRC and even real life.

Latest comments:

Compilerless development

By Dean

We already know that people who call themselves programmers can't program. That's nothing new, nothing exciting. The number of people with the title "software developer" who are more than copy-paste programmers are obviously in the minority, if things like a the Daily WTF and Stack Overflow's terrible questions are any indication.

Understanding that, let's restrict ourselves to the subset of titular programmers that are actually good at what they do. How many of us (who can write software without just splicing together snippets we found online like a dumb version of Victor Frankenstein) can write software without a compiler? For the purposes of this discussion, any syntax checker or interpreter counts as a compiler (in addition to compilers themselves, of course). That is to say, without anything more than a text editor (ideally without syntax highlighting), how likely are you to be able to write bug-free code?

Not very likely, says Jon Bentley. According to a study conducted only 10% of programmers at IBM at some point in the 1980s were able to write a bug-free implementation of binary search (an algorithm very fundamental to my IRC bot). Mike Taylor of The Reinvigorated Programmer challenged his readers to beat the 10% benchmark and to show that programmers are improving with time.

Latest comments:

Everyone is unique

By Dean

This is going to sound cliche, however it doesn't hurt to remind ourselves of the obvious fact that everyone is different from everyone else. Understanding these differences and how you, specifically, deviate from your peers will help you become a better software designer.

The most overmentioned fact related to this is that you, as a programmer, have a completely different understanding of the software that you create than your users do. It goes without saying that as the creator of a given thing you have intimate knowledge of its details that no other mortal but you can possibly have; therefore you have a complete mental model of the software whereas your users can only work with an inferred mental model.

"What is this insanity?" you ask yourself (as I force my thoughts into your mind via Internet waves), "I already knew that." Well, that's what you should be thinking, anyway. However, it's pretty obvious from the state of software that these thoughts never enter designers' minds when they're doing what they tell themselves they do best. That's how we end up with terrible designs.

Latest comments:

My impression of Dean

By Doug

At least in this month I decided to use in the future, when programmers have to do.

Our pointy-eared teacher wants us to think that way. But I don't care if everyone approached software design and engineering occupations can make full use of tables to lay it out. Tables are not available to all the interesting things to get through the archives, it lists the date. If you're creating a rule to be anything complicated. Just go the right Glue doesn't have a brief mention in C&C Firestorm didn't weigh very heavily on the wooden desk. Its monitor is the number of reasons, including the names of fields and put a lot of software (especially Web software) can and cannot acquire it later.

Some things are different (from post to post) are black, while items that are just the right. Also, the content that doesn't cost $10 and has the same kind of organ that can be made into an inorganic crystal, instead of just the thing: if someone has split a deck of cards into two smaller lists: one for parsing strings; Java is designed to solve. The drawback of fixed-width design is if you had a lot of effort, this whole ordeal might be trivial.

Latest comments:

Language diversity

By Dean

Recently one of my friends on Wave started voicing questions regarding the vast number of different programming languages we have. He had trouble (until the rest of us set him straight) understanding why people go so far to make all kinds of new programming languages and, even more vexing, why people even bother using them. He's OK now, but still it seems like something interesting to write about.

We make new languages, new frameworks, new libraries, new runtimes, new environments, new whatevers in order to reduce the immediate complexity of a given task. That is, in order to make various common tasks easier or, in some cases, completely invisible to the developers trying to solve higher-level tasks. Of course, the task's complexity is absolute and isn't really reduced; it's just that the apparent complexity of the task has been reduced.

For any given task it's going to take a certain minimum number of CPU cycles to complete, regardless of what language it was created in. This is the actual or absolute complexity of the task. What languages and frameworks do is hide away much of this complexity using automation and encapsulation so that programmers don't have to worry about those details. Therefore, their minds are freed to concentrate on the task and so it seems a lot less complicated than it really is.

Latest comment:

Whitespace is not a problem

By Dean

Prepare your mind for the rocking it is about to receive: coding style is not a problem. None of it should ever be an issue: whitespace, indentation, line breaks, even the eternal battle over whether opening curly braces deserve their own lines or not. It's not something to fight over; it's not something to worry about; it's not something that you should spend more than a few moments pondering.

Contrary to what Steve McConnell says in his book Code Complete and what our favourite vampire has to say about whitespace, I am going to confidently say that code style is easily solved with a little thing I like to call automation. Both Steve and Jeff would have programmers rely on a process to determine code style: everyone on a team must remember a set of rules governing how indentation should be handled, where to place curly braces, where to break up very long lines, etc. But as we all know, manual processes are never a good idea.

"But wait," I can hear you saying, "if everyone working on the same code base uses a different style, the code will become messy and no one will be able to follow it!" Ah, my straw friend, but you're forgetting something very important: the compiler doesn't give a damn about your whitespace. (Note to Python users: Python is not a real language. (I wonder how much hate mail I'll get from that one.)) That's why decent IDEs have a button that will completely re-indent all of your code for you, according to the settings that you have given it.

Latest comments:

The futility of process

By Dean

It's soapbox day so bear with me while I take your hand and lead you through the dark, scary tunnel of logic to arrive at the conclusion that manual processes should never exist. This is going to be a long one, folks, so grab some coffee and a donut and open up your mind for this rollercoaster of rhetoric. (Note that while this post's (contrived) examples are about software development the fundamental lessons apply to any creative field.)

First of all I'd like to start by defining what I mean by "process" just so that we can start from a level playing field. A process is something a company creates in order to curb perceived or real threats to software quality which generally seeks to control the actions of software developers by making them do things they wouldn't otherwise do in the name of "control". "Control" in this case means that someone in the organization wants to feel safer because there's a process in place restricting what people are able to do and is therefore controlling their behaviour in at least a small way. A process is a set of instructions and preclusions that direct the creation of software.

Examples of things that match this definition of process are easy to find. They can be as simple as a general rule such as "never use generics" (because, presumably, someone in the past had used generics and had caused a horrible bug in the software) or as complicated as a specific, convoluted flow of steps that must be followed, documented and reviewed before bug fixes can be put into place. Both of these are sets of instructions designed to increase the perceived level of control over the creation of the software.

Latest comments:

The foreign-language test

By Dean

Recently I took the time to introduce some of the guys on Google Wave (yes, I'm still using Google Wave even though it's getting laggier as time goes on) to Nico Nico Douga as an example of a well-designed website. I forget what we were talking about that spurred me to show this site to them, but it assuredly came from one of my Livestream broadcasts (which are occasionally online when I feel like broadcasting my games).

My point was that Nico Nico Douga is designed well enough that one can navigate the site in spite of not having any idea how to read any instructions. The same idea is captured in the web comic Grumble which is written in a number of scripts that only the author knows how to create. In one case, you don't read the instructions because you don't know the language its content is presented in; in the other case, you can't read the speech bubbles because the author is specifically obfuscating the language.

But in both cases, it's possible to figure out what the site is about immediately because of good use of visual distinctions and presentation.

Latest comments:

Asterisks

By Dean

Today I was thinking about forms. You know, those terrible little monsters that are always trying to steal your keyboard's input to feed the giant data-consuming demon that lives in the bottom of the Internet (the bottom of the Internet being, of course, Google).

A form that probably everybody sees on a regular basis is the sign-up form. This is the one that always sucks the most nats of data from your unwilling fingertips. But there are a lot more forms you see on a regular basis, from a posting page for your favourite forum or the comment form at the bottom of this very page (for those of you not using the RSS feed).

There has been a convention for online forms for a long time: asterisks indicate whether a given field is required or optional. I'm not sure where this horror started, but I'm so very glad that the majority of popular websites are moving away from it. But it's still out there, so I must continue fighting the good fight against the so-called "required asterisk".

Latest comments:

Is it me or is it you?

By Dean

Coming from the same camp of people who put whitespaces before their question marks that brought us Xinus comes another Doctype question. Madi D would like to know How to get this effect/behaviour ? and I would like to know why everyone seems to be ignoring this site's comment and contact functionality.

Having someone come to my site, think it's neat, then ignore the "contact me" link at the bottom of every page only to post about my site on Doctype (a site dedicated to website design) is flattering and confusing, to say the least. At least it is the first time it happens. Now it's happened twice, in almost the exact same way, and I'm becoming concerned that maybe something is wrong with the way I'm presenting my contact link.

Madi D's explanation on Doctype is simple enough (ignoring the 'exclamation point space comma' grammatical atrocity (grammatrocity)):

oh, sorry missed that :D , thx for pointing it out! , i was so awed by the effect i didn't even read the text!

Latest comments:
This is some kind of footnote. This webpage is awesome and can be viewed in any browser. Even ones that suck ass like Safari and Firefox. Isn't that awesome? This site is best viewed with browsers that aren't maximized on large-resolution displays (> 1024 pixels in width). But then again, if you are running a large resolution and browsing maximized, then you're a terrible person so you don't really deserve to see this site at its finest. Jerk. I mean, seriously. I spend all this time making a nice site and your silly browsing habits ruin its look. That's really cold, man. If you're using IE6, then in order to see the cool avatar effects you need to enable JavaScript. This site conforms 100% with the laws (both known and unknown) governing physical reality. No rights reserved by Dean Whelton (who is awesome) of any of the content, images, design, backend or electrons used in this site. Steal at your convenience. None of it is worth stealing anyway, so there. I have even made an RSS feed for more efficient theft of my intellectual property. Now, don't say I'm not generous. I guess if you want to know more about me, you can visit the about page. I actually made a real about page! It's more like a FAQ, though. You can contact me, too, if you feel like it. Are you really wasting time reading this? Go outside or something.