7 ms·
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 muc
by levemi 11y ago
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.
- truncate 11y agoSpeaking 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.
- chamakits 11y agoI 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?
- sk5t 11y agoSame 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.
- EdwardDiego 11y agoIDEA'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.
- mavelikara 11y agoIDEA'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]. [1]: http://blog.jetbrains.com/idea/2015/12/intellij-idea-16-eap-starts-the-faster-release-cycle/ http://blog.jetbrains.com/idea/2015/12/intellij-idea-16-eap-...
- reitanqild 11y ago> 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.
- firebones 11y agoPackage 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.
- moonchrome 11y agoGradle 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)
- krotton 11y agoI 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.
- pjmlp 11y agoAssuming you have a quad-core and enough GB to spare. I am yet to see Gradle perform as fast as Ant and Maven without fine-tuning and background daemons tricks .
- avita1 11y agoWhat are these fine-tuning and background daemon tricks? I have yet to see gradle run as fast as ant period.
- pjmlp 11y agoWhat 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.... Still, the end result is as you say.
- vorg 11y agoYou 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.
- guelo 11y agoNo matter what all the other commenters are saying here maven and gradle are awful. Cargo is much more pleasant to use.
- dikaiosune 11y agoIn my opinion cargo > maven/Gradle > most other build/dependency systems I've used, including setuptools, cmake, and others.
- _asummers 11y agoI 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?
- lmm 11y agoMaven 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.
- sunnyshahmca 11y agoI think, SBT is better than Maven. It allows interactive development.
- lmm 11y agoMaven 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.
- koide 11y agoSymbol heavy syntax as opposed to symbol free xml? Could you elaborate?
- lmm 11y agoXML 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.
- llogiq 11y ago
- Eridrus 11y agoI 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.
- lqdc13 11y agoI 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.
- pjmlp 11y agoWhy did you not make use of CComPtr, ComPtr or the _com_ptr_t smart pointers? https://msdn.microsoft.com/en-us/library/ezzw7k98.aspx https://msdn.microsoft.com/en-us/library/ezzw7k98.aspx https://msdn.microsoft.com/en-us/library/br244983.aspx https://msdn.microsoft.com/en-us/library/br244983.aspx https://msdn.microsoft.com/en-us/library/5yb2sfxk.aspx https://msdn.microsoft.com/en-us/library/5yb2sfxk.aspx https://msdn.microsoft.com/en-us/library/h31ekh7e.aspx https://msdn.microsoft.com/en-us/library/h31ekh7e.aspx
- Eridrus 11y agoI 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.
- pjmlp 11y agoFare enough. I know Windows since Win16 APIs days (started with Windows 3.0) I would run into similar issues when coding for Apple platforms, for example.
- jmspring 11y ago> when I run into unexpected undefined behavior during run time I very much miss Rust and Java as neither would have happened in either. You obviously haven't dealt runtime dependency injection/etc. in Java. It happens regularly.
- Negative1 11y agoCan 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).
- w84t1me 11y agoIt might be a reference to debugging Spring autowire.
- zurn 11y ago"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.
- giancarlostoro 11y agoHave 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.
- meddlepal 11y agoWhat is the tooling and library ecosystem like for D compared to Java?
- giancarlostoro 11y agoThere'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. [0]: https://code.dlang.org/getting_started https://code.dlang.org/getting_started
- Ace17 11y agoD 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.
- dikaiosune 11y agoAFAIK, 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?
- atilaneves 11y agoLots 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.
- llogiq 11y agoThank you! I'm glad you like it.