Dynamic Typing is an extreme sport
Posted on 04.11.2009 10:16 pm
I've been programming in a dynamically typed language my whole programming career. I'm used to it and I grew to love it.
I've tried a lot of programming languages but never really used a statically typed language for a long time. Now I've been using C++ for all school projects for close to 3 months now and I'm starting to like the safe blanket that is static typing.
If a function has a type assigned to it. I can be pretty darn sure that I will get that type out of it. It's so safe that when I look back on dynamic typing, I can only compare it to some sort of an extreme sport.
If you're working with a large library for the first time, coded in a dynamically typed language, and you call some function and get back an integer, there's nothing stopping it from returning something else in some other edge case. It's up to you to check the source of that function to see what I can return if the documentation does not specify it, and usually the documentation just states "returns mixed"
Something like this is very common in PHP libraries. (Horde, scroll to the bottom)
function foo()
{
if(!$somevalue)
{
return false;
}
return $array;
}
If you're into exciting coding experiences like this, then dynamic typing is your cup of tea. But for me, I think I'm cuddling under the nice blanket of static typing with a hot cup of cocoa.
1 8 Like it or hate it? - Comment (1)
Lucas
1 1 / Posted on 04.11.2009 11:29 pm
I went the opposite route, but came to the same conclusion. I started programming in C/C++ and got used to a statically typed language. Then I tried Python and actually liked it. However, I wouldn't want to use it as the language for my day job. For that, I'll stick to C#.Process time: 0.008043 seconds