Latest articles

Language Rants Part 2: Language-Enforced Indentation

Originally posted: August 5th, 2007

Using indentation to define scope is a bad, bad idea. I'm looking at you, Python and SPIN. Like weak/dynamic-typing, it's fine for trivial programs, but as soon as you use it for anything more substantial it becomes a maintenance nightmare.

Let me clarify one thing: Of course you should always properly indent your code. However, the problem is when a language is designed to interpret that indentation as having semantic meaning rather than just ignoring it.

"But, if code should always be indented, shouldn't the compiler enforce that?" Not exactly. We should (and do) have tools that optionally enforce proper indentation. But such tools belong in places like the editor or the compiler's warnings, not in the language definition itself.

Read more


Language Rants: Weak Typing and Misc.

Originally posted: July 4th, 2007

(Note from July 2010: Yes, I know I refer to dynamic typing as "weak typing" here. "Weak typing" includes more than just C's implicit reinterpret casts. Dynamic typing IS a form of weak typing: deal with it.)

Years of condemnation to the seething underbelly of the programming world known as "web application development" has driven me to this plea:

Please, for the love of god, no more weak-typed languages!!! I can't take it anymore! That includes you too, duck-typing. (Yes, I realize many of those languages optionally allow strong types, but that's just a bandage, and often an afterthought.)

Here's the generalized rule of thumb these weak-typed languages are breaking:

Anything that CAN be handled at compile-time, SHOULD be handled at compile-time.

(Obviously, I'm counting "parsing interpreted-language code" as compile-time here.)

Why is this a good rule of thumb? For one thing, optimization. If you offload certain calculations (such as arithmetic on numerical literals, ie '2 + 3′) to the compilation process, then your program doesn't have to, thus speeding it up. Fortunately, this sort of thing is already handled by most compilers, so you don't have to worry about it. (If you're wondering: yes, I have come across one notable exception: SPIN)

But there's another more important reason for this rule of thumb: Bugs. Bugs are bad. There are two types of bugs: compile-time bugs and run-time bugs. Compile-time bugs are always brought to your attention automatically, whenever your code is compiled. That makes them easy to fix. Good bugs. Or at least as good as bugs get. Run-time bugs only show themselves if you're lucky. These bugs hide and fester. That makes them hard to fix. Bad bugs.

I don't like weak typing because, while it might seem to eliminate type concerns, all it really does is change the type errors from compile-time (good) errors into run-time (bad) errors. This may not be a problem when you're whipping up "Lil' Coder's First PHP Page", but when you have a full-blown web application to maintain, you'll just waste your time hunting down bugs that could have been pointed out to you the moment they were introduced.

Languages that religiously force everything into the latest silver-bullet paradigm have also got to go. I'm looking at you, Smalltalk and Java (Clarification: I like OOP. I don't like religious OOP.) Here's an excellent explanation of one of the reasons I can't stand Java.

As long as I'm ranting on languages, VB6 is obnoxiously verbose. (Yes, I know VB6 has been replaced by VB.NET. But I'm still condemned to it anyway.) Behold:

In most C-based languages:

int var = 5;

In VB6:

Dim var As Integer
var = 5

How clunky. I have other examples of VB insanity (yea, I know, who doesn't?), but they'll have to wait for now.

Read more


Study: Society Shits On Teens

Originally posted: July 1st, 2007

Filed under the category of "Things I've been saying all along, but no one's been willing to believe":

"Young people have extraordinary potential that is often not expressed because teens are infantilized and isolated from adults."

- Scientific American Reports, June 2007, page 73

"Laws restricting the behavior of young people (under age 18) have grown rapidly in the past century…U.S. teens have 10 times as many restrictions as adults, twice as many as active-duty U.S. Marines and twice as many as incarcerated felons."

- Scientific American Reports, June 2007, page 72

Read more


Light On Dark

Originally posted: May 16th, 2007...BUT STILL IRRITATINGLY RELEVANT!!

Seriously, am I the only programmer left who uses a light-on-dark color scheme?

It seems like every other program and website I go near has some element that completely chokes on light-on-dark. Commercial, open-source, Windows, *nix, whatever, it happens everywhere. (Except Mac OS. Last I checked (admittedly way back at v10.2), you can’t even set up a custom color scheme on one of those. Unless you count setting the highlight color - whoohoo...)

The rule of thumb I like to follow:

Foreground and background colors: Set both or set neither, but never just one.

In the interest of avoiding potential hypocrisy: If you ever come across something I made that strays from that, feel free to smack me.

Read more


Climate And Daylight Savings Time

Originally posted: April 23rd, 2007

Wow. Just, wow...

"You would think that members of Congress would have considered the warming effect that an extra hour of daylight would have on our climate."

- Connie M. Meskimen of Hot Springs, Arkansas

From:

Climate And Daylight Savings Time

Climate And Daylight Savings Time

Source: http://www.nctexasbirds.com/images/hot_news.jpg

Read more


Build Environment Poll For GBA/DS Homebrewers

Originally posted: April 3rd, 2007

GBA/DS homebrew developers: Please take a moment to answer this poll I've posted at the gbadev.org forums. I'd like to further my efforts at making GBA/DS development easy to get set up and going, but I'm not sure what the most popular tools are. I'd like to continue progress on GBAForVS6, but I don't know if anyone's even using Visual Studio 6/MSVC 6 anymore.

Read more