Random Post: Comments Need CAPTCHA
RSS .92| RSS 2.0| ATOM 0.3
  • Home
  • About
  •  

    Language Rants: Weak Typing and Misc.

    July 4th, 2007

    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.


    Study: Society Shits On Teens

    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