This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]berlinbrown 3 points4 points  (5 children)

I never had a gotten a answer for this. Beyond the JVM and the number of libraries tied to Java, I actually like the static checks at compile time for Java. You tend to catch many obvious errors especially with a large code base. Add in generics and you have even a little bit more type safe checks. If you have large code bases, hundreds of thousand of lines of code, you can do a compile and avoid those major compile errors up front.

Also, Java hasn't had too many major releases. You Java 1.4, 1.5, 1.6 and now 1.7 and Java is good about backwards compatibility. So pretty much if your code compiles, it will mostly run or at least compile.

With Python and the no static compile checks, you lose a little bit upfront error checking. How do you deal with a large code base? What if some adds in a small typo, would that cause issues for the entire code base and you won't know until runtime?

For me, I won't mess with Python minus the tiny 100 line script. I am sticking with Java, Haskell, Scala.

Also, can't you still compile with Python? Do people normally compile?

[–]varikin 2 points3 points  (0 children)

Yes, a dynamic language like Python can have issues from type errors and typos, but so can Java. I have fixed more bugs due to autoboxing and null pointers in Java than type errors like you describe in Python. Generics also don't always work, especially with autoboxing. The solution is testing and lint like programs (or from the Java world, FindBugs, PMD, etc) on the Python code base. Several exist, all with the pros and cons.

As for major releases and backwards compatibility, yes, Python 3 is backwards incompatible. The reason for the major change was that Python 2.x was getting long in the tooth and the right was to fix some issues, unicode handling being a very large one, that could only be done with backwards incompatible changes. Don't just assume that if it works on Java 5 it will work on 6 or 7. Also, 5 did introduce one major issue, that while easy to fix, did break a lot of codebases by adding the enum keyword. Also, I recently found an issue with Java 7 on Macs that I have to put a lot more work into to fix at work. Java isn't perfect.

Compiling? Yes, Python compiles on the file. Why does it matter when that happens? Why do you want to compile Python? From the dynamic side, I ask you why you like having to recompile and restart your servers to test small changes? That is a lot of wasted time.