Java is slow and verbose (or so they say)

Sdílet
Vložit
  • čas přidán 5. 03. 2024
  • In this tutorial we will take a look at the misguided claims that Java is slow and verbose.
    🔗Resources & Links mentioned in this video:
    GitHub Repo: github.com/danvega/java-verbo...
    👋🏻Connect with me:
    Website: www.danvega.dev
    Twitter: / therealdanvega
    Github: github.com/danvega
    LinkedIn: / danvega
    Newsletter: www.danvega.dev/newsletter
    SUBSCRIBE TO MY CHANNEL: bit.ly/2re4GH0 ❤️
  • Věda a technologie

Komentáře • 106

  • @oskar9136
    @oskar9136 Před 5 měsíci +19

    In my opinion the verbosity of Java makes it more understandable, at least in the beginning when you are learning Java.
    Sure writing out getters and setters and constructors may be a lot of code.
    But seeing that getUsername is just a method that returns a field from the class and doesn't take a parameter (unless you want it to) made it so I could see patterns and understand the syntax better.
    When you improve and understand the language even further then I think you can take shortcuts. It's always a trade off of course. That's just my two cents.

    • @jazzycoder
      @jazzycoder Před 5 měsíci +1

      And no one actually writes getter and setters ... just generate them with the IDE 😁

    • @GreatTaiwan
      @GreatTaiwan Před 4 měsíci +1

      @@jazzycoder lombok or not even those spring got it in the framework

    • @jazzycoder
      @jazzycoder Před 4 měsíci

      @@GreatTaiwan you can add lombark manually though

    • @lufenmartofilia5804
      @lufenmartofilia5804 Před 4 měsíci +1

      Who uses lombok and type getters and setters in 2024... any ide can generate them for you in a single click or shortcut. At least intellij, vscode, eclipse can.

  • @zombi1034
    @zombi1034 Před 5 měsíci +6

    Java is by far my favorite language. I just love how many things you can do with Java, be it writing a web service or a desktop app and it is even cross platform thanks to the incredible JVM. Also the vast amount of great frameworks and tools that we have at our disposal really helps a lot in building good and reliable software.

  • @jazzycoder
    @jazzycoder Před 5 měsíci

    I love this video! Someone has needed to make this video for a long while and you are the man to get the business done... thank you!

  • @asdrubalzp
    @asdrubalzp Před 5 měsíci +4

    Great demo Dan! Greetings from Ecuador

  • @fredericolivier7896
    @fredericolivier7896 Před 5 měsíci +26

    I still prefer writing the types I never use var.

    • @HandledToaster2
      @HandledToaster2 Před 5 měsíci +6

      Same, but I like using it in unit tests to keep things simpler.

    • @railroadman2k
      @railroadman2k Před 5 měsíci

      Well look if it obvious type not generic just simple type why not use ir

    • @deeplife9654
      @deeplife9654 Před 5 měsíci +3

      Me too , why we need to make everything super easy ? 😢. Modern java is cool and enough

    • @illyam689
      @illyam689 Před 5 měsíci +1

      Also, var can be dangerous

    • @user-qm2uo6ht5l
      @user-qm2uo6ht5l Před 5 měsíci

      @@illyam689it can never be dangerous

  • @NetImperia
    @NetImperia Před 5 měsíci +9

    From my experience. Projects where Java was slow. There were errors in the architecture. And choosing the wrong libraries. In almost all such projects, there were a lot of abstractions and widespread use of Hibernate where it was not needed...
    Java itself is very fast. But different libraries slow it down very much.

    • @oumardicko5593
      @oumardicko5593 Před měsícem +1

      I have a very lightweight library that i made for myself and use for work. It's not that the language itself is slow, but it's all additional stuff: build steps (not even talking how much of a nightmare those build tools are), memory usage, a bloatware ide, slow build time, the clean code madness. It's freaking annoying

  • @RondellKB
    @RondellKB Před 5 měsíci +3

    I was going to post this before watching the video, but you said it while I was posting lol.
    The only people who say Java is verbose are people who: 1. Have not touched or followed the language in years. Or 2. Have never or barely used the language but read regurgitated nonsense online and then decide they hate the language.

    • @Noam-Bahar
      @Noam-Bahar Před 5 měsíci +1

      So far I've only encountered Java and C# when I learned programming and computer science. In hindsight they were both the best languages for me as a beginner. Both high level languages like JS and Python, and low level langs like C, are too confusing for beginners like me.

    • @RondellKB
      @RondellKB Před 5 měsíci +1

      @@Noam-BaharThe thing about languauges like Python is you can learn it fast, but it hides a lot of stuff, whereas C forces you to do everything on your own. I think languages like Java and C# are the sweet spot.

    • @illyam689
      @illyam689 Před 5 měsíci +1

      These individuals are also known for composing nonsensical one-liners in Scala and labeling them as 'clean code'.

    • @RondellKB
      @RondellKB Před 5 měsíci +1

      @@illyam689This is exactly the sort of thing I'm talking about. Concise != more readable.

  • @lifeisgoodoutdoors2680
    @lifeisgoodoutdoors2680 Před 2 měsíci +1

    New to Java here. Excited! What flavor of Java are people using? Amazon Correto? Microsoft build of Java?

  • @haroldpepete
    @haroldpepete Před 5 měsíci +3

    i think java is a modest language, meanwhile spring is a great framework, one of the most used it out there, java lives thank to spring, that's all

    • @sylvereleipertz955
      @sylvereleipertz955 Před 5 měsíci +1

      That's the same for every language. You don't do pure javascript or php either

    • @GafarOlanipekun
      @GafarOlanipekun Před 5 měsíci +1

      I understand you, because it is difficult for you to understand Java right? Java is still best programming language out there. Any langugage you know i can start writing it professionally in 5hours can you say that to Java

    • @haroldpepete
      @haroldpepete Před 5 měsíci

      @@GafarOlanipekun i have worked like a spring developer, java is easy to understand, for your information, i know a lot un languages including front and back, i love rails, ruby, .net, .net core and nodejs. i think the best is rails, monster language, you can do amazing things

  • @punekarinwinnipeg214
    @punekarinwinnipeg214 Před 5 měsíci

    How are you displaying the shortcut content in intellij? What is the plugin name ?

    • @RomanTchekashov
      @RomanTchekashov Před 5 měsíci

      He has GitHub copilot but you have to be accepted by jetbrains;( Alternatives: Codeium + CodiumAI plugins

    • @DanVega
      @DanVega  Před 5 měsíci +1

      This is built into the iDE now. appearance and behavior > presentation assistant

  • @juancarlospizarromendez3954
    @juancarlospizarromendez3954 Před 4 měsíci

    About setters and getters, Groovy has the magic of that they are implicit, and to specify explicitly then when are needed. And for Java, it seems no good having a boiler plate of same setters and getters for each class in the system.

  • @KangoV
    @KangoV Před 2 měsíci

    Records can also be declared inside a method

  • @bbbbshoow6702
    @bbbbshoow6702 Před 5 měsíci

    hello Mr Dan , great tutorial , i was wondering if you could make a video about java specification and implantation , specially the compatibility part with tomcat , i struggle a lot in every project to figure our how to choose the correcte set of dependencies that will be compatible with my server , and thanks in advance 😍😍

    • @illyam689
      @illyam689 Před 5 měsíci

      WTF just use Spring Boot with embedded Tomcat, it's not 2007 anymore

    • @bbbbshoow6702
      @bbbbshoow6702 Před 4 měsíci

      @@illyam689 hello , i am just trying to learn thing far more from they abstraction of frameworks . Thanks for the advice i will go to spring after that

    • @illyam689
      @illyam689 Před 4 měsíci

      ​@@bbbbshoow6702my suggestion is to keep things simple and focus on the most important ones. If you want to have something up and running quickly, just use Spring Boot

  • @stephaneislistening6103
    @stephaneislistening6103 Před 2 měsíci

    Dan rules !

  • @richardbenes9
    @richardbenes9 Před 4 měsíci

    Nice video. But I miss comparison with Java's competitors.
    Why would Java's conciseness matter if there was yet better option?
    I feel like most of the "oh why do I have to type it all" feelings originate, in my case, from error handling. I like to have only the "happy path" in the "main code", and all the error handling stuff in background. Algebraic data types and the "?" operator, that are available in Rust (not that Rust would be perfect), feel to me like a huge helpers in this regard.
    And records are a nice addition. However, I do still prefer Lombok. It seems more customizable.. But a real, thorough comparison would be useful.

    • @sylvain-k
      @sylvain-k Před 2 měsíci

      At least Lombok allows to get : mutable class with fluent chained setters (or immutable with @Value and convenient @Builder(toBuilder = true) if needed), extendable class.
      Record blocks all of these (cannot inherit and cannot be inherited, manual construction if need to create a new object from an existing one and with some values changed)

  • @melmartinez7002
    @melmartinez7002 Před 4 měsíci

    Modern Java, given all the syntactical sugar they've added since around JDK16, can be pretty concise - yet still retains Java's signature clarity and determinism.

  • @ellkana
    @ellkana Před 5 měsíci +1

    Imo, java 21 is the best of all and matured enough. but the number surely scared the students to start fresh. what happens in the next 20 years ? java 40 ? perhaps can be rename to something fresh like jakarta instead. idk.

  • @juancarlospizarromendez3954
    @juancarlospizarromendez3954 Před 4 měsíci

    Dan Vega, HashSet internally uses HashMap to store it's elements instead of its own similar implementation. Due to it,Java it is not being optimized.

  • @dhineshbabu9376
    @dhineshbabu9376 Před 4 měsíci

    I tried many languages and developed tools in most of them. To be honest, understanding java code is faster for me than other less verbose languages. But it is just my point of view..

  • @DamLee88
    @DamLee88 Před 5 měsíci

    they're probably TypeScript or React developer or other fancy framework

  • @adambickford8720
    @adambickford8720 Před 5 měsíci

    Records cover such a small surface area in use cases to be a non-factor for me. In real code I want named args, not positional ones. Without lombok you're looking at 90s levels of boilerplate to create a fluent builder. And at the end you still have the 'builder()' and 'build()' cruft.
    Take a record with 10 properties and then 'change' one. We're once again back to 1900s boilerplate with error prone positional arguments as we're still lacking a simple with/copy function.
    We're getting there, but it's way too early to declare victory. And the other languages aren't sitting still.

  • @avalagum7957
    @avalagum7957 Před 5 měsíci +1

    Verbosity is like beauty: it's in the eyes of the beholder. For example, Dan Vega is handsome in his wife's eyes. In Miss Universe's eyes, he's... at the same level with me 😜

  • @oumardicko5593
    @oumardicko5593 Před měsícem

    the issue is not being able to write very performent java or not. when you go to a real world scenario with deadlines and all the other parameter we can all agree, most of the time people just wanna get the job done.
    You add to that:
    1. slow build time
    2. unnecessary complexity (ex: building java project is probably one of the worst part of the language)
    3. HUUUUGE memory footprint
    4. When using a library, you need to be a detective because they are not straight forward most of the time.
    5. Documentations feels like autocomplete in an IDE
    6. Gradle (a category on its own), such a freaking pain to deal with
    the ecosystem is great with good libraries, but you will never be able to convince a c# developer to use java or the opposite might be possible

  • @jeevaathecoder
    @jeevaathecoder Před 5 měsíci

    Why Everyone uses python for AI/ML?

    • @adambickford8720
      @adambickford8720 Před 5 měsíci

      Thats generally researchers, not programmers. They are doing a lot more iterative/exploratory 1-off kind of stuff. Languages like java bring too much 'accidental complexity' to that domain.

    • @masterofIich
      @masterofIich Před 5 měsíci

      Mostly because is not static typed and easy to wrap c code which all of the ML source code is written in anyway.

  • @Muescha
    @Muescha Před 4 měsíci

    i have done a step by step replay: at 05:48 I get a "java.lang.ClassNotFoundException: Application" and also there is no "target" dir. A "Build Project" also not generated the output dir. I need to do a "maven: recompile" to get the dir. Code changes are not visible when I rerun. I fixed it with manualy adding to the Run Configuration: "Modify options / Before Launch / Add before launch Task" and then "Before Launch / Run Maven Goal: Compile"

    • @Muescha
      @Muescha Před 4 měsíci

      I am somehow confused why I need to add this manually (IntelliJ IDEA 2024.1 Beta (Ultimate Edition) Build #IU-241.14494.17, built on March 6, 2024)

  • @ichigo_kurosaaki
    @ichigo_kurosaaki Před 5 měsíci +1

    I feel at the end of the day, Java is just a tool, it's the programmers who can't use it properly or are too stuck up with their opinionated mindset that say nonsense like "Java is Bad".

  • @carlosabreu5012
    @carlosabreu5012 Před 5 měsíci +2

    lombok

  • @coderlady_
    @coderlady_ Před 5 měsíci +1

    whenever I say that I'm using java, most devs laugh at me, one just said: I would rather use kobol but never use java, java is for caveman!

    • @avalagum7957
      @avalagum7957 Před 5 měsíci +1

      What are those devs using? If they're not using a JVM language, does their languages have something like Java virtual threads?

    • @coderlady_
      @coderlady_ Před 5 měsíci

      @@avalagum7957 mostly use javascript

  • @user-qm2uo6ht5l
    @user-qm2uo6ht5l Před 5 měsíci

    spring boot is slow though takes 1 min to start …

  • @harisahmad7871
    @harisahmad7871 Před 5 měsíci +2

    Stop living in denial, Java is verbose and it has its own advantages and disadvantages

    • @GafarOlanipekun
      @GafarOlanipekun Před 5 měsíci

      you like it or not you know java you already know all the programming language in proxy . whenever you are interested in other language as java developer. it will only take you few weeks to master. knowing other language first you will still find it difficult to understand java

  • @quocdattranquoc1832
    @quocdattranquoc1832 Před 5 měsíci +1

    Haha, @Lombok make Java not verbose

  • @birandkoray
    @birandkoray Před 5 měsíci +3

    if it were slow and verbose, would 3 billion devices run Java? :D

    • @DanVega
      @DanVega  Před 5 měsíci

      Exactly!

    • @Skiamakhos
      @Skiamakhos Před 5 měsíci

      Actually, yeah, because when Java started in the 1990s it was the only language that would run on anything that had a JVM. That was a huge advantage. C projects had to be compiled specifically for the target machine. Assembly language had a different dialect for different chips, and you'd need device drivers for anything outside the CPU. Where Java was historically slow was at start-up but if your machine is a web server or a vending machine or a helicopter it doesn't matter much if it takes 3 seconds to start the program: as long as it processes data correctly and swiftly once it has started, which it mostly did. Verbosity is very much a secondary problem: when your IDE has shortcuts for everything you learn the shortcuts, like sout for System.out.println() etc, and we've been using Lombok for years now to do what Dan just did with records. Lombok allows you to control whether you're using setters or a builder, and you can override the annotations for debugging purposes if need be, or if you need to incorporate rules in setters etc.
      Sure, Java was slow to start and verbose, but it was available on everything very quickly, and its verbosity often meant it was very readable. Bob Martin's "Clean Code" often sacrifices succinctness for readability. We're encouraged to use long, meaningful class, method & variable names such that comments aren't needed. We use descriptive commit messages that link to well written JIRA tickets too, so the question "What the hell was [long departed developer] thinking?" is usually 2 or 3 clicks away. Compare with Perl, which was easy as pie to write but looked like line noise when you came back to it in 6 months.

    • @GafarOlanipekun
      @GafarOlanipekun Před 5 měsíci

      speak of secuirty, multiprocessing, and standard memory and error management talked about Java. As someone who has used Java, kotlin and javasscript and typescript I can tell you Java is far better than them all. You can't use Javascript built backend service in a bank and be confident that big issue will not happen. infact no one will allow you, use another language except java

  • @smidimir
    @smidimir Před 5 měsíci

    Thanks, kotlin and other modern languages, for giving java homework to copy from. Java might be even half way there

  • @MichalGebauer
    @MichalGebauer Před 5 měsíci

    I use java (and love it), javascript and groovy and I do agree java is very verbose. The new features you mentioned partially mitigate some verbosity but I still see no significant difference. As an example, I use Lombok and therefore records don't have effect on amount of my code. The most significant difference for me is visible in data driven development. What I miss in Java is something like object literal that is present in javascript and partially in groovy. I love your channel but I do not agree persuading developers (with real experience) that java isn't verbose is the way to go. We should rather accept reality and aim for future improvements.

  • @binio28
    @binio28 Před 5 měsíci +1

    Its too verbose... I hear this through whole my professional life

  • @Lutz64
    @Lutz64 Před 5 měsíci +1

    Java becomes awful when annotations are used. anytime java in used for anything, thousands of lines of code and many 10s of objects are created for the sake of OO for something that doesn't do much. the only good thing about java is the ecosystem. C# is mildly better as a language except everything in the MS ecosystem is broken. A 10K lines of java can be rewritten into several hundred lines of go code (which is also very short lines)

    • @avalagum7957
      @avalagum7957 Před 5 měsíci

      Then Scala is the winner 🙂

    • @JamesStansell
      @JamesStansell Před 5 měsíci

      2 orders of magnitude difference in line count - seems nutty

    • @Lutz64
      @Lutz64 Před 5 měsíci +1

      @@JamesStansell go does not have objects, it only has structs from C. It is basically C with conveniences and garbage collection.

    • @GafarOlanipekun
      @GafarOlanipekun Před 5 měsíci +2

      then you don't know Java. use of the langugae only depend on the person not the language

    • @avalagum7957
      @avalagum7957 Před 5 měsíci

      @@GafarOlanipekundefine "know"

  • @ITksh-zp1ob
    @ITksh-zp1ob Před 4 měsíci

    slow.... compare with what ? JS ? x10 faster, python x10 faster.
    verbose - plain sources or bytecode? if sources, what so?

  • @vijayjangid8967
    @vijayjangid8967 Před 2 měsíci

    I earn 60 thousand monthly but I don't wear Zudio 😂

  • @scrumtuous
    @scrumtuous Před 4 měsíci +1

    My two cents? Java isn't verbose enough!

    • @DanVega
      @DanVega  Před 4 měsíci

      You can write verbose code in any language. Thanks for coming to my TedTalk Darcy 👋🏻

  • @peshutanpavri1599
    @peshutanpavri1599 Před 4 měsíci

    Java is not verbose, It's actually even less verbose than Kotlin in many aspects if understood properly there are just lots of really bad code with awful 5 word classes, I am working on a new framework server side, I am trying to address this

  • @pablovaldes6022
    @pablovaldes6022 Před 5 měsíci

    In 2024 a language that doesn't warn you or stop you from accessing a possible null value, should just not be considered for a serious project.

    • @sylvereleipertz955
      @sylvereleipertz955 Před 5 měsíci +1

      Java, javascript, php, c, c++ but ok. The entire world is running on language that do permit it

    • @pablovaldes6022
      @pablovaldes6022 Před 5 měsíci

      Time to change that

  • @deeplife9654
    @deeplife9654 Před 5 měsíci +1

    If you thinks that Java is hard , then do not be a backend coder. go to code frontend. I am too much pissed off people making fun of my Java.

    • @sylvereleipertz955
      @sylvereleipertz955 Před 5 měsíci

      Grow up then

    • @deeplife9654
      @deeplife9654 Před 5 měsíci

      @@sylvereleipertz955 Java is the reason that I code. lolz. so, thanks you. Java is hard at beginning but becomes most beautiful later

    • @deeplife9654
      @deeplife9654 Před 5 měsíci

      @@sylvereleipertz955 you grow up

  • @haroldpepete
    @haroldpepete Před 5 měsíci

    your billion is 1.000 millions, for rest of the world a billion is 1.000.000 of millions

  • @kelvinnjuguna349
    @kelvinnjuguna349 Před 5 měsíci

    Tbh, the only reason I don't use Java (& c#) as much is because the length of `System.out.println` traumatized me in college. Every other language just says `print`. Also OOP just isn't beginner friendly. Java makes students dislike it from the start since students just want to build without focusing too much on architecture. Sure, Java 21 addresses some of the non-beginner friendly parts of Java. But people know that the companies that use Java don't have Java 21 unfortunately

    • @DanVega
      @DanVega  Před 5 měsíci +2

      I can't remember the last time i actually had to type that out. In IntelliJ i type out sout-> which turns into that or there is also a postfix completion for it. Seems like a silly reason not to use a language.

    • @kelvinnjuguna349
      @kelvinnjuguna349 Před 5 měsíci

      @@DanVega You can choose to call it silly but those points are why many CS students leaving college don't like the language. Luckily, Java is addressing them after realizing that Kotlin is slowly chipping away at Java work in the back end of many companies

    • @sylvereleipertz955
      @sylvereleipertz955 Před 5 měsíci

      Any IDE will write it for you. Or you could just create another static method to encapsulate the original one. Out.print() for exemple. You're welcome

    • @khmarbaise
      @khmarbaise Před 4 měsíci

      Functional programming has been introduced with JDK 8 (2014!! a decade ago en.wikipedia.org/wiki/Java_version_history)... And the real question is: How often have you written "public static void main(..)" in a real project (I simply don't know it anymore).. (also the hint by @DanVega your IDE) ? and in the meantime many companies have changed to JDK11 or even JDK17... a few to JDK21.. yes of course it takes time... (while at 19.03.2024 JDK22 will released; The pressure increased)..
      The cause for disliked might be also based on the teacher or ways of teaching many students have reported that..