News for hackers. Stuff that matters.
Re:Systems Languages: An Experience Report by k__ on Friday July 06, 2018 @02:36PM (#17474006)
I don't understand why anyone would go for C# or Java.

If you want GC and/or fast dev speed, go for JavaScript. If you really need static typing, go for TypeScript. JS has one of the fastest VMs on the planet and virtually everywhere.

If you need speed and don't want to mess around with decades of C/C++ legacy quirks, go for Rust.

Re:Systems Languages: An Experience Report by vvanders on Friday July 06, 2018 @02:44PM (#17474083)
> JS has one of the fastest VMs on the planet and virtually everywhere.

Citation? Last time I looked at LuaJIT it still beat V8 by a healthy margin.

Re:Systems Languages: An Experience Report by jcranmer on Friday July 06, 2018 @02:37PM (#17474025)
> I don't understand why anyone would go for C# or Java.

Library support immediately comes to mind. If I need an implementation of, say, the Kerberos protocol, I'm more likely to find a binding in Java than in JS.

Re:Systems Languages: An Experience Report by steveklabnik on Friday July 06, 2018 @02:39PM (#17474042)
https://www.npmjs.com/search?q=kerberos shows 26 packages. The huge ecosystem is one of the big selling points of JS!
Re:Systems Languages: An Experience Report by sbjs on Friday July 06, 2018 @02:41PM (#17474056)
I feel like it's a mixed bag. For every 10 packages, maybe 8 are half-baked and strapped on in a hurry with no care. That said, those other 2 are usually amazing. Java has an edge there, because there's a lot more fully supported, corporate backed, high quality packages for Java.
Re:Systems Languages: An Experience Report by jcranmer on Friday July 06, 2018 @04:01PM (#17474641)
I recall a few years ago when some people were talking about porting an application to nodejs. The idea was dropped when it was found that there was no LDAP library that supported Kerberos SASL authentication, which was an absolute requirement for the application. (A quick look suggests that there still lacks an implementation of this).

Note that the number of packages is not a great indicator of the quality of implementation.

Re:Systems Languages: An Experience Report by sbjs on Friday July 06, 2018 @02:37PM (#17474024)
I'm with you, I love TypeScript! It's my favorite language of all time! But people using Java and C# are usually tied to a platform and SDK that TypeScript can't easily interoperate with. But I guess if you can replace your whole app with an Electron version, go with TypeScript all the way!!
Re:Systems Languages: An Experience Report by jcrites on Friday July 06, 2018 @03:02PM (#17474214)
Java and the JVM are a fantastic platform to develop on. The development experience is great and the performance is excellent.

* Java code means what it says and is simple to reason about.

* Top-notch IDEs like Eclipse and IntelliJ IDEA. Great debugging and diagnostic support, both at development-time and in production (e.g., logging and instrumentation frameworks, crash reporting).

* Java is meaningfully cross-platform, though in practice this is mostly useful for portable development (as opposed to portable production deployment). I can develop my services on Windows or Mac, then deploy to Linux in production, with zero fuss. (Don't even need a container)

* Feature-rich standard library. Powerful concurrency primitives and data structures, async, and futures libraries built right into the Java runtime (java.util.concurrent). You can dip into frameworks like Akka for more sophisticated use-cases.

* Huge open source community that's working on projects like Apache Hadoop, Hive, Spark, Avro, Cassandra, etc. Take a look at how many Apache Java projects there are, for example: https://projects.apache.org/projects.html?language#Java . Top-notch DI frameworks like Netty, Guice, Dagger, Spring. Top-notch REST and RPC programming frameworks like gRPC, Thrift, Cap'n Proto, JAX-RS/Jersey.

* Java code is extremely reliable. Java code cannot crash in complex ways. Try/catch covers the vast majority of concerns for practical error handling and recovery. Java code's consistent use of GC, exceptions, and treatment of sync/async means that all libraries are modular and can be meaningfully and safely composed with each other. For comparison see What Color Is Your Function: http://journal.stuffwithstuff.com/2015/02/01/what-color-is-y...

* Multiple languages that can interoperate: Java, Groovy, Scala, Kotlin, Clojure. The GraalVM and GraalJIT show amazing potential: https://www.graalvm.org/

* Because Java is so widely used, many tools and client libraries and such support Java before other platforms.

* A large population of developers understand Java and will be productive immediately on the project (vs. obscure languages).

* Modern, concise syntax that supports anonymous classes and functions, Lambdas, streams, Optionals. Java continues to improve over time and pick up concepts from other languages.

    List<ProductDisplayInfo> getDisplayList(List<Product> products) {
		return products.stream()
			.filter(p -> p.getCategory() == 2 
                                || p.getCategory() == 5 && isProductUnderDiscount(p))
			.map(ProductDisplayInfo::new)
			.collect(Collectors.toList());
	}
* Java has good support for generic programming, unlike some other modern languages (e.g. Go). Generic programming is efficient and doesn't typically have downsides that make people afraid to use it (like in e.g. C++).

* The JVM is a very high performance implementation that can rival native programs on important benchmarks for many server use-cases. I've built a lot of software and have rarely, if ever, run into performance reasons to use a different language. (Usually a small native library with JNI bindings meets the need when that's the case.) Other platforms rarely achieve a fraction of the JVM's performance in server-side use-cases. See benchmarking results from a previous comment I wrote on this topic (internal citations removed):

> Folks might also be interested in the TechEmpower web framework benchmark. The top Java entry ("rapidoid") is #2 on the benchmark and achieves 99.9% of the performance of the #1 entry (ulib in C++). These frameworks both achieve about 6.9 million requests per second. The top Java Netty server (widely deployed async/NIO server) is about 50% of that, while the Java Jetty server, which is regular synchronous socket code, clocks in at 10% of the best or 710,000 R/s.

> NodeJS manages 320,000 R/s which is 4.6% of the best. In other words, performance-focused async Java achieves 20x, regular asynchronous Java achieves 10x, and boring old synchronous Jetty is still 2x better than NodeJS throughput.

https://news.ycombinator.com/item?id=14153879

* I'm personally a fan of Rust and appreciate its concepts, but garbage collection suffices and is easier to work with for the majority of use-cases I encounter. C# and .NET also have many of the properties above, though not the large open source community.

People who are starting businesses and have a practical, get-the-job-done attitude would be wise to consider Java. It's versatile enough to do almost anything on the server-side.

Re:Systems Languages: An Experience Report by kenhwang on Friday July 06, 2018 @03:52PM (#17474586)
The biggest drawback of the JVM is the resource use, warmup time, and unpredictable GC latency. The JVM certainly is freakishly fast once it gets going, but it's not always cost efficient for it's performance.
Re:Systems Languages: An Experience Report by StreamBright on Friday July 06, 2018 @03:26PM (#17474372)
Rapidoid <3

These are exactly the reasons why JVM is the primary platform for us and Clojure/Java are the primary languages to use. If you compare languages by performance, library availability and developer popularity it is extremely hard to beat Java/JVM

Re:Systems Languages: An Experience Report by sbjs on Friday July 06, 2018 @03:50PM (#17474571)
Why Clojure? It's slow and not type-safe. If you want something a little more dynamic than Java but without losing speed, did you check out Kotlin?
Re:Systems Languages: An Experience Report by StreamBright on Thursday July 12, 2018 @10:22AM (#17514882)
Slow??? Are you kidding?