1. Wow, this program runs on any platform!
2. Wow, no need to free memory!
3. Wow, threads and locks are so easy to do!
Then many years later
4. Who really cares about cross-platform code if all I do is on Linux?
5. Why does this program require 4GB of ram?
6. Must I really download and install the JVM all the time, and what is it good for anyway?
Go:
1. Wow, I can write stuff that previously could only be done in C/C++, and I can do it almost as easily as writing Python or Ruby.
2. Wow, I don't need anything installed for my program to run, it just runs!
Deployment happens mostly on Linux, but development happens mostly on OS X and Windows. Having guaranteed behavior, compiling it only once, being able to deploy as a simple JAR file, the same JAR file that you tested locally, is awesome.
> 5. Why does this program require 4GB of ram?
Java is actually very memory efficient, all things considering. There are Ruby developers choosing JRuby for deployment because of that efficiency. By the time Go's GC will reach the same maturity, it will behave similarly.
> 6. Must I really download and install the JVM all the time, and what is it good for anyway?
The JVM ensures consistent behavior across all platforms and is able to do optimizations based on runtime profiling, with JVM bytecode acting as a very efficient ABI, making the JVM an efficient target for multiple languages, including Scala, Clojure, Groovy, Ruby, Kotlin, Ceylon and others, languages that have been able to bootstrap easily and have a huge ecosystem at disposal because of the JVM.
> 1. Wow, I can write stuff that previously could only be done in C/C++, and I can do it almost as easily as writing Python or Ruby.
Go is not a replacement for C/C++ because it has a GC. In fact it's impossible to use Go for the same use-cases where C/C++ is required. And if you can use Go, then you can use Java as well. And in fact, because Java is more mature and has alternatives like Azul's pauseless GC, it's more amenable for projects with soft real-time constraints.
> 2. Wow, I don't need anything installed for my program to run, it just runs!
That's cool sometimes, but Java is almost as ubiquitous as POSIX and HTML5. On Linux it's basically one "apt-get install" away, just like everything else. So the advantage of not requiring a runtime for me is, you know, meh.
> Java is actually very memory efficient, all things considering.
Huh? Considering what? Compared to what?
> There are Ruby developers choosing JRuby for deployment because of that efficiency.
Yeah, Java !=JVM, and Ruby is not Go so this is kind of moot.
>By the time Go's GC will reach the same maturity, it will behave similarly.
Says who? You can't just state that as a fact without backing it up somehow.
That makes me wonder about your universe of things to consider. Java's terrible memory usage was set in stone the moment they decided not to include structured value types.
An example would be how the IBM J9 JIT converts a final Point class, just with getters and setters into a value type.
Also there are language extensions from JVMs like IBM Packed Objects or Azul Object layouts that are exploring how to involve the language into value types.
It sucks that they didn't follow the route of Mesa, Modula-3, Eiffel and Oberon in regards to value types, but they aren't holding still.
But then you also need data structures that can be parameterized to store such value objects as values. Otherwise you're back to square one.
https://en.wikipedia.org/wiki/Project_Valhalla_(Java_languag...
The Java language is definitely not set in stone.
If (and that's a big if) they introduce value types in 2018, it will have been almost 25 years since that fateful decision that has done so much damage.
Go owners have millions and millions of lines of existing Java code and they employ many people whose entire careers were made on top of Java.
I'm not saying there are no rational reasons to prefer Java over Go. But Google is hardly the yardstick for that.
I don't think concurrent programming was ever particularly easy in Java. If you're talking about `synchronized` methods, well, they are of limited usefulness (to put it mildly) when you need to lock objects in an interleaved fashion: "lock A, lock B, unlock A, lock C, unlock B, lock D, unlock C, etc.", which isn't too uncommon a user case.
> stuff that previously could only be done in C/C++ (...) almost as easily as writing Python or Ruby
Metaprogramming, any? C++ has templates. Python and Ruby have metaclasses. What does Go have?
Go generate AKA C Macros but even worse since there is no macro syntax , you have to code you own code generator yourself .
The last example is nsq[1]: Download, unzip and run the binaries .. aahh :)
Obviously this can be true for non-golang programs as well, but I can't think of any right now.
The biggest issue with Java IMHO , 6 not so much since deployment is automated.
> 1. Wow, I can write stuff that previously could only be done in C/C++
Not true, like at all. Every Go does can be done with Java.
Most developers write their code on Windows and MacOS and then deploy on Linux. I'd say this "Write once run anywhere" thing was and still is a pretty big deal.
> 5. Why does this program require 4GB of ram?
Oh no! I need to buy a $5 piece of hardware to run this Java code? What kind of nonsense is that?
> 6. Must I really download and install the JVM all the time, and what is it good for anyway?
Once or twice a year, if you really want to. You update your browser much more often.
4 GB per program absolutely destroys VM consolidation. I love the look on managers' faces when they ask for a 1 GB VM and I ask them, "Is this for a Java program?" :)
On other hand, on truly constrained embedded systems where real time is essential, no GC-based language has any business, no matter how GC is good. Even C++ is sometimes avoided.
http://www.pr.com/press-release/136232
Or do you prefer Aegis battleship Weapons System ?
http://dl.acm.org/citation.cfm?id=2402699
These are my favorite examples for Java being used in life critical situations.
> The applications use a combination of Thales proprietary middleware written in C combined with Java code enabled by the Java™ Native Interface (JNI).
> AONIX has additionally delivered professional services to help PERC Ultra users at Thales optimize their applications and improve execution performance including, a customer-specific training course handled the needs of coding in Java™ with hard real time constraints.
Seems like with helping of C and Consulting on 'How to do Java right' they made it work.
> End-to-end distributed thread timing constraints measured from stimulus to response are typically under 100 ms.
Since it is slightly faster than typical (per char) typing speed on keyboard. It appears nice but terribly impressive real time Java use case.
Not Java, not even close. JavaCard is an extremely stripped-down version of Java. I've used it and it feels like C.
From https://en.wikipedia.org/wiki/Java_Card#Java_Card_vs._Java:
> However, many Java language features are not supported by Java Card (in particular types char, double, float and long; the transient qualifier; enums; arrays of more than one dimension; finalization; object cloning; threads). Further, some common features of Java are not provided at runtime by many actual smart cards (in particular type int, which is the default type of a Java expression; and garbage collection of objects).
[EDIT] But I am not arguing with the overarching argument that Java proper can run efficiently on very constrained devices. It all depends on the implementation.
.. and then someone gets the idea that your application should now run natively on Android phones, since they all run Java anyway, right?
What's your point?
There are hundreds of millions of phones running Java today, what does that tell you?
It's not if you meet one of these typical "don't do any premature optimisations (even in the design phase of my data structures), because some important CS person said so"-designs. There's all too many programmers who think they should never have to care about hardware anymore.
I really hope you actually mean 7+ times a year. https://en.wikipedia.org/wiki/Java_version_history#Java_8_up... - most versions contained security updates.
What I'm saying is - you should care 7+ times a year. Doesn't matter if you only update twice.
Funny. That's Microsoft line of thought with Vista.
And, of course, it spawned a completely useless thread litigating Java vs. Go. Perhaps that's why it's at the top of the thread --- which means voting had a perverse effect for this topic.
I don't know what to do about this tendency in language threads on HN, but it's a real problem.
Go still keeps it lean, and is great.
The fact it does not have hipster dev approved status is also an added bonus. The minute we see a bloated testing suite with yet another DSL, for Go, we are in trouble.
What are you talking about ? the hype is strong with Go. So strong devs are persuaded they need to use Go at all cost then complain Go has a garbage collector ( just go go-nuts mailing list).
So strong there are countless articles on the net about "How we moved from X to Go..." just like in 2007/8 with Rails.
> The minute we see a bloated testing suite with yet another DSL, for Go, we are in trouble.
GoConvey and co ...
Writing about Go is a great way to hit the front page of HN. I once saw 5 articles about Go on the HN front page at the same time!
Plus GoConvey wisely separated the UI visualizer from the BDD, we use the former and not the latter.
Uncanny, isn't it?
Huh? In my experience Go is the most hipster dev language around at the moment.
If you're looking for C-like though, you are probably not in any modern-featured language designer's aim.
It was implied by the context of "ML" languages. That was my intention at least; I thought ML languages were characteristically safe.
Regarding "C-like", I mostly mean syntax. I'm not too familiar with the ML family, but many FP languages have bizarre syntax which amplifies the difficulty of learning new concepts IMO.
Because you are. You likely wrote widly unsafe things which are perfectly legal in C++. Rust is really just enforcing RAII which C++14 already has, and you've likely avoided.
Yes go also claims to be C replacement, but probably the only similarity is its simplicity, but unlike C it is not as expressive.
Rust was aiming at innovating and advancing the PL space with meaning. I can't say looking back the time I invested with Go was well-spent.
Rust is probably worth the effort if you have the need for what it offers. It just requires more out of you than Go does.
Once IDEs start coming around it should be quite competitive. I'll admit to thinking the same thing: I'll use Rust for the absolute critical parts, then F# for the rest. But more and more parts I'm writing are easy enough to do in Rust, and I get the perf as a bonus.
So far, looking like a solid decision.
https://www.techempower.com/benchmarks/#section=data-r12&hw=...
https://www.techempower.com/benchmarks/#section=data-r12&hw=...
In both Phoenix has very high error rates, and in the first it seems really slow. Here is their Phoenix test app:
https://github.com/TechEmpower/FrameworkBenchmarks/tree/mast...
So what is going on there? Is it less of a perf win than I've heard? Is there something bad with their code?
Edit: Here.
1. Holy crap, this is like coding in early Java days, what the heck were the language designers smoking?! They just ignored everything! Where's my testing framework! DI?! Build system, dependency management?! WTF.
2. Holy crap, this is like coding in the early Java days! This is awesome! I can understand all golang code I read! Everything is so simple and easy. I finally get "less is more", and "worse is better"!
3. (Many months later) Oh god, I'm getting so sick of writing this test assertion in 4 lines over and over, and writing 100s of lines of mock structs. My tests are 5% substance and 95% setup. Okay let's write a junit/mockito assertion library. Oh crap, I'm having to manually wire everything everywhere and it's such a pain. Let's write a DI library. Ugh my project is getting too big and `go get` just doesn't cut it - time to use a dependency management library. Ugh, makefiles only go so far, time to write a build tool. Ugh code generation and metacoding is nonexistent, let's write our own code generation tool so we don't have to hand build 100s of types. ETC.
4. (Distant future) As golang's stubborn designers finally accept some flaws in their original thinking, they add features to make the language look a lot like another widely used language at the Googplex. Mission accomplished?
P.S. This is somewhat tongue in cheek - I do enjoy using golang day to day. It is a refreshing change :).