Static typing
This is how Dr. Gary Larson graphically describes static typing.
People used to static typing often express their concerns about the safety of dynamically typed languages. My experience with python has been so far that it’s not a problem that you get into, as strong typing (yes, python is strongly typed) and good tests are there to help you. At least, is not a more stunning problem than that of typos when declaring types.
Bruce Eckel has two interesting articles about this topic: ‘Static vs. Dynamic’ and ‘Strong Typing vs. Strong Testing’, that are a must read, IMHO.
I first read Bruce Eckel some years ago when I found his excellent ‘Thinking in C++’. It’s really a good book that concentrates on shifting your mind towards the object orientation paradigm instead of just describing the C++ language and the object oriented syntax. Before reading it I had already programmed in C++, but it was a reall eye opener.
x wrote,
It’s not a problem to you, how about your coworkers? Do you share Python code with them? What code base are we talking about, 10,000 lines of code? 100,000? 1 million?
Link | noviembre 19th, 2006 at 1:27 am
pachi wrote,
It’s not that static typing is useless, but it comes with its own problems, and the problems you’re supposed to find in dynamically typed languages are not that important in my experience.
Take into consideration that I’m not a professional programmer and my experience is, therefore, limited, but huge projects written in such languages do exist and lots of people that have been exposed to both models report the same experience (http://www.stylusstudio.com/xmldev/200205/post00450.html#). Also, keep in mind that I’m not talking about weakly typed languages here (btw, python is strongly typed).
I’d recommend you reading Bruce Eckel’s articles for a more detailed rationale. They’re worth it.
Thanks for reading the post and leaving a comment, anyway :).
Link | noviembre 19th, 2006 at 1:02 pm
Ricky Clarkson wrote,
Static typing doesn’t have to mean type declarations everywhere. For example, Haskell is statically typed, but has inference, so you don’t have to specify types (but you can).
square x=x*x
is a function definition, and the type of ‘square’ is a function that takes a Num and returns a Num.
I think there’s room in more conventional languages like Java, for type inference, but probably in the IDE rather than the language, by having the IDE hide declarations (if that’s your preference).
I noticed that lisp has an equivalent to static typing, whereby you can run code and generate code at compile time. I haven’t seen that used, but I expect it works out to be a lot more flexible than Java’s typing.
Link | noviembre 19th, 2006 at 3:27 pm