Live data from Hacker News

Ask HN: Why not Java?

news.ycombinator.com

31–40 of 112 posts

Re: Ask HN: Why not Java?

#31
I am puzzled at how arrays are hard to use in Python? I cannot understand how you could be 'banging your head' against Python's array syntax unless you are just new to Python.

If you want to use Java (e.g.: you know it already and don't like learning other things), who cares? Why is this an issue where you have to challenge other people's opinions of Java? Use it if you want to.

Re: Ask HN: Why not Java?

#32
post #2

You can always do the speed-critical parts in C and link that from your Python code. Or, if your analysis is something already done, use a library already written in C (such as NumPy). Another approach could be Jython (or any other JVM language closer to the desired level of abstraction) and Java. I don't have much love for Java the language. It's not much easier to program than with C, isn't faster and is very verbo…

I noticed a lot of criticism of Java's verbosity in the comments and I'm a bit curious what people are referring to? I work primarily in Java, but also do quite a bit of Javascript and Perl, and I don't notice Java being especially verbose. Maybe internally I'm giving it a break because it isn't a scripting language? I'm honestly curious to see what you guys think.

Re: Ask HN: Why not Java?

#33
post #20

I am curious about what, specifically, you find easier to do in Java syntax than Python syntax. Seriously, there is a fairly direct translation from any Java you might want to write to completely equivalent Python. Sure, Python offers more complex techniques such as list comprehensions and iterators. But you don't need to use them. You can just write Java-like Python.

And, the OP says he wants to move away from Python to a C-like language for better arrays? It's a weird reason given that arrays are not that complex a data structure, plus the option of using numpy arrays, which are quite fast and capable.

Re: Ask HN: Why not Java?

#34
post #20

I am curious about what, specifically, you find easier to do in Java syntax than Python syntax. Seriously, there is a fairly direct translation from any Java you might want to write to completely equivalent Python. Sure, Python offers more complex techniques such as list comprehensions and iterators. But you don't need to use them. You can just write Java-like Python.

Interfaces.

Re: Ask HN: Why not Java?

#35
post #32
post #2

You can always do the speed-critical parts in C and link that from your Python code. Or, if your analysis is something already done, use a library already written in C (such as NumPy). Another approach could be Jython (or any other JVM language closer to the desired level of abstraction) and Java. I don't have much love for Java the language. It's not much easier to program than with C, isn't faster and is very verbo…

I noticed a lot of criticism of Java's verbosity in the comments and I'm a bit curious what people are referring to? I work primarily in Java, but also do quite a bit of Javascript and Perl, and I don't notice Java being especially verbose. Maybe internally I'm giving it a break because it isn't a scripting language? I'm honestly curious to see what you guys think.

Curious enough in fact, to do some research. I found an interesting article: http://www.informit.com/articles/article.aspx?p=1824790

I also forgot about file i/o, which I don't do much of in web applications.

Re: Ask HN: Why not Java?

#37
I've written two crawlers in Java and found it quite well-suited.

I think most people on HN who hate Java are talking about creating websites, and for good reason. Back in the bad ol' days, people would use Java frameworks like Struts for web apps, and it was quite painful.

For my latest project I'm using Play Framework for front-end Java, and it's quite delightful.

Re: Ask HN: Why not Java?

#38
post #3

It's perfectly fine to use Java for this kind of software. The hate against Java comes from using Java for application development: this is largely due to the kinds of applications that are typically written in Java (line of business software) and (this is the most important reason) accidental complexity and low quality of APIs like Spring or J2EE. Recipe for programming happyness is to use the right tool for the job…

This post reflects the conventional wisdom very accurately. It is informative and contains good advice.

However, I also think it is a biased caricature based on "common sense" that isn't all that well founded.

Most of these languages are entirely usable in areas far outside the prescribed areas you have given for them.

If you are working on a few domains like embedded or OS stuff, low-level graphics or signal processing - or you need to interact with a specific system that is pretty language-specific like Rails or iOS - then your options narrow a lot. A few tasks are just a little forced unless your level of comfort is very high (doing 1-minute shell script jobs in C++, for example).

But it would be very hard to overstate the degree of overlap, in 2012. It no longer usually makes sense to write things in ASM for speed, for example...

In the rare situations where your favorite higher-level language is somehow not good enough for a given project, it is rare that you cannot make a mongrel project which drops to another level just where necessary. If your language does not support this then it is broken in a generally important way.

If you are not really ready or willing to fill in gaps and just want to glue existing things together, that changes things slightly - then your primary consideration is not the language but the available libraries.

The major differences between languages are mostly matters of custom and ideology rather than niche suitability.

Re: Ask HN: Why not Java?

#39
In my experience many Java programmers don't really "program" Java. They are more like "expert Eclipse users" and Eclipse happens to output Java. This style of development makes heavy use of wizards and those Eclipse refactoring tools.

This probably is a consequence of the verbosity of Java-the-language, which made heavy tooling support a necessity. And then Eclipse, which provides one of the tightest language integration with Java of any IDE ever.

The sad thing is that this is not really the fault of Java-the-language or Eclipse. It did spawn a whole caste of very mediocre programmers and libraries though, which can make for a very unpleasant culture.

Used correctly, Java can be a great tool, though.

Re: Ask HN: Why not Java?

#40
post #20

I am curious about what, specifically, you find easier to do in Java syntax than Python syntax. Seriously, there is a fairly direct translation from any Java you might want to write to completely equivalent Python. Sure, Python offers more complex techniques such as list comprehensions and iterators. But you don't need to use them. You can just write Java-like Python.

Interfaces.

That is a noun. What is the actual use case?
Post reply on HN