Title: Re: Static vs. Dynamic typing Post by: onpon4 on June 14, 2011, 03:53:36 am static typing (a big plus) I don't know what planet you're coming from, but I don't see how static typing is a "big plus". Dynamic typing may not always catch errors early on, but it makes a language much more flexible. One fairly small example is the ability to use the special value None in Python, rather than resorting to values like -1, since a variable can be any type instead of being restricted to, say, integers. This can actually be extremely useful in certain situations. Title: Re: Static vs. Dynamic typing Post by: chiguireitor on June 14, 2011, 04:51:13 am Hehehe was thinking on bringing python to the fray too (if you take a peek, you'll see that uqmonline is hosted on a Google App Engine "server" which uses python)... but don't want a flame war to start :D There's two kinds of programmers: the ones that love static typing and the ones that love dynamic/duck typing.
Being a simultaneous programmer on both kind of languages (i use DAILY Object Oriented Pascal, Perl, Python, Javascript and Java) i really like the expressiveness and flexibility of dynamic/duck typing and the functional power of those languages (loved Prolog and Ocaml when i used them on the university). Things like monkey patching are great and add a lot of value to dynamic languages. However, all these dynamic languages cannot exist without their static brethen and most of those fancy interpreters are coded in one of those less flexible languages, keep that in mind always. Quick Edit: Didn't know that here in this forum were python coders :) good to know Title: Re: Static vs. Dynamic typing Post by: Megagun on June 14, 2011, 05:30:42 pm static typing (a big plus) I don't know what planet you're coming from, but I don't see how static typing is a "big plus". Dynamic typing may not always catch errors early on, but it makes a language much more flexible. One fairly small example is the ability to use the special value None in Python, rather than resorting to values like -1, since a variable can be any type instead of being restricted to, say, integers. This can actually be extremely useful in certain situations. Here's a bit of code that does what you want, plus some more, written in Java (a statically typed language): Code: int i = 0; //primitive data types such as int can't be null Integer j = null; //Integers can be null Object oj = j; Integer joj = (Integer) oj; //cast Object to Integer The real advantage of dynamically typed languages is that the language syntax can be a lot smaller, and more advanced features can be implemented way easier. Java code tends to be rather extremely verbose, yet Python code is small and elegant. This can be annoying though when you have to read someone else's code. Have fun digging through code to find out what a variable named 'foo' contains! Furthermore, dynamically typed languages allow you to extend existing code with extra features without a lot of pain. The major advantage of statically typed languages is that stuff will be checked for you at compile-time, which will save you a lot of pain if you're developing an application to launch nuclear missiles at hostile forces. Furthermore, IDEs tend to be a lot nicer for statically typed languages, as they're far more capable of figuring out what exactly that variable named 'foo' contains without running your application and figuring it out that way (bad idea), doing expensive code analysis, or making the user specify it manually in a comment-annotation (http://"http://blogs.oracle.com/tor/entry/netbeans_screenshot_of_the_week8"). Title: Re: Static vs. Dynamic typing Post by: chiguireitor on June 14, 2011, 11:17:21 pm Now we can flame each other correctly here hahahahaha ;D
Thanks meep-eep Title: Re: Static vs. Dynamic typing Post by: Lukipela on June 16, 2011, 10:51:44 pm I prefer semi-static myself, where the dynamicity can be regulated by the integer stack.
Title: Re: Static vs. Dynamic typing Post by: Zeep-Eeep on September 10, 2011, 03:47:13 pm I use a bit of both and I don't think there's a particular advantage of one or the other. That being said.... I find it easier to read other people's code in static-typing languages. Every so often one runs into a coder who likes to just throw in variables and make them do whatever is convenient at the time. That gets frustrating. It's bad enough if variable "abc" is used for different purposes, it gets worse is "abc" is a string at one point and a number later.
|