Rust vs Java: A Staff Engineer's perspective

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 พ.ย. 2024

ความคิดเห็น • 203

  • @hamdysaadpersonal
    @hamdysaadpersonal ปีที่แล้ว +13

    💞💞 this is the real full comparison.
    And Thank you Dario for the shoutout 💞🔥

    • @dario.lencina
      @dario.lencina  ปีที่แล้ว +1

      Thank you my friend, I hope you have an awesome 2023!!

  • @RealViPdude
    @RealViPdude 10 หลายเดือนก่อน +68

    people who complain about the main method in java have no idea what theyre talking about.

    • @dario.lencina
      @dario.lencina  10 หลายเดือนก่อน +11

      That is exactly right, nowadays you do not even have to type it, the ide will do it for ya

    • @drizer4real
      @drizer4real 2 หลายเดือนก่อน +2

      Exactly and in the worst case you have to type it exactly once per project. Wow , maximum verbosity dude.

    • @curio78
      @curio78 หลายเดือนก่อน

      Java has only one drawback, ONE.. that is value object and universal generics for primitives that has taken way too long to be implemented. That is it. But is a huge one. resulting in Java missing the whole AI boom.

    • @ghdshds1899
      @ghdshds1899 3 วันที่ผ่านมา

      @@curio78 No it has another drawback and that's its basically impossible to use without a fully fledged java IDE

    • @curio78
      @curio78 3 วันที่ผ่านมา +1

      @@ghdshds1899 You are using reverse logic. The correctness of the language allows for IDEs to be built to use it. Its correctness means IDE's can actually help with autocomplete, documentation, and hints.
      It is not Java's disadvantage, it is its advantage. If one used an IDE you will realize how bad other languages are. They feel incomplete.

  • @Taurdil
    @Taurdil ปีที่แล้ว +9

    Compilation times would be nice to compare. Say, Spring Boot vs Actix or smth. That would be the place Java shines, especially because it doesn't need to recompile all your dependencies even once.
    But the real difference would be in the possibilities. In Java, you can change byte code during loading (per class basis) so you can write your "agent" which would instrument client's code with whatever logic you need. It is utilised heavily by telemetry libraries such as DataDog , OpenTelemetry, etc. In Rust, I think, you have to instrument your code manually.
    And Java has pretty good Reflexion API. Haven't seen any in Rust
    These could be a real dealbreakers for some projects I think.

    • @dario.lencina
      @dario.lencina  ปีที่แล้ว +6

      Yes! Compile time is still terrible in Rust! Also Java Agents are awesome! I completely forgot about them.
      I love how mature the Java echo system is!

    • @kulikgabor7624
      @kulikgabor7624 หลายเดือนก่อน

      I think it worth to mention that when you compile you usually run your tests too and if you sum that up rust will be almost there if not better. I had a test which starts redis in a docker, fill it, verify it and the whole test executes under 1 second. Actually my experience is it's much faster to work with rust because of that.

  • @vitaliikocherga3954
    @vitaliikocherga3954 3 หลายเดือนก่อน +3

    the rule at 15:38 applies when you passing a variable into a lambda function. variable have to be either declared final or be effectively final, meaning there should be no mutation of variable after its initialization, which is violated by i++ in this case

    • @dario.lencina
      @dario.lencina  3 หลายเดือนก่อน

      Thanks for the clarification 👍👍

  • @Gennys
    @Gennys 8 หลายเดือนก่อน +5

    I have one tiny nitpick about around 17:10 and in a couple other instances. If you want to compare the libraries of the languages to one another that's one thing. But it should be explicitly stated that you keep saying "Rust" and "Java" interchangeably with "Rust's libraries" and Java's libraries.
    I see people do this a LOT when they're comparing two languages but in fact they are just comparing the libraries for the language.

    • @dario.lencina
      @dario.lencina  8 หลายเดือนก่อน +2

      Thank you for bringing this to my attention. I appreciate your careful listening and your point is well-taken. I intended to compare the libraries available in Rust with those in Java, which indeed are distinct and should not have been referred to interchangeably. It’s important to be precise when discussing the characteristics and capabilities of different programming languages, and I’ll make sure to be more specific in future discussions. Thanks again for your feedback!

  • @olexandrkostiuk9653
    @olexandrkostiuk9653 ปีที่แล้ว +6

    There is a little mistake in mpmc section related to Java assumptions. You must pass the final or effectively final variable to lambda but not to thread. And behavior for primitives and objects are the same. In Java, all parameters are passed by value. In the case of an object, the value is a reference to that object, so the reference still keeps the final props. But anyway, it's a great video!

    • @dario.lencina
      @dario.lencina  ปีที่แล้ว

      Thanks for the feedback mate 👀👀

  • @professornumbskull5555
    @professornumbskull5555 ปีที่แล้ว +21

    There is null in rust, std::ptr::null

    • @dario.lencina
      @dario.lencina  ปีที่แล้ว +8

      Yikes, thanks for pointing this out, how do you use it?

    • @professornumbskull5555
      @professornumbskull5555 ปีที่แล้ว +20

      ​@@dario.lencina You don't. Null pointer should not be used in application, in any form, unless you're working with Systems development. You can get a null pointer by invoking function, ptr::null(), which gives you a raw pointer, pointing to null, which to do anything with, you need to be in an unsafe block.

    • @dario.lencina
      @dario.lencina  ปีที่แล้ว +1

      Makes sense, 👏🤗 thank you so much

    • @coffee-is-power
      @coffee-is-power 3 หลายเดือนก่อน +1

      @@dario.lencina LIke there's references with & in rust and then there is raw pointers that are similar to C and C++ pointers which you only use with low level programming and when you're interacting with C libraries and calling external code and you need an unsafe block to dereference them because they don't have an associated lifetime and the rust compiler does not check those so it might point to invalid memory addresses or even be a null pointer just like in C and C++
      Btw references can coerce to raw pointers but to convert a raw pointer to a reference you need an unsafe block and specify a lifetime (or none if you want 'static)

    • @josephp.3341
      @josephp.3341 3 หลายเดือนก่อน +2

      Also: Option will be optimized to a raw pointer with a null pointer check. Rather than just naively using a tagged union (which is how other some rust enums are implemented). This optimization actually works for any enum with the same shape as Option.

  • @kamertonaudiophileplayer847
    @kamertonaudiophileplayer847 3 หลายเดือนก่อน +2

    I use Rust and Java in my latest app RDS. I use Rust to write CGI code, it is executed inside a Java container and certainly the websocket part is handled by Java. Did I mention that a build tool for the project written in Rust? So no controversy is here, just a collaboration.

  • @vitalyl1327
    @vitalyl1327 3 หลายเดือนก่อน +5

    I'm not sure it's even possible to compare a language relying on a runtime with GC with a language with a deterministic runtime. Their problem domains do not even overlap.

    • @dario.lencina
      @dario.lencina  3 หลายเดือนก่อน +1

      I made it posible 👍

  • @orsivan5731
    @orsivan5731 2 หลายเดือนก่อน +4

    25:00 I don't understand what did you show here. In Java you demonstrated how keeping a reference to the object prevents it from being collected. In Rust you just showed that once the object is deallocated you can't call it. These are 2 different features.
    I don't know Rust, I actually wanted to see how Rust behaves when you copy the reference/pointer to an object and the deallocate the original (but not the copy).

    • @dario.lencina
      @dario.lencina  2 หลายเดือนก่อน

      I am trying to look at the time stamp that you mention but the video is 25 mins, if you share the time stamp I can explain

    • @orsivan5731
      @orsivan5731 2 หลายเดือนก่อน

      ​@@dario.lencina sorry, wrong timestamp. I was talking about the dangling pointer example.
      In Java you created a reference of an ArrayList, then created another reference for said list, and you nullfied the first reference and showed ArrayList still exists (as the refcount is not 0).
      Around 8:30 you wanted to show the same thing in Rust, but you just created one reference and the dropped it. There was no second reference.

  • @morgomi
    @morgomi ปีที่แล้ว +7

    Ironically, I searched "Rust vs Java" and the first video was 1:36. I immediately closed it after seeing the while loop. :D Then youtube recommended this video on my homepage and here I'm. Such a cool channel.

    • @dario.lencina
      @dario.lencina  ปีที่แล้ว +1

      Welcome to the party brother !! 🥳🎉

  • @ReedoTV
    @ReedoTV ปีที่แล้ว +54

    I write Rust so I can keep my passion alive and I write Java so I can stay employed

    • @dario.lencina
      @dario.lencina  ปีที่แล้ว +2

      The market is ready for rust developers! Checkout all the positions on LinkedIn

    • @gmodrules123456789
      @gmodrules123456789 ปีที่แล้ว +10

      Java can be fun if you write it intuitively rather than following some strict guideline

    • @dario.lencina
      @dario.lencina  ปีที่แล้ว +2

      I agree! I remember the Java EE enterprise beans stuff, it makes me sad!

    • @gowthamk7416
      @gowthamk7416 3 หลายเดือนก่อน +1

      @@gmodrules123456789well said I like playing around with Java without following any guidelines but no one cares about it so the hate is more on the community rather than the language

  • @JuanCHB_88
    @JuanCHB_88 หลายเดือนก่อน +2

    Love the Java reactive with spring web flux.

  • @karimjedda
    @karimjedda ปีที่แล้ว +6

    Great video and thanks for going into the details. I've grew up with Java/C++/Python and been learning some Rust for a year as an additional tool to get things done. It's been a pleasure to work with.

    • @dario.lencina
      @dario.lencina  7 หลายเดือนก่อน +1

      glad to hear my friend!!

  • @andrebrait
    @andrebrait 3 หลายเดือนก่อน +2

    I think you'd benefit from a boom filter on your microphone.
    It's not too bad without it, but it would help manage those plosives.

    • @dario.lencina
      @dario.lencina  3 หลายเดือนก่อน

      Plosives are awesome mate PPPPPPPPP

    • @dario.lencina
      @dario.lencina  3 หลายเดือนก่อน

      I did figure out how to filter those out in newer videos

  • @masterchief1520
    @masterchief1520 3 หลายเดือนก่อน +3

    For what go provides and the effort to use those features. It beats everything else. How many of us write systems software. If you're working for enterprise, java is the only way. Sure.

  • @kuqmua755
    @kuqmua755 ปีที่แล้ว +1

    and yes, would like to talk about async programming. is there implicit timeout for async functions in rust and what happens if you reach it - and how handle timeout error for async functions without panic - with Result.

    • @dario.lencina
      @dario.lencina  ปีที่แล้ว +1

      You got it chief!! I just added it to the queue, I'll include timeouts and some other common pitfalls!!

    • @coffee-is-power
      @coffee-is-power 3 หลายเดือนก่อน

      The way i do timeouts is using select and i put a sleep alongside the other future inside it, select basically short circuits when a future finishes and aborts the other futures, so if you put a tokio::sleep and it finishes first it means that it timed out

  • @warrenarnoldmusic
    @warrenarnoldmusic หลายเดือนก่อน +1

    Do comparison of web servers between the two esp java, and focus on light webservers without heavy annotation use, like js express. Because i find spring too opinionated

    • @dario.lencina
      @dario.lencina  25 วันที่ผ่านมา

      Sounds like a great idea, which other Java servers do you have in mind?

  • @dr.rainereschrich1549
    @dr.rainereschrich1549 9 หลายเดือนก่อน +2

    You should also compare rust to Java + GraalVM Native image!

    • @dario.lencina
      @dario.lencina  9 หลายเดือนก่อน +1

      Wow 👀👀👀I need to look into that!! Thanks for sharing

  • @vencedor1774
    @vencedor1774 3 หลายเดือนก่อน +2

    Bro's really testing an oriented application-maker language in a webpage competition

  • @coffee-is-power
    @coffee-is-power ปีที่แล้ว +2

    crossbeam is not necessary, it's already inside the std library on std::sync::mspc

    • @dario.lencina
      @dario.lencina  ปีที่แล้ว

      Nice!! Good to know 🤗🤗🤗

    • @henrycgs
      @henrycgs 3 หลายเดือนก่อน +1

      wrong, crossbeam is mpmc (multiple producers/multiple consumers) whereas the one in std is mpsc (multiple producers/single consumer).

  • @kobibr9362
    @kobibr9362 10 หลายเดือนก่อน +2

    Could a boxed value in Rust help create that dangling pointer?

    • @dario.lencina
      @dario.lencina  10 หลายเดือนก่อน

      You are saying that we could use Boxes to create dangling pointers? Wouldn’t the borrow checker prevent it?

    • @henrycgs
      @henrycgs 3 หลายเดือนก่อน +1

      nope, it's impossible to create dangling pointers in safe rust. if you put something in a box, the box owns the value and you can't take it out without dropping the box

  • @kuqmua755
    @kuqmua755 ปีที่แล้ว +2

    great video! about dead locks - is there any abstraction around rust Arc to prevent it? like all of your values must implement some trait to use it between threads - and throw error on compile time if you trying to do so

    • @dario.lencina
      @dario.lencina  ปีที่แล้ว +2

      Hey @kuqmua! I found RwLock so that you can only get one write lock at the time which helps! doc.rust-lang.org/std/sync/struct.RwLock.html
      This type of lock allows a number of readers or at most one writer at any point in time. The write portion of this lock typically allows modification of the underlying data (exclusive access) and the read portion of this lock typically allows for read-only access (shared access).

  • @JuddMan03
    @JuddMan03 3 หลายเดือนก่อน +4

    Dudes trying to eat the mic

    • @dario.lencina
      @dario.lencina  3 หลายเดือนก่อน +1

      🎤🎤😋😋

  • @krellin
    @krellin 10 หลายเดือนก่อน +2

    Good video, and you are on point that everything is a tool, good engineers do not fanboy over one or the other just know what is better to use in which situation.
    Performance is not a perk of the language but your knowledge of how hardware works and how to write code that takes advantage of it. You can have insane performance with both.

    • @dario.lencina
      @dario.lencina  10 หลายเดือนก่อน

      That’s right my friend! Both are awesome tools!

    • @dario.lencina
      @dario.lencina  10 หลายเดือนก่อน

      Being analytical as opposed to fanboys is always better

  • @michaelutech4786
    @michaelutech4786 5 หลายเดือนก่อน +2

    I used Java a lot in the past and it was never the greatest pain in any project. It is noisy and requires to write quite a lot of boilerplate to setup dependency code, but you get a lot of high quality functionality for free that you won't easily find in other ecosystems. You occasionally run into problems with memory leaks and concurrency, but once you understand the typical causes, this is manageable. Java is often slower than compiled and optimized code, but I very rarely saw that being a real problem.
    That being said, I don't see that Java has any substantial advantages over more modern languages like Rust, Go, Zig, or Swift, unless you need the pool of high quality libraries available for Java.
    Of these modern choices, I like Zig best, because it is the least opinionated offering the best compatibility to the C family of languages. It has the potential to become the fastest language with the least overhead, maybe with the exception of Mojo and it is much less perly (really don't like the quirkiness of Rust).
    I find Rusts borrow checker problematic, because it's by far not as intuitive as garbage collection (just ignore memory management in most cases), creating quite a bit of learning overhead and managing non-local life-times is hard. Zig's approach to manual management is really nice, solving most problems through convention and static analysis while providing full control making this a practically viable model. Swift has an efficient reference counter not requiring garbage collection, which is ok but not great.
    What I love about Zig is that you maintain full control over everything and still have a lot of comfort, productivity and sufficient safety (the last is debatable, that's my opinion)

    • @dario.lencina
      @dario.lencina  5 หลายเดือนก่อน +1

      Ah, the Java conundrum-it's like that reliable old car that never quite gives you the thrill of a shiny new sports car, but gets you from point A to point B without too much fuss. Yes, it’s noisy, requires you to fill out a bit too many forms (boilerplate), and occasionally leaks oil (memory leaks), but hey, at least it’s dependable, right?
      But let’s talk about these new kids on the block-Rust, Go, Zig, Swift. It’s like comparing that old reliable car to the latest models with all the fancy gadgets. Rust is like the safety-first SUV with the borrow checker ensuring you don't crash into memory bugs, though sometimes it feels like it's overprotective and insists you wear a helmet while sitting in your living room.
      Zig? Now that’s the minimalist sports car. It’s sleek, unopinionated, and fast, with just enough safety features to keep you from wrapping it around a tree. It's the kind of car that lets you feel every curve of the road, giving you full control while whispering sweet nothings about manual memory management and low-level control.
      Swift, on the other hand, is the hybrid-efficient, a bit of a control freak with its reference counting, but still pretty smooth and eco-friendly. It’s not going to win any races against Zig’s raw speed, but it’s not about that life anyway.
      And Go? It’s the utilitarian truck-practical, straightforward, gets the job done without too much flair. But you didn’t mention it, probably because Zig’s minimalist appeal has stolen the spotlight.
      In the end, it all boils down to what you value most in your coding joyride. Rust’s safety-first approach, Zig’s minimalist speed, Swift’s balanced efficiency, or Go’s straightforward reliability. Each has its quirks, just like our old friend Java, but the thrill of the ride is in finding the one that matches your style. Enjoy the journey!

    • @michaelutech4786
      @michaelutech4786 5 หลายเดือนก่อน

      @@dario.lencina "Rust [..] SUV" - To me Rust feels like the UK model of a french car with hydrolic suspension (like these futuristic Citroën guys in the 70's). It's undeniably fantastic, but it's like you first have to forget what a car is before you can love it.
      Zig to me feels like opening a new gamer PC without colors after having tried to repair a Macbook. One philips screwdriver is all you need. Not sleek, not too fancy, not elegant, but easy to understand and powerful.
      But I agree, the fun is not in the language, it's in the act of coding.
      Really like your videos, you're doing a great job here!

    • @gammalgris2497
      @gammalgris2497 3 หลายเดือนก่อน +1

      Dunno. If you have issues with boilerplate code then blame the libraries/ frameworks and your coding guidelines you adhere to. There are various ways to abstract boilerplate away. I myself ditched some which I used over the years with java.
      Zig sounds interesting. I would rather avoid rust because of the ownership and borrowing concepts.

  • @rhysmuir
    @rhysmuir 4 หลายเดือนก่อน +1

    Java /JVM is the only language I have come across that requires end user to modify the available memory.

    • @dario.lencina
      @dario.lencina  4 หลายเดือนก่อน

      You mean adding the jvm flags to set limits like Xms?

    • @rhysmuir
      @rhysmuir 4 หลายเดือนก่อน +1

      @@dario.lencina yep. Maybe I’m just lucky (or unlucky), but Java based programs are the only ones I’ve come across where the end user might need to modify such settings - terrible experience for the layperson

    • @dario.lencina
      @dario.lencina  4 หลายเดือนก่อน

      @rhysmuir hahaha agreed

    • @ArturdeSousaRocha
      @ArturdeSousaRocha 3 หลายเดือนก่อน +1

      ​@@rhysmuirGo programs may benefit in GC performance if you give them a memory limit that causes them to start collecting earlier. Perhaps it's a corner case but it is mentioned somewhere on their website.

  • @RhinoInfo
    @RhinoInfo ปีที่แล้ว +4

    hi . a great video man . actually i would love to switch to rust . but i don't wanna dive wrong to the lang . could you please make a roadmap vid . so you share u'r experience with us . thanks for the vid again

    • @dario.lencina
      @dario.lencina  ปีที่แล้ว +4

      Hey @Rhino, I'll definitely do this, the most common pitfall (imo) is to try to learn smart pointers and lifetimes in too much detail as opposed to copying objects around just to get started. In the mean time I recommend that you read doc.rust-lang.org/book/ it should take less than 4 hours and it provides a great "getting started" guide.
      Thank you so much for your feedback!

    • @v01d_r34l1ty
      @v01d_r34l1ty ปีที่แล้ว +2

      @@dario.lencina This is definitely an underappreciated comment. I've tried time and time again for about 3 years now to learn Rust. Kept giving up on it very quickly because ultimately every book gets right into the nitty gritty. On New Years, I was alone with my little bro, so I decided to try Axum again and successfully built a static web server with various API handlers! I learned more doing that than anything else so far.

    • @dario.lencina
      @dario.lencina  ปีที่แล้ว +1

      @@v01d_r34l1ty neat!! 🤗👏 good for you, is it a public GitHub project that you can share?

    • @v01d_r34l1ty
      @v01d_r34l1ty ปีที่แล้ว +1

      ​@@dario.lencina Not yet! It will be once I get JSON web tokens and authentication implemented. I'm trying to make a very basic chat application (demo video on my channel).

    • @dario.lencina
      @dario.lencina  ปีที่แล้ว +1

      @@v01d_r34l1ty sweet!!

  • @abidapollo
    @abidapollo 10 หลายเดือนก่อน +2

    so , first c, then java then rust,
    then life is set if the brain is good?

    • @dario.lencina
      @dario.lencina  10 หลายเดือนก่อน +1

      🤗🤗yes, it is the only way to illuminate and achieve nirvana

    • @henrycgs
      @henrycgs 3 หลายเดือนก่อน

      @@dario.lencina and after you achieve nirvana, you can use haskell.

    • @vencedor1774
      @vencedor1774 3 หลายเดือนก่อน +1

      Before C it comes machine code and assembly, in that order.

  • @Razpirato
    @Razpirato ปีที่แล้ว +3

    Nice video but you need better mic etiquette. Constantly getting “plosives”.

    • @dario.lencina
      @dario.lencina  ปีที่แล้ว

      Point taken, I’ll add a pop filter to deal with this, thanks for watching

    • @dariolencina3709
      @dariolencina3709 ปีที่แล้ว

      Is this better th-cam.com/video/LWwOSZJwEJI/w-d-xo.html&ab_channel=SecurityUnion (added a pop filter)?

  • @computerfan1079
    @computerfan1079 ปีที่แล้ว +4

    I laughed out loud multiple times. I see your channel growing a lot

    • @dario.lencina
      @dario.lencina  ปีที่แล้ว

      even as I was editing the video the part with the for loop "benchmark" had me laughing!!

  • @tacticalassaultanteater9678
    @tacticalassaultanteater9678 17 วันที่ผ่านมา +1

    "In-depth comparison"
    Proceeds to compare the behaviour of a java arraylist which is gc-d and locked with a Vec without choosing a smart pointer, thereby defaulting to owned semantics

    • @dario.lencina
      @dario.lencina  17 วันที่ผ่านมา

      Yeah what a loser right?

    • @tacticalassaultanteater9678
      @tacticalassaultanteater9678 17 วันที่ผ่านมา

      @@dario.lencina I shouldn't be so negative. By TH-cam standards this is really an in-depth comparison. I guess I'm just frustrated with how persistently surface-level Rust discussion is on this platform.

  • @curio78
    @curio78 หลายเดือนก่อน

    rust cannot replace c++. A functional language is not good at building large complex monoliths. That is the reason why OOP came to be. Which is why Java is so popular in building large systems.

    • @dario.lencina
      @dario.lencina  หลายเดือนก่อน

      So you are saying that rust is functional? I think it has some functional methods and traits but it is not even close to Haskell or those pure functional languages

    • @curio78
      @curio78 หลายเดือนก่อน

      @@dario.lencina Every language that does not have identity objects where functions can reside is functional. And has the same limitations. What we needed was a better C++ like D-Lang to cover all use cases.
      As far as languages go C# is the most complete languages of them all. Java needs project Valhalla to be implemented to be complete (once that is done There is not a single reason to switch in case of application programming,and should finally replace python in machine learning).
      I always wondered. by D-Lang never caught on. I seems like a logical refinement of C++. I guess there is not a big need for large applications in systems programming. Most of them are small modules cobbled together into a large ecosystem.

  • @petersburgh78
    @petersburgh78 26 วันที่ผ่านมา +1

    Java owned by Oracle. Originally Java invented by Sun Microsystems but the company was acquired by Oracle. Comparison Java with Rust can't be apple to apple. Java is suitable for application development but Rust is for the system development

    • @dario.lencina
      @dario.lencina  25 วันที่ผ่านมา

      How about people that make applications with rust 💥💥💥🤯🤯

    • @petersburgh78
      @petersburgh78 25 วันที่ผ่านมา +1

      @ You make an application using Rust. But it’s not the best fit since the best use cases for using Rust are: system(OS kernel, database, etc) and tools(CLI and compiler). Although some articles say Rust can be used for all use cases, we should recheck if is it the proper way to do that.

    • @dario.lencina
      @dario.lencina  17 วันที่ผ่านมา

      @@petersburgh78 well, I've built complete web apps in rust and so far so good my friend 😄

  • @jonnyso1
    @jonnyso1 3 หลายเดือนก่อน +3

    Ironically, I think that someone who likes Rust is more likely to prefer Java over the javascripts and pythons.

  • @codeman99-dev
    @codeman99-dev ปีที่แล้ว +1

    My guy. Turn off the dynamic zoom. Very distracting.

    • @dario.lencina
      @dario.lencina  ปีที่แล้ว

      Thanks mate, I’ll consider it. Believe or not some people actually like it ?

    • @codeman99-dev
      @codeman99-dev ปีที่แล้ว +1

      @@dario.lencina interesting.
      I guess someone must. I can't watch Networkchuck because of his dual camera setup. He has quite the following though.

    • @dario.lencina
      @dario.lencina  ปีที่แล้ว

      @99codemister I’ll make sure to make them less distracting

  • @masterchief1520
    @masterchief1520 3 หลายเดือนก่อน +1

    Can you not keep looking towards your second monitor? 😂. Directly look at us when you're talking 👀

    • @dario.lencina
      @dario.lencina  3 หลายเดือนก่อน

      Got it ✌️feedback taken

    • @ArturdeSousaRocha
      @ArturdeSousaRocha 3 หลายเดือนก่อน

      I've been in so many MS Teams videoconferences that it looks normal to me. 😆

  • @Gabriel-zr4kz
    @Gabriel-zr4kz 7 หลายเดือนก่อน +2

    Java is the best language in my Opinion (at least for learning), everything is literal and verbose. I hate programming languages like Python and Ruby, they seem to complicated for me and I don't know why (perhaps abstraction).
    My first language was Js/Ts but once you deal with maps, reduces it gets kinda weird. I'm a SDE nowadays and I only learned to program after I learned java. In my opinion the annoying boilerplate makes sense in my head.

    • @dario.lencina
      @dario.lencina  7 หลายเดือนก่อน +1

      Java does have its merits with explicit verbosity, which some find reassuring like a well-detailed map.
      Yet, isn't it thrilling to sometimes navigate the programming jungles with just a compass?
      Python and Ruby are like that, offering a concise syntax - it’s less about the roads taken and more about the adventure.
      Admittedly, Java's boilerplate can feel like a safety harness, but maybe after scaling the cliffs with JavaScript's flexibility, that harness just feels a bit too snug?
      As an SDE, you've mastered different terrains, so why not enjoy the view from all perspectives?

    • @Gabriel-zr4kz
      @Gabriel-zr4kz 7 หลายเดือนก่อน +1

      ​@@dario.lencina What a comment! Yes .map in JS are pretty useful, but they only made sense when I made them in Java HAHA. like every other data structure One example is when I do Hackerrank/LeetCode challenges I do them in Java because it's easy for me and I'm a fullstack with strong frontend side and don't know why.
      I do well with C and C++ codes seems more well, but easier than Ruby/Python.

    • @vitalyl1327
      @vitalyl1327 3 หลายเดือนก่อน +1

      Java is better but still nowhere near the right kind of verbose. You'd appreciate Oberon far more. Or even Ada.

    • @dario.lencina
      @dario.lencina  3 หลายเดือนก่อน

      @vitalyl1327 did you even try rust?

    • @vitalyl1327
      @vitalyl1327 3 หลายเดือนก่อน +1

      @@dario.lencina we're talking about a very specific language property here. Rust is far out of this kind of domain. Java is somewhat (poorly) applicable.

  • @curio78
    @curio78 หลายเดือนก่อน +1

    Why do you think Rust is faster? Java eventually compiles to native too. the difference really is between having a garbage collector or not.

    • @dario.lencina
      @dario.lencina  หลายเดือนก่อน

      Hey Curio, you are absolutely right the GC is a big differentiator, also the fact that Java does not run on bare metal, it runs in a VM, an efficient VM but a Vm nevertheless

    • @curio78
      @curio78 หลายเดือนก่อน +1

      @@dario.lencina not quite .. java VM is simply a compiler to native code at runtime. the VM its self actually makes run time optimizations to native code generated at run time .. something pre compiled languages can never do. Making at times java run faster than any default optimize C or rust. The difference is only with the garbage collectors. which is on one have an advantage for server workloads while on the other a disadvantage in synthetic benchmarks.
      To expand on this.. java.. gc approach make per execution faster. If implemented correctly. as it does not need to release memory in that workload. But in syntethic bench marks when pushed 100% it suffers a bit. And what I mean by implemented correctly is knowing how java objects are created and its identity concept.
      All this should be moot once value objects should show up in java 24. removing identity constraint on objects. After that.. no pre compile language can hope to match java in performance. For me the current work around is primitive, and was hoping for the universal generics to solve the OOP clean design approach for primitives(well may not be necessary with value objects). Infact every library out there is waiting and waiting for that change to be finished. 8 years and still waiting. You will see most libraries rewritten to take advantage of the performance boost from it.

    • @dario.lencina
      @dario.lencina  หลายเดือนก่อน

      I am sure that Java will just keep better and better, personally I love both programming languages

    • @curio78
      @curio78 หลายเดือนก่อน

      @@dario.lencina is it me imagining or is youtube deleting most of my comments. feels like I am censored.

    • @dario.lencina
      @dario.lencina  หลายเดือนก่อน

      @curio78 I see your comments

  • @dario.lencina
    @dario.lencina  ปีที่แล้ว +1

    Here's my cheatsheet so that you can follow along! security-union.github.io/rust-vs-java/

  • @rjScubaSki
    @rjScubaSki 2 หลายเดือนก่อน +1

    The problem with Java is the library ecosystem and the programmer community. Spring Boot has turned Java into an annotation hellscape, where all objects are effectively static singletons that you can hack around a bit, and the majority of the Java cult are completely incapable of doing anything but cargo cult awful patterns they find in tutorials. Java the language maybe improving but there needs to be a complete repudiation of the current awful dominant stack, and all the competitors that feel the need to ape it. I do like Rust, but I think the majority of programmers will howl in anguish at having to understand the lifetimes of memory and the type system means people will get lost. I honestly think we will all end up being forced into Go, with its Luddite language design and dreadful error handling, just because the Java community is unwilling to instantiate objects and admit that magic frameworks achieve nothing but confusion.

    • @cosmowanda6460
      @cosmowanda6460 หลายเดือนก่อน +1

      In your entire reply, there are a few sentences where I could replace "java" with "rust" and still have a very valid argument.

    • @rjScubaSki
      @rjScubaSki หลายเดือนก่อน +1

      @@cosmowanda6460 Tokio trauma?

    • @michimarz
      @michimarz หลายเดือนก่อน

      You don't need to use Spring. Just rely on Java standards.

    • @rjScubaSki
      @rjScubaSki หลายเดือนก่อน +1

      @@michimarz Actually try that with any plausibly assembled group of Java programmers and you will get howls of anguish. It would be easier to force a new language on them than make them give up the ability to mindlessly paste spring shite from Baeldung into your codebase.

    • @michimarz
      @michimarz หลายเดือนก่อน +1

      @@rjScubaSki That's an interesting issue. I'm not very familiar with management habits at modern software companies, but isn't there any civilised way to force or encourage your own employees to obey the rules you set for the projects your company carries out?

  • @doylemcguire1588
    @doylemcguire1588 ปีที่แล้ว +1

    Promo sm 😩

  • @atheistbushman
    @atheistbushman 3 หลายเดือนก่อน +1

    I find Kotlin much more productive and elegant than Java

    • @dario.lencina
      @dario.lencina  3 หลายเดือนก่อน +2

      Aw mate that is a fact, I think I should do Kotlin vs Rust it is a much fair fight

    • @atheistbushman
      @atheistbushman 3 หลายเดือนก่อน

      @@dario.lencinaThat would be great! There is active development of "kotlin native" thus no need for the JVM
      I read that Ktor (a HTTP server) can be compiled to navive binaries - but I have not tried it yet.

    • @vencedor1774
      @vencedor1774 3 หลายเดือนก่อน +1

      @dario.lencina kotlin's just Java but typed differently

    • @dario.lencina
      @dario.lencina  3 หลายเดือนก่อน

      @vencedor1774 hey mate, I think that it is another jvm language and they do share similarities, but my understanding is that it does provide very unique features!

    • @atheistbushman
      @atheistbushman 3 หลายเดือนก่อน

      @@vencedor1774 Null safety does not exist in Java

  • @maximstepanenko
    @maximstepanenko หลายเดือนก่อน +2

    Very incompetent developer. Why are you using ConcurrentLinkedQueue if you should use some favour of BlockingQueue? In java there is no dangling pointer at all, you did typical thing called even in cpp world - aliasing. Gents, don’t watch videos of super duper principals, who learned languages using youtube tutorials themselves.

  • @ahuramazda9202
    @ahuramazda9202 ปีที่แล้ว +2

    A nonsensical and trivial comparison, and of course wrong.

    • @dario.lencina
      @dario.lencina  ปีที่แล้ว +1

      Lol, thanks for your feedback son, time to go eat your Java Beans 🫘

  • @michaelutech4786
    @michaelutech4786 5 หลายเดือนก่อน

    "Arc" is exactly why I strongly dislike Rust. I know how semaphores work, I know how automatic reference counting works. This looks like a type declaration, but I have no idea what "Arc" actually is. I know some 20 programming languages and cannot even guess what this is.
    I can see how you can get to love Rust just by using it long enough. Just like with Objective-C or perl. But is that really necessary? Why are these guys making it so hard? Objective-C did it because it comes from C and Smalltalk, no wonder the result is strange. Perl comes from the shell, awk and regexp - ok, get it. What is Rust's excuse?

    • @dario.lencina
      @dario.lencina  5 หลายเดือนก่อน +2

      Rust's excuse? Well, it's kind of like that eccentric genius at a party who insists on explaining quantum mechanics after a few too many drinks. It's trying to keep everyone safe and sound while wielding the power of concurrency without shooting itself in the foot. "Arc" is Rust's way of saying, "I can handle sharing this data safely across threads, trust me." And "Mutex"? Well, that's its way of locking the cookie jar so no one gets their hand stuck.
      In essence, Rust is trying to give you the best of both worlds: the performance of low-level programming with the safety of high-level abstractions. Sure, it’s a bit like learning to juggle flaming swords at first, but once you get the hang of it, you'll be amazed at how much safer and faster your programs can be. Plus, it’s a great conversation starter at parties-if you're into that sort of thing.

    • @michaelutech4786
      @michaelutech4786 5 หลายเดือนก่อน +2

      @@dario.lencina The Mojo guys are copying a lot from Rust and seem to be getting a far better result simply by choosing better defaults and taking better care for naming and keeping the syntax clean. I don't think that Rust is conceptually hard to understand, not compared to what such complexities buy you in terms of security. What bothers me is that it's often unnecessarily cryptic and quirky.
      I'm not a Rust expert, so my judgement may be flawed. But in this concurrency example, there seem to be three ways of handling it: (1) don't and expose the OS interface (2) create an intuitive abstraction (f.e. GCD, MQ, coroutines, ...) or (3) invent some quirky wrappers and name everything cryptically while mixing (1) and (2), which seems to be the Rust way.
      But that also exposes a problem with memory management. Once you impose a management paradigm, you just have to also manage everything that depends on memory management. That in turn is excessively difficult, because something like concurrency has many different solutions with very different properties that you would have to cover in a way that either hides the differences or makes it really complicated to use.
      But again, I might be overly critical and just would need some more time spent with Rust to appreciate it. I just cannot bring myself to like it - yet.

    • @Andrew-jh2bn
      @Andrew-jh2bn 3 หลายเดือนก่อน +1

      I mean, this is syntax for a "generic", almost identical to what is used in Java and c++. Granted, rust does tend to use genetics more than Java does.

    • @dario.lencina
      @dario.lencina  3 หลายเดือนก่อน +1

      Yes, people do use channels to do message passing as opposed to arc mutex as much as possible

    • @michaelutech4786
      @michaelutech4786 3 หลายเดือนก่อน

      @@Andrew-jh2bn "this is syntax for generic" - I don't mind the syntax (in this example). In this example, the problem is that I look at "Arc" and I don't understand why I should ever write this code. A mutex is something the OS or a runtime uses to obtain mutually exclusive access to something. I'm not choosing what type a mutex is, it's the OS, a runtime, the language or whatever implements mutual access. Reference counting is a garbage collection method, one of the faster versions. I didn't know Rust is doing GC. But even if so, if Rust is doing GC, why do I have to provide a mutex? Why do I need an instance of a RC? It's either manual or automatic. If it's manual, I have to do it, if it's automatic then the tool does it. This seems to be both.
      I'm certain there are good reasons for all of that and there will be good answers to my questions that will make my questions look stupid. All I had to do is to learn Rust in depth and get used to it and everything would be clear. Just like in C++, Perl and Objective-C or even in Assembler. I went through that process many times.
      Right now I'm learning Zig, and there too you have to learn your letters. But until you're getting there, you can just read code and usually when you look at Zig code, you just understand it. You don't need to come up with "Arc", at worst you need an "Allocator". I look at this word and I immediately understand what it is. I also immediately understand the idea behind passing an allocator to a function. That makes sense, give the code a tool to allocate memory instead of letting the function choose how to malloc something.
      Borrowing does not work in a multi threaded context. I understand that. So in Rust you have to drag out your data from the borrowing chain to concurrently use it. Ok fine. But how is this "Arc" object, sorry we don't do object, the thingy, how is it helping me there? I just remove the automatism (borrowing), so I'm using a reference counting GC now? Ok, why not. But how? This is a whole lot of questions that a piece of code does not have any answers to.
      In Java, you enclose something in a synchronized block on any object, ok. In JS, you only have one thread, ok. In Obj-C you have ARC and dispatch and Obj-C takes care of it. In C you do it yourself. In all of these environments, concurrency is hard to do (right) but easy to understand. In Rust it's still hard to do after it was hard to understand.
      (Don't want to bicker here, just trying to make my point clear)

  • @ievgenmajor3301
    @ievgenmajor3301 3 หลายเดือนก่อน +2

    Not only OpenJdk, but also Temurum, Coreto and others

    • @dario.lencina
      @dario.lencina  3 หลายเดือนก่อน

      I do over Corretto which is the Amazon jdk, pretty amazing stuff!!

  • @ievgenmajor3301
    @ievgenmajor3301 3 หลายเดือนก่อน +1

    FlameGraph shows call stack, not object references.

    • @dario.lencina
      @dario.lencina  3 หลายเดือนก่อน

      I think you can do both allocations and call stacks mate

  • @igorshingelevich7627
    @igorshingelevich7627 6 หลายเดือนก่อน +1

    Good one!

    • @dario.lencina
      @dario.lencina  6 หลายเดือนก่อน

      Thanks mate

    • @dario.lencina
      @dario.lencina  6 หลายเดือนก่อน

      Is there anything you wish I covered?