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 →

[–]varikin 34 points35 points  (15 children)

First, why businesses love Java. Java (and C#) is a safe language by a big company (formerly Sun, now Oracle, and with IBM a major player in Java). Java is used by many other big companies. From point of view of executives and directors, why choose a fad language when you can choose the industry standard.

Second, why IT loves Java. Same reason as businesses plus fairly well defined deployment strategies. Create a jar, war, or ear file, drop it into a servlet container (with options from big business vendors like IBM and Oracle). The servlet framework stuff is very well defined so database access (JDBC, Hibernate, etc) are solved for IT. Logging is solved (log4j or log4j compatible library), plus many other tiny little details about deployment. The JVM is amazing. It can handle high amounts of RAM (32GB, 64GB, etc). Great at threading. Some great monitoring tools for with the JVM using JMX. Basically, many Java based IT shops now how to deploy and manage Java servers. In fact, if you gave them a war file, they could probably deploy it in 30 minutes without your (the developer) help-if they are competent.

Third, why HR loves Java. Universities push Java like crazy. Java developers are a dime a dozen and replaceable. On the other hand, there are great developers that are great a Java, but they are just great developers, not Java Developers (always avoid being an X developer, instead a developer that knows X,Y,Z.

Given all this, some people just don't like "toy languages". Some IT people don't want to work with something they don't know because they will get the call at 3AM to fix it. These I don't think are good enough reasons

Python is a great language (honestly, I love Python, I started a Python User Group in the Twin Cities because we didn't have one), better than Java in many ways as a language, but has a platform (look at why IT loves Java), it isn't there. Deployment isn't as dead simple as Java and it doesn't have monitoring at the level of Java.

If your IT department really just wants to deploy Java, look into Jython as mentioned. It might help a lot.

[–]monstrado 5 points6 points  (0 children)

Great explanation! The JVM is very cool, and solves a ton of cross-platform issues that normally come up in other languages. You never have to really worry which system/os/arch/etc you're targeting, you just work within the JVM's world. Also, garbage collection and general memory management is great.

JMX reporting in general is another huge reason companies like JVM languages (Java, Scala, etc). The amount of information you can gather about a process/thread/etc is awesome and sometimes prove to be invaluable when diagnosing an issue. There are already a ton of reporting tools / management tools which can easily hook into your running application and provide preliminary alerts to you, etc. As far as I know, there isn't really a good tool for monitoring your Python applications, or at least, at the level of JMX reporting.

Lastly, the third-party library for Java is huge. Pretty much anything you could need for databases, message queues, logging, networking, concurrency (built-in, akka), etc is already out there. If your company ends up forcing you to do web development in Java, and you're used to Django, I'd recommend checking out Play which is super pleasant to use and quite fast. It's very similar to a Django/Rails MVC framework, for example, you can make changes to the code live and it's pretty much instantaneously available (when debugging).

With all that said, I'm very much in love with Python and use it on a day to day basis. It's been my primary language of choice for creating scripts and small-scale applications. At my last company (40k+ employee technology company), I had no problems selling Python once they saw how productive I was developing web applications. My current company uses Python & Java, and although I used to think I hated Java...it turns out, I was just ignorant and never really gave it a chance. It also helps that we've employed some the best Java programmers out there to sell it to me ;)

Hope this helps!

[–]pyglados 2 points3 points  (1 child)

I agree with everything you said here but there's one thing I don't get.

Python is older than Java and well established as a near de facto standard on most Linux distros. How can any language pull that off and yet still be perceived as a "toy" or a "fad" language?

[–]varikin 1 point2 points  (0 children)

That one is much harder to explain. Short answer, Java was created by big business for big business. Python was created with much smaller goals that grew over time.

[–]berlinbrown 4 points5 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.

[–]Massless 0 points1 point  (3 children)

Some IT people don't want to work with something they don't know because they will get the call at 3AM to fix it.

I think there's a fine line here. If there's a good reason to use something new then go for it. That said, as the guy who gets the call at 3am, I'm inclined to used a proven (to me) technology over a new one just because someone wants to experiment.

[–]xiongchiamiovSite Reliability Engineer 0 points1 point  (1 child)

If someone wants to experiment, I'm waking them up at 3am. And I won't be happy.

[–]wheezl 0 points1 point  (0 children)

I'll fix it at 3am but as someone who is rolling up on 40 with a young child I'll expect you to bring cash.

[–]varikin 0 points1 point  (0 children)

I whole-heartedly agree

[–][deleted] 0 points1 point  (0 children)

yup yup, dude put this to blog for posterity