3 ms·
Java is an excellent language for writing the kinds of programs that were traditionally written in C but where the performance of Java is adequate (and as the p
by benreesman 18y ago
Java is an excellent language for writing the kinds of programs that were traditionally written in C but where the performance of Java is adequate (and as the performance of well-written Java programs seems to be asymptotically approaching the performance of well-written C programs this set is larger all the time). In fact, treating Java as a garbage-collected C is often a very reasonable thing to do.
People who bitch about how 'Java is dead' are referring (whether they know it or not) to the practice of attempting to write change-prone business logic and other glue in it. This practice was always a bad idea, something that even Sun now seems willing to admit. If the Rails/Django discussion is at the center of someone's programming universe then it is likely that to him or her that this is the only kind of code in the world, and thus Java is of no consequence to those sorts of people.
However, if your project is ambitious enough you'll find that you will need both glue and infrastructure, in which case having a language like Java underneath your dynamic language (people who use JRuby for example, or like me, Rhino) will be a godsend when you need performance or the occasional static-typing guarantee.
If you'll allow me to make the obligatory pg/Viaweb reference then I'll point out that Viaweb contained non-trivial amounts of both C and Perl, in spite of the obvious advantages of using Common Lisp for the store editor proper.
- henning 18y agoI find it disappointing that you feel dynamic typing is incompatible with performance. Now's the time to rediscover optional static type annotations used for optimizing compilation. Radically innovative!
- benreesman 18y agoAddressing someone like a tardy child (I'm not mad, just disappointed) is a reliable way to inflame the discussion. I don't think I will respond if you phrase any further replies like that. The claim that "dynamic typing is incompatible with performance" is considerably stronger than what I said (and I would contend belies an imprecise if not misguided notion of "dynamic typing"). That being said, for people interested in using a mainstream platform to develop their applications, the JVM offers a number of extremely productive "dynamic" languages none of which perform as well as Java across a broad spectrum of activities. I think you will find it telling that the engineers at Facebook (who are world-class) chose to implement this system in Java. Optional type annotations are a wonderful idea and I am optimistic that someday the tradeoffs we mark around performance and convenience can be granular and addressable at a lexical level in a single file. Until then, the mix of a JVM scripting language and code written in native Java calling each other trivially is pretty damn close. Now I invite you to write a similar system using SBCL, if you enjoy debugging inexplicable concurrency failures. Or maybe you'll use Actionscript 3? I hear it has optional type annotations. Now if you'll excuse me, I need to go work for the Man on dreary accounting software. Fail.
- silentbicycle 18y agoAn excellent point. Far more useful to focus on knowing something's strengths and when it is relevant than dismiss it entirely.
- rbanffy 18y ago"In fact, treating Java as a garbage-collected C is often a very reasonable thing to do." That's exactly what I like about Objective-C. It _IS_ C with garbage collection. And with a little bit of Smalltalk thrown in.