Java is slow and verbose (or so they say)

Ғылым және технология

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 ❤️

Пікірлер: 102

  • @zombi1034
    @zombi10342 ай бұрын

    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.

  • @oskar9136
    @oskar91362 ай бұрын

    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

    2 ай бұрын

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

  • @GreatTaiwan

    @GreatTaiwan

    2 ай бұрын

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

  • @jazzycoder

    @jazzycoder

    2 ай бұрын

    @@GreatTaiwan you can add lombark manually though

  • @lufenmartofilia5804

    @lufenmartofilia5804

    2 ай бұрын

    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.

  • @asdrubalzp
    @asdrubalzp2 ай бұрын

    Great demo Dan! Greetings from Ecuador

  • @jazzycoder
    @jazzycoder2 ай бұрын

    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!

  • @KangoV
    @KangoV2 күн бұрын

    Records can also be declared inside a method

  • @NetImperia
    @NetImperia2 ай бұрын

    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.

  • @lifeisgoodoutdoors2680
    @lifeisgoodoutdoors268013 күн бұрын

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

  • @fredericolivier7896
    @fredericolivier78962 ай бұрын

    I still prefer writing the types I never use var.

  • @HandledToaster2

    @HandledToaster2

    2 ай бұрын

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

  • @railroadman2k

    @railroadman2k

    2 ай бұрын

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

  • @deeplife9654

    @deeplife9654

    2 ай бұрын

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

  • @illyam689

    @illyam689

    2 ай бұрын

    Also, var can be dangerous

  • @user-qm2uo6ht5l

    @user-qm2uo6ht5l

    2 ай бұрын

    @@illyam689it can never be dangerous

  • @RondellKB
    @RondellKB2 ай бұрын

    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

    2 ай бұрын

    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

    2 ай бұрын

    @@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

    2 ай бұрын

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

  • @RondellKB

    @RondellKB

    2 ай бұрын

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

  • @juancarlospizarromendez3954
    @juancarlospizarromendez39542 ай бұрын

    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.

  • @bbbbshoow6702
    @bbbbshoow67022 ай бұрын

    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

    2 ай бұрын

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

  • @bbbbshoow6702

    @bbbbshoow6702

    2 ай бұрын

    @@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

    2 ай бұрын

    ​@@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

  • @haroldpepete
    @haroldpepete2 ай бұрын

    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

    2 ай бұрын

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

  • @GafarOlanipekun

    @GafarOlanipekun

    2 ай бұрын

    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

    2 ай бұрын

    @@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
    @punekarinwinnipeg2142 ай бұрын

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

  • @RomanTchekashov

    @RomanTchekashov

    2 ай бұрын

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

  • @DanVega

    @DanVega

    2 ай бұрын

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

  • @melmartinez7002
    @melmartinez70022 ай бұрын

    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.

  • @richardbenes9
    @richardbenes92 ай бұрын

    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

    2 күн бұрын

    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)

  • @MichalGebauer
    @MichalGebauer2 ай бұрын

    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.

  • @juancarlospizarromendez3954
    @juancarlospizarromendez39542 ай бұрын

    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.

  • @DamLee88
    @DamLee882 ай бұрын

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

  • @dhineshbabu9376
    @dhineshbabu93762 ай бұрын

    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..

  • @ellkana
    @ellkana2 ай бұрын

    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.

  • @avalagum7957
    @avalagum79572 ай бұрын

    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 😜

  • @adambickford8720
    @adambickford87202 ай бұрын

    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.

  • @carlosabreu5012
    @carlosabreu50122 ай бұрын

    lombok

  • @birandkoray
    @birandkoray2 ай бұрын

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

  • @DanVega

    @DanVega

    2 ай бұрын

    Exactly!

  • @Skiamakhos

    @Skiamakhos

    2 ай бұрын

    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

    2 ай бұрын

    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

  • @coderlady_
    @coderlady_2 ай бұрын

    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

    2 ай бұрын

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

  • @coderlady_

    @coderlady_

    2 ай бұрын

    @@avalagum7957 mostly use javascript

  • @ichigo_kurosaaki
    @ichigo_kurosaaki2 ай бұрын

    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".

  • @jeevaathecoder
    @jeevaathecoder2 ай бұрын

    Why Everyone uses python for AI/ML?

  • @adambickford8720

    @adambickford8720

    2 ай бұрын

    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

    2 ай бұрын

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

  • @user-qm2uo6ht5l
    @user-qm2uo6ht5l2 ай бұрын

    spring boot is slow though takes 1 min to start …

  • @Muescha
    @Muescha2 ай бұрын

    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

    2 ай бұрын

    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)

  • @binio28
    @binio282 ай бұрын

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

  • @harisahmad7871
    @harisahmad78712 ай бұрын

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

  • @GafarOlanipekun

    @GafarOlanipekun

    2 ай бұрын

    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

  • @smidimir
    @smidimir2 ай бұрын

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

  • @pablovaldes6022
    @pablovaldes60222 ай бұрын

    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

    2 ай бұрын

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

  • @pablovaldes6022

    @pablovaldes6022

    2 ай бұрын

    Time to change that

  • @quocdattranquoc1832
    @quocdattranquoc18322 ай бұрын

    Haha, @Lombok make Java not verbose

  • @scrumtuous
    @scrumtuous2 ай бұрын

    My two cents? Java isn't verbose enough!

  • @DanVega

    @DanVega

    2 ай бұрын

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

  • @Lutz64
    @Lutz642 ай бұрын

    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

    2 ай бұрын

    Then Scala is the winner 🙂

  • @JamesStansell

    @JamesStansell

    2 ай бұрын

    2 orders of magnitude difference in line count - seems nutty

  • @Lutz64

    @Lutz64

    2 ай бұрын

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

  • @GafarOlanipekun

    @GafarOlanipekun

    2 ай бұрын

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

  • @avalagum7957

    @avalagum7957

    2 ай бұрын

    @@GafarOlanipekundefine "know"

  • @deeplife9654
    @deeplife96542 ай бұрын

    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

    2 ай бұрын

    Grow up then

  • @deeplife9654

    @deeplife9654

    2 ай бұрын

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

  • @deeplife9654

    @deeplife9654

    2 ай бұрын

    @@sylvereleipertz955 you grow up

  • @peshutanpavri1599
    @peshutanpavri15992 ай бұрын

    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

  • @ITksh-zp1ob
    @ITksh-zp1ob2 ай бұрын

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

  • @haroldpepete
    @haroldpepete2 ай бұрын

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

  • @kelvinnjuguna349
    @kelvinnjuguna3492 ай бұрын

    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

    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

    2 ай бұрын

    @@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

    2 ай бұрын

    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

    2 ай бұрын

    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..

Келесі