Friday, June 24, 2011

I Hate Foo Bar

The other day I was reading through a computer coding example and was confused by the words "foo" and "bar." I'm not sure how those two words crept into our vocabulary, but they are fairly ubiquitous and I don't like them. I know they are two words that don't really mean anything and are meant to be placeholders for other information, but I wish authors would stop using them.

If I was to write an example SQL query and wanted to use foo bar, it would look like this:

SELECT foo
FROM bar
WHERE gobblygook = 'more gobblygook';

While it is an example that shows the proper syntax of a SQL query, it is not nearly as easy to understand as the following:

SELECT employee_names
FROM employee_table
WHERE salary > 100000;

I don't have to translate that "foo" could also be something concrete like an employee name or that "bar" represents a table of employees. Simply by using examples that everyone can understand greatly improves readability and makes things much easier to understand.

In this age where everyone can be a published author (like with this blog) and you find yourself creating examples. Don't use "foo" or "bar." Instead, use real words that everyone will understand, even if they are just supposed to be placeholder words. Oh, and don't use "gobblygook" either.

No comments:

Post a Comment