Tag Archives: rants

Static vs. Dynamic Typing

Rah. Dynamic typing is evil. It lets you do totally unsafe things.

Err, no. Wait, that’s not right. Static typing is evil. It’s ugly and gets in the way and real programmers don’t make type errors anyway, do they? Are you saying you’re not a real programmer???

No, wait. Umm…

I’m so confused…

Want to know what I really think about static vs. dynamic typing? (no you don’t. I’m going to tell you anyway).

I wish the entire goddamn argument would go away.

Seriously, shoo. Buzz off.

There’s no reason there should be a one true language in which you do everything. None. Sometimes language Foo is better, sometimes language Bar is better. Given this, there’s no reason Foo can’t be dynamically typed and Bar statically typed.

Neither is better. Each have their strengths and weaknesses. People have their preferences, tasks have their requirements. Sometimes you’re better off choosing one or the other, sometimes you’re more comfortable choosing one or the other. When there’s a compelling reason to make a decision between the two (which is so much less often than the fanatics on both sides of the argument want you to think), follow that reason. When there’s not, use whichever you prefer.

But, in the mean time, shut the fuck about it. Far too many good and interesting discussions about languages turn into poo flinging between the type system monkeys. Shut up, grow up and get over it. There are more interesting things to talk about in the subject than whether certain operations should fail at run or compile time.

That is all.

This entry was posted in programming and tagged , on by .

Concision

Warning: This post contains rant and is short on actual reasoned arguments.

There are a number of things that are often considered bad practice in Java. These include static imports, star imports, shadowing, omitting braces, notUsingReallyLongVariableNames, etc. Also, many Java developers object to features like first class functions, operator overloading and type inference, because they might ‘overcomplicate’ the language and cause people to produce unreadable code.

Given that this is a post about concision, I will now shorten the above rules into a single rule:

It is bad practice to do anything which might cause you to write less code.

“Oh.” says the (hypothetical – I don’t think anyone actually reads this blog) reader, “Another whiner who doesn’t like typing. Just use an IDE!”

This is not about typing. I know perfectly well that the IDE can do ‘typing inference’ (so to speak). This is about reading. Making your code more verbose does not make it more readable. In many cases it makes it less readable because you’re hiding the actually important stuff inside layers of crap. Further, even when all of it is relevant, expressing it in an overly verbose way makes it much harder to take in.

Even ignoring the functional programming argument, I think the Java community and conventions would gain a lot by losing their fear of terse code.

This entry was posted in programming and tagged , , on by .