Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A lot of people love to hate on Java, but it's a surprisingly dynamic language and there is a ton of great testing, networking, and many other libraries available.

One of the things I appreciate about Java is the ability to take large teams and just have their stuff work together, without having unhuman discipline around super subtle rules (eg: C++)

Also, IntelliJ is a must have!



In what way is Java a "dynamic language" ?


Contrary to popular belief Java is highly dynamic. You can introspect the fields, methods, interfaces of any object at runtime, inject new / redefine classes, methods, fields, etc. The problem is that it's very awkward and unwieldy to do so. Hence the tendency to build new JVM languages rather than attempt to use Java's dynamic features directly.


I think "dynamic platform" would be more accurate. Java has typically been a fairly conservative language sat on a much more interesting VM, a VM which has rather more features in common with dynamic languages like Smalltalk than you'd expect.


but you can always escape with cglib and rock out.

So even though java the language isnt dynamic, you can do a lot more at runtime, than with these new-fangled languages like Go and Rust.


"Dynamic language" != "Dynamically typed language".


Java has a lot of runtime knowledge about itself, it can do a lot with that.

As a result, you see things in Java that are more typical of dynamic languages, rather than C++ for example.


I think he meant dynamic as in ability to adapt rather than a dynamic language like python


> super subtle rules (eg: C++)

C++11/14 is in practice not that much more difficult to write well than Java. It's not 1998 anymore.

The language is larger and more complex than Java, but it's also a lot more expressive and powerful, not to mention faster.


Exactly. I'd argue C++ has a lot going for it, and I think the claim that Java's performance is only slightly slower is simply not true for the vast majority of situations where good memory organization can provide significant speedups - which includes any computer graphics, vision or audio application.

I personally find C++11 more high-level than Java and significantly more optimizable for performance.

You can wax poetic about "developer time is more important than processor time" all you like, but when your application runs like a turtle on anything short of server-class hardware, it doesn't mean much.

Performance will always be of primary importance for a large class of applications. For the rest, Java is a good alternative.


Java is fast enough now to compete with C++ in some categories of software traditionally viewed as "high performance" e.g. web-servers or database systems. Applications running like "turtle on anything short of server-class hardware" is a result of bad-coding, not Java itself.


In some categories, yes.

In many others, especially those requiring vector or matrix arithmetic (medical imaging, physical simulations, modeling, graphics, scientific computing, video games), there's simply no competition.


Not sure of that. Some scientists from CERN would certainly disagree... Pure array-based arithmetic in Java is pretty damn fast, especially if you care to avoid dynamic allocations. It can be also very memory/cache friendly.


I was under the impression CERN was a C++ shop, have they switched over to Java?


They do have quite a few projects in Java and they published some of their Java scientific libraries as open source. See Colt project. Also the software processing data from LHC is at least partially Java based.


In anything where Java approximates the speed of C++ it uses two or three times as much RAM.


10 millions element array of doubles/ints/bytes takes almost exactly same amount of bytes in Java as in C++. Java can blow your memory if you do stupid things like wrapping every point 2D into a separate object, but you know, good Java programmers know this. Other than that, its memory usage is quite reasonable, including some room for GC (typically 20-30% of total is enough).


Having spent 5 years doing production C++, I don't believe you basically.

All that shit that sucked in 2005 about C++ is still in there. It's just up to your discipline to not use it.

Do you trust your coworkers enough?


Yes. Basically, don't hire incompetent people and do code reviews. Both rules apply independent of the language, of course.

Source: have spent 5 years doing production C++


You still have to read Effective C++ to avoid shooting yourself in the foot, but after that C++ isn't much more difficult than Java or C#. The compile times remain annoying, though.


> C++11/14 is in practice not that much more difficult to write well than Java. It's not 1998 anymore.

While I agree with you and C++ belongs to my favorite languages, the truth is that most corporations still use C++98/C++03 and they aren't going to improve their compilers any time soon.

On our Java projects we still get requests for Java 1.4.

The enterprise is a very slow moving snail.


Its having the knowledge of what subset of features do you stick too, because C++ is quite large feature rich language. There are often many ways of doings things.


One of the reasons I love programming in Python so much is the focus on idiomatic code and 'one obvious way to do something' means that unfamiliar codebases or APIs are easier to read, and patterns for common tasks are seen again and again.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: