In many cases, C# or Java are great choices for a project, but Rust fits in quite often too.
I'm extremely productive in Rust vs other languages, especially for young projects where I spend a lot of time refactoring. Things like borrow checker errors just don't happen very often to me anymore, or they catch legitimate bugs and are generally quite easy to fix. I just don't run into them very often at this point.
I've written Python and Java professionally. In both cases I felt like I just couldn't express what I wanted to, at all times, in my program. This led to me being a lot less comfortable refactoring - relying on tests that were far too heavily tied to implementation details.
I had some really complex logic I needed to write for one of my services. Basically I needed to represent a 'thing' and that 'thing' could be in a few different states. I wrote out the code, types first, so that every state had a type. I was able to do this generically using Rust's associated types in a way that allowed me to implement the state machine for multiple 'things'. It was very testable, very readable code that I had high confidence in. I would have had a much harder time doing this in Java/ Python (I have done similar things, and you can get value from the approach, but not the same level). I've refactored that code a lot with confidence.
Speed is a nice bonus, but mostly secondary.
I was playing around with trying to do this a while back (while also trying to learn Rust some), and it felt very cumbersome to have to write many specific Diesel update methods to handle different types of requests. It could have been my now knowing a better way to accomplish it, or it could have been the type of queries I was trying to model aren't a good fit for a staticly typed system like that (and there may be a better way to architect it). In any case, it felt like I was poorly approximating the strict typing I had already implemented in Postgres, a few times over, when I would be happy just handing it to Postgres and letting it throw out errors as needed.
As for redis, I use it as a dumb KV store, no need for an abstraction layer.
But love it, and love the team at Dgraph/Badger.
Isn't that a contradiction?
I would be refactoring in any language - the idea behind the service, the requirements, etc, are changing a lot as I'm building these services out. These are external factors that would exist regardless of the language, as I continue to explore the problem space.
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.
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.
Note that the number of packages is not a great indicator of the quality of implementation.
Citation? Last time I looked at LuaJIT it still beat V8 by a healthy margin.
* 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.
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