I love both Java and Rust, this is a great write up! I've been writing C++ recently and when I run into unexpected undefined behavior during run time I very much miss Rust and Java as neither would have happened in either. I'm just not as good at C++ as I am at the other two so that explains it. It does feel freeing in C++ to not have to worry about borrow checking, but I know it will get me into trouble I would have avoided with Rust. I can see the use case for both. Sometimes you just want some code without worrying about doing it perfectly, and sometimes you want to build a nice big application where things are fine tuned and as bug free as possible and in that case I'll probably want to choose Rust.
Nothing in my mind though really beats the ecosystem around Java of these three in terms of IDE support, tooling and just simplicity in getting code out fast when you don't need low level access to things. Netty really brings great things to Java, and the many mature web frameworks for JVM languages are probably better than anything available for Rust right now. I'm not sure a sane person would write backend for a web site in C++. :P
Anyway I love both Rust and Java 8 and it's great to see them thriving.
Speaking of tooling, correct me if I'm wrong but one thing I miss when working on Java (I've not worked much on Java) is intuitive and build/package manager. Java build tools seems to be painful to use outside IDE. Cargo on other hand, I can get started working in minute.
I have found the opposite to be true in my experience. IDE's have some level of trouble with most popular Java build tools (Maven and Gradle), while they are quite capable command line tools, and they themselves know how to work well with the IDE's (They each have plugins to create the 'meta' files for the most popular IDE's)
What issues have you had with which build tool when using it outside the IDE?
IDEA's Maven and Gradle support is pretty good. I haven't had to use any Maven plugins to generate project files for an IDE since IDEA 7. But yeah, mvn and gradle are the definitive, the IDE support is a nice to have.
IDEA's native Gradle support is excellent. I haven't had to use Gradle's IntelliJ plugin (the Gradle bit that generates the IDE files) for at least two years now. All I have to do is (on Mac OS X):
open -a /Applications/IntelliJ\ IDEA\ 15\ CE.app build.gradle
At work, we have a Gradle project with 346 submodules. We have about 200 engineers working on the codebase. Gradle/IDEA combination works well beautifully.
There are a few rough edges, especially when one uses custom source sets. IDEA 16 is going to get better support for that [1].
> IDE's have some level of trouble with most popular Java build tools (Maven and Gradle)
Can't speak for gradle but Netbeans has worked excellent with Maven for years.
Idea seems to work nicely as well (I haven't used it much for the last few years but my coworker across the table seems to like it with Maven as well.)
As for eclipse I haven't used it regularly since 2012 so I don't know.
Same here. Maven works great from the CLI, and Eclipse works great as a dumb-ish consumer of the dependencies and Maven reactor stuff in which to write code. But I don't use Eclipse for real build / test / package tasks, nor is the IDE a very nice place in which to configure the project skeleton.
Package management with Cargo is one reason that the Rust ecosystem will evolve very rapidly. It reduces a lot of friction and makes it easy to test out new libraries and approaches. This will pay off in the long run as the community starts to fill in the gaps.
Another underrated part of the Rust ecosystem is their RFC process, the multiple development streams and the six week dot-release iterations.
Maven is the best build tool I've used, with any language. You have to really embrace its declarative, convention-over-configuration style, but once you do it's wonderful: just declare the projectId, groupId and version, and any dependencies, and there, you're done.
Maven allows interactive development too when using the IDE integration. An IDE is in a better position to have that kind of information and integrate it well (e.g. an IDE can run tests on save without having to watch the filesystem for changes).
SBT is not adequately documented, relies too much on symbol-heavy syntax, and allows arbitrary code in build definitions.
XML uses three symbols: <, >, and /. And it's a well-known, documented standard. Looking at the last project I depended on, its build.sbt uses :=, %, %%, /, <+=, <<= (in addition to standard Scala symbols like +=, ++=, ++, =>, <=, >=, which an inexperienced developer wouldn't necessarily realise weren't part of SBT's own syntax). That's not an exhaustive list (I've used :+= and :++= as examples in another thread) and I have no idea where to find one. Heck, I've been a professional Scala developer for 5 years and I have literally no idea what <+= or <<= mean.
And there is an oft-documented overuse of custom operators among Scala programmers, however I don't have sufficient expertise to gauge the resulting problems in practice.
Gradle is the best general purpose build system I've seen, a bit of initial overhead but as soon as you need something more than basics you're very glad it's done the way it is. Not without flaws but better than other "API" build systems I've used (WAF, CMake)
What Gradle advocates present on their sessions about leaving a running daemon, configuring the JVM memory, changing the way the build is done and so on....
I like Gradle too, although I very much recommend having a look at QBS (Qt Build Suite, although unlike Qmake it's not really bound to Qt and can be used for general build scripting). I've used it about a year ago and was really amazed to see what was probably the first sane build tool I've used for years. Of course Gradle is rooted in (yet not limited to) the JVM ecosystem and QBS started as a C++ build tool, so they are not really equivalent, but comparing the ease of use, predictability and the overall impression, QBS beats Gradle by a full grade in my opinion.
You do know Gradle uses Groovy as the syntax for its build files, right? The people behind Groovy had a problem a year ago where they were retrenched from their jobs working on Groovy, and haven't found any businesses since then who'll pay them to continue improving Groovy. Gradle doesn't mention Groovy much on its gradle.org website, perhaps out of embarrassment.
I didn't have terribly many issues with Gradle and consider it pretty good. What about it do you consider awful and how does Cargo solve those issues? What features does Gradle lack that stick out to you in Cargo?
Have you considered D? It's pretty much supposed to be a successor to C++ and has GC (can be turned off) and is compiled as well. I feel like I'm writing compiled Java when I code in D if that gives you a nicer perspective of D.
AFAIK, turning off GC in D is not feasible whenever using large portions of the standard library, but there were efforts underway to change that. Do you know if there's been much progress?
Lots of progress, but there's still work to do. If the GC is unacceptable for your application, slap `@nogc` on your `main` function and you're guaranteed to not use it.
I'm writing OpenGL code. I know lots of languages claim support for OpenGL, but in my opinion dealing with gpu stuff is something best written in C or C++. All the guides, all the answers to questions, all the popular books, everything out there assumes you're using C or C++ when you're working with GPU code. It's fine. I like using C++ for this. OpenGL in any other language and you're a second class citizen at best.
D was at one point a C++ compiler but Walter Bright decided to break backward compatibility with C syntactically to allow the language to evolve in ways that C restricts, while still allowing it to interface with C. Sorry if I worded this poorly, but you may want to reconsider D and see for yourself if it feels like a second class citizen or what? There are sample projects interfacing to C projects (LuaD comes to mind).
D programs can make direct (=zero overhead) calls to C functions (like we do in C++). Which basically means you have access to any C library.
The D standard library is very dense (it makes C++14 standard library look ridiculously incomplete), so most things are available out of the box (threads, processes, filesystem, network, random, algorithms) ... in a portable way.
There's a Visual Studio plugin available, and I know VS Code has a nice plugin as well ( you need to install certain tools yourself in that case ), as well as other editors with their own feature set. There is also Dub[0] which is a build tool for D and gives you access to all sorts of D packages. I'm still a beginner to D so forgive me if my answer doesn't suffice.
I recently had need to write some native Windows software, and I did want to use Rust initially, since I don't fully trust myself to write correct C++.
I ended up still writing it in C++ since Rust's support for writing COM objects/servers was not great, but I also ended up having to chase down a bug where I forgot to AddRef before storing a COM pointer in a map.
I did use CComPtr, but they only reduce the amount of footguns, they don't get rid of them. In my case, I accidentally stored a reference to the inner pointer instead of calling Detach.
My point isn't that there aren't nice idiomatic ways of writing nice windows/c++ code that are not fragile, it's that unless you're well versed in them, you can easily screw things up pretty badly.
[EDIT]: In case it's not clear, I am not a windows C++ developer, I've read a decent amount of windows C++ code, so I sort of know what's going on, but I've written less than 5k lines of windows C/C++ in my life.
I also had to do that recently and used Nim instead after spending too much time on it in C. For anyone attempting to do the same, I suggest 32bit Nim + msys2 + nimble install oldwinapi.
"Undefined behaviour" is a specific term of art in the context of C/C++ and is an euphemism for your whole program state potentially becoming corrupted. With crafted inputs your program can start executing attacker-supplied arbitrary code.
Can you give examples? Dependency Injection seems to be the trend going forward as far as good practices go (Play Framework for instance is migrating to pure Dependency Injection for routers/controllers).
Nothing in my mind though really beats the ecosystem around Java of these three in terms of IDE support, tooling and just simplicity in getting code out fast when you don't need low level access to things. Netty really brings great things to Java, and the many mature web frameworks for JVM languages are probably better than anything available for Rust right now. I'm not sure a sane person would write backend for a web site in C++. :P
Anyway I love both Rust and Java 8 and it's great to see them thriving.