3 ms·
>I once heard something that has stuck in my mind ever since: "servers are cheap, programmers are expensive." In other words, you have to carefully choose your
by quanticle 15y ago
>I once heard something that has stuck in my mind ever since: "servers are cheap, programmers are expensive." In other words, you have to carefully choose your battles: at what point is optimization worth a programmer's sanity? Java might not be the fastest language, but it will keep you slightly more sane than C/C++, and is usually worth the slight performance penalty.
But then, why Java? Why not a language that's even more high-level (like Python, Lua, or Haskell)?
- peteretep 15y agoThis isn't the first time I've seen someone with experience only of a lower level language get all aflutter when they first make a real attempt at using a higher level languages. At a contracting gig I had, one of the Java guys gave us a talk about Scala. And OH MY GOD SCALA HAS MAPS and OH MY GOD SCALA ALLOWS FUNCTIONAL ITERATION OVER LISTS. It was like his entire relationship to programming had changed, and he had to tell the world. I felt for the guy - he was clearly pretty excited about this - and it must have been like a breath of fresh air for him. The talk didn't go down that well though, as it was to the Perl team...
- gavanwoolery 15y agoHeheh...I have used a number of different languages, from high level, like Python, to very low level, like assembly, and everything in between -- and pretty much messed with every paradigm at one point or another. I will readily concede to not being an expert in any of them. Most of my game programming experience has been performance-focused though (in HLSL/DirectX/C++), but I have worked with high-level languages in other areas. I tend to see a lot of hobbyists fall into this performance trap, and I am only trying to point out the virtues of sacrificing a bit of performance. :) Java and Clojure may not be the best choices, but having tried many languages I am passing them out as a suggestion for consideration.
- gavanwoolery 15y agoI chose Java for a few reasons: 1) It is very well established and widely distributed. 2) It is old enough to have been battle-hardened, but new enough to contain some useful paradigms/features. It also has support for higher level languages like Clojure and Scala. 3) It is a good balance between performance and ease of use. 4) It has many libraries and resources. 5) While I am urging to give performance some slack, that does not mean to ignore it completely. Because Java is imperative, it gives programmers slightly better control of their algorithms. Most graphics programmers prefer to work low-level, at least in the core of their engine. Python and similar languages are often integrated into script engines, but rarely used for the core of an engine. I am suggesting Java because it allows programmers to work in at least a somewhat low-level style (the byte code is semi-predictable). 6) It is pretty easy to get started and learn (not necessarily easy to master though). I chose Clojure because it is Java-compatible, but Scala is probably just as good a choice.
- dkarl 15y agoYou can write pretty fast code in Java, so on the JVM you can use Java as your low-level language. With Python, if you want to write fast code (at least with CPython) you have to write a C extension, which requires a certain amount of effort and expertise. I personally don't know anything about Haskell, but I have heard that it has a very complicated performance model. I.e., it's hard to predict what will be fast and what will be slow, and if something is slow that seems like it ought to be fast, it can be hard to figure out how to fix it. (Since that was one of the major complaints of Haskell users the last time I seriously considered learning Haskell, it might be fixed or mitigated by now.) Scala can also be slow or unpredictable when using functional idioms, but with Scala you can always revert to Java-style programming to get Java-level performance. The fact that you can do that for a single function or even a single inner loop in a code file that is mostly nice clean functional code is very convenient. One thing I hated about Jython was rewriting entire classes in Java when only a little part was performance-sensitive. Or, equally frustrating, having a Jython class whose associated "little" classes (performance-sensitive callbacks such as renderers) were in a completely different place in the source tree because they were implemented in Java.