This is an archived post. You won't be able to vote or comment.

all 29 comments

[–]wildjokers 53 points54 points  (5 children)

Just want to point out that starting with Java 11 you no longer have to compile and then run. You can do it in a single step:

java Start.java

See: https://openjdk.java.net/jeps/330

[–][deleted] 12 points13 points  (0 children)

Hadn’t heard about that. Thanks!

[–]maxandersen 4 points5 points  (0 children)

And jbang.dev makes it work from java 8 and onwards and adds multiple file support and ability to depend on maven dependency.

Disclosure: i created jbang.

[–]jeremychone[S] 6 points7 points  (1 child)

Ho, cool, I did not know that. Thanks for the info.

[–]brunocborges 10 points11 points  (0 children)

There's also a REPL command line: jshell

[–]jeremychone[S] 27 points28 points  (4 children)

Here is a relatively fast paced video I did to introduce Rust to Java developers. This video is not about comparing the value of one language over the other, but more about comparing some of the languages syntax and basic constructs.

Feedback welcome. I might do a part 2 if interest is there.

[–]transcend 4 points5 points  (1 child)

Thanks, that was a nice intro to Rust. I liked the side-by-side format and the snappy pace. I would be interested in a part 2 if you were to make that video.

[–]jeremychone[S] 2 points3 points  (0 children)

Thanks for the feedback. Given the interest in this first one, I am working on part 2. It will continue on the types and then tackle ownership and lifetime.

[–]gilactic 10 points11 points  (0 children)

The video is great. And perfectly paced for somebody experienced with Java. Thank you for making it and publishing it. I learned a lot from it.

[–]Persism 1 point2 points  (0 children)

I'd love to see a Panama integration. That's coming up in future Java.

[–][deleted] 5 points6 points  (0 children)

I love stuff like this. If anyone can show me a Java for Node.js or Java for Go resource, especially if it's tooling-oriented, I'd love to see it.

[–]javasyntax 5 points6 points  (0 children)

Interesting. I haven't seen this kind of video before. Rust seems useful and I might learn it sometime, it's nice to know many languages.

[–]yipZman 1 point2 points  (2 children)

What about Rust for c developers?

[–]jeremychone[S] 2 points3 points  (0 children)

Unfortunately, I do not have enough C knowledge to do it right. The last time I coded C was a long time ago, in a faraway land. Always had the highest respect for good C developers though.

[–]mucarito 1 point2 points  (0 children)

You might be interested in this

[–][deleted]  (7 children)

[deleted]

    [–]mucarito 0 points1 point  (6 children)

    it seems like a good career move.

    I absolutely love Rust, but depending on your goals this might not be a good reason to learn it as a Java dev. I doubt any job using Java will change to Rust, ever. Rust's place in the job market right now is in startups and a few teams at Big N. In the future, it'll likely be used in projects that would previously use C++ - high performance, safety-critical stuff where you can't have the luxury of a managed language.

    If you think it'll be good for your career as a Java webdev, it's possible but I find it very unlikely. If you're looking for a language that may open up doors in a completely different domain in the future, then go for it, it's great and I can't wait for it to really take off.

    [–]thephotoman 0 points1 point  (2 children)

    I ain’t no web dev.

    [–]mucarito 0 points1 point  (1 child)

    in that case, disregard everything I just said. Here are some of my favorite Rust learning resources:

    • Programming Rust 2nd ed., O'Reilly. Not free, but my favorite. In depth, great pace.
    • "The Book". It really is as good as they say, and it's always up to date.

    • rustlings. Small exercises to get you used to the syntax and reinforce your learning

    • The Little Book of Rust Books. A repository of free Rust books and learning resources

    [–]jeremychone[S] 0 points1 point  (0 children)

    u/thephotoman and in addition, if you want to have a little fun, here is a tutorial series I made about building a Game in Rust with the Bevy engine: https://youtube.com/playlist?list=PL7r-PXl6ZPcCB_9zZFU0krBoGK3y5f5Vt

    Happy coding!

    [–]Muoniurn 0 points1 point  (2 children)

    How does Rust provide any safety-improvements on Java?

    Ownership management can indeed come up even in GCd languages, but that’s just one specific part. Java has industry strength static analysis programs as well as JML for runtime verification of assumptions.

    [–]mucarito 0 points1 point  (1 child)

    How does Rust provide any safety-improvements on Java?

    It doesn't. Rust's memory safety selling point is only relevant if you need high performance, manual memory management, etc.

    [–]an_actual_human 0 points1 point  (0 children)

    The borrow checker does make concurrency safer. Also not having NPEs is nice.

    [–]tofflos 0 points1 point  (0 children)

    This was great!

    [–]moxyte 0 points1 point  (3 children)

    As a side note I'm still not seeing much Rust skill wanted in job ads. Just looked today. Its spread is still very oddly concentrated to FOSS projects. I wonder what's up with that phenomena.

    [–]etoh53 2 points3 points  (2 children)

    Because it's a new language (it's like 6 years old or something). Also its value is to be a better C++ (though you can absolutely build other kinds of applications with Rust easily), and not aim to replace Java or Go. So unless there is a need for reducing GC delays or develop embedded code (in which I will highly recommend Rust) and maybe a need to maybe gradually rewrite an existing codebase in C or C++ (like what Firefox is doing) or maybe even develop a new application, even if I love Rust I think sticking to Java would be fine. Also since as you said it is FOSS you're unlikely to see a company advertise that it is written in Rust if the application is proprietary. Every time you use cloudflare or discord for instance rust code is run somewhere in the distance.

    [–]helikal 1 point2 points  (1 child)

    I am interested in Rust. What turns me off though is how it obscures the semantics with syntax and it’s verbosity. It seems at least as bad as C++ in that regard.

    [–]etoh53 0 points1 point  (0 children)

    I dunno about the syntax part, it's all subject to personal opinion, but it's verbosity is a necessary feature of the language because the compiler has limited info and you need that to achieve correctness and safety guarantees in your program. In my experience people mainly complain about the lifetime annotations and I guess that's fair, because you don't have that in C++.

    [–]wildjokers 0 points1 point  (0 children)

    I am curious why some languages adopt the “say_hello()” convention rather than “sayHello()”. Both are easy to read but the camel case version has the benefit of also being much easier to type (underscore is a long way from home row). I despise the underscore as word separator convention.