Lets Refactor this Telegram Bot To Use Generics | Code Review #3

Поділитися
Вставка
  • Опубліковано 8 січ 2025

КОМЕНТАРІ • 116

  • @amigoscode
    @amigoscode  2 роки тому +6

    Get NordVPN exclusive deal here: nordvpn.com/amigoscode Try it risk-free thanks to their money-back guarantee!
    Join the community here: amigoscode.com/p/join-community

    • @mitensolanki7042
      @mitensolanki7042 2 роки тому

      Link not working due to .Try at the end.
      Keep a space between link and ".Try"

    • @osidii
      @osidii 2 роки тому

      You need to fix your Nord VPN link the .try at the end gives a 404 error

    • @caffeinejavacode1475
      @caffeinejavacode1475 2 роки тому

      Why you don't like RestTemplate?

    • @marlon.klagenberg
      @marlon.klagenberg 2 роки тому +1

      ​@@caffeinejavacode1475 I think what he said is about never use "new MyClass()" on services, always use with dependency injection from spring. Am I correct teacher Nelson ? I hope so xD

  • @theboredasfook
    @theboredasfook 2 роки тому +65

    Of course SOLID principles is the thing I am waiting for!!!

  • @shivamsingh1221
    @shivamsingh1221 2 роки тому +22

    Yes. Please do a video on SOLID principles & cost of using try-catch block.

  • @mmeerable
    @mmeerable 2 роки тому +33

    Love this series, it is very hard to find "good java/spring programming practices" online.
    When I started learning spring boot, it was very hard to find any good resource for coding in the right way, i struggled a lot i saw some
    people using repository inside a controller and i didn't know if it is good practice.
    Recently i got my first job as a Java dev, and I wish you made this series earlier it would be so helpfull.
    Thanks for your amazing work!

    • @robbieskonieczny9464
      @robbieskonieczny9464 2 роки тому

      Agreed, I've been saying this to my friends who are still searching for jobs. UA-cam is great and all for learning the basics for frame works, but principles you must likely won't find that. This guy has a killer series!

  • @nemanja6290
    @nemanja6290 2 роки тому +21

    Videos on SOLID principles and why try/catch is expensive would be great! Keep up with this series.

    • @MatheusAugustoGames
      @MatheusAugustoGames Рік тому

      Setting up a try/catch isn't expensive. Unwinding the stack once an exception happens is.

  • @flex_prods
    @flex_prods 2 роки тому +4

    I'm a junior software developer and i have learnt a lot from you. Greetings from Spain

  • @mohammedsfr7514
    @mohammedsfr7514 2 роки тому +17

    I was waiting impatiently for this episode to be released thanks for continuing in these series 🙏🌸

  • @paulkoval
    @paulkoval 2 роки тому +7

    Looking forward to a video about try/catch costs. Would be great to know when and how using these constructions. Thank you for ur videos though!

  • @jcfawerd
    @jcfawerd 2 роки тому +2

    20:56 would it be better to create config objects for currency and cryptocurrency? And then a centralised service to accept the config. It seems that we can remove the clientWrapper going with this method as well

  • @ernesttomas9358
    @ernesttomas9358 2 роки тому

    Got my first job as a Java Spring Boot Developer at 21 thanks to your java coding series!! I want to finish my final SpringBoot project and see the review haha

  • @alper_mulayim
    @alper_mulayim 5 місяців тому

    instead of sending error message to get method in 19:07, sending exception class would be better. And another point instead of using generics using interfaces would be better. what is yours opinions?

  • @nicolas2694
    @nicolas2694 2 роки тому +4

    32:50 we could have made it even more beautiful with a filter and findAny on the stream instead of anyMatch and work with the optional to provide the default zone in case there is none

  • @salih.k8939
    @salih.k8939 2 роки тому

    This is so satisfying to watch.
    Ramadan Mubarak by the way.
    Love from Turkey.

  • @Fabian-pt4wy
    @Fabian-pt4wy 2 роки тому +1

    @Amigoscode u r such a Inspiration and have great charisma. You inspire me to be a better developer and to study islam. You are my rolemodel in terms of this 2 aspects

  • @joaoferreiraneto7759
    @joaoferreiraneto7759 2 роки тому +1

    @Amigoscode Thankssss, i love this format video, please never stop. Pratice and learn with videos like that, we learn much more than just pratice.

  • @amol_
    @amol_ 2 роки тому +1

    As a practice when we approach refactoring first we should understand behaviour of that code and based on understanding we should write unit test just to verify whatever our understanding is correct or not for that piece of code.
    Once we cover all scenario for that code after that we should start refactoring.
    There is few resource on how to approach refactoring in legacy codebase.
    1. martinfowler.com/books/refactoring.html
    2. ua-cam.com/video/iOYsxBvMkLk/v-deo.html
    3. ua-cam.com/video/wY_CUkU1zfw/v-deo.html3 (Refactoring exercise start at 1:19:34)

  • @mektrode
    @mektrode 2 роки тому +5

    Akhi any plans to do JavaScript code reviews? Your approach is the best for Junior/Mid Devs to watch on UA-cam Allahum Baarik!

  • @lxdzii
    @lxdzii 2 роки тому +2

    Great video!! Would love to know about the "expensive" computation of using a "try/catch" and also when it's good to use them!!🙏🙏🙏

  • @suwatchainanchai6637
    @suwatchainanchai6637 2 роки тому +1

    every time i see such a clean code. it soothe me. Thanks for this example usage of generic.

  • @WilmanArambillete
    @WilmanArambillete 2 роки тому

    Another excellent video. I love code reviews and the way you improve code. Congrats! Make more of these videos please

  • @asterixcode
    @asterixcode 2 роки тому

    Great video Nelson! Thank you!!! Would love a video on why not to use try/catch and what to use instead/how to do it.

  • @Infinitesap
    @Infinitesap 2 роки тому

    Great videos you are doing on refactoring.
    You keep mentioning naming is hard; so could you please elaborate on how to name in better ways. Also please discuss how to simplify code - thinking behind it.
    Very interesting video series. I love them.

  • @ayushdedhia25
    @ayushdedhia25 2 роки тому

    Man your voice is so crisp and clear 💯

  • @gabrieldragone
    @gabrieldragone 2 роки тому +1

    Great series!! Keep on, please!!

  • @mushenji
    @mushenji 2 роки тому +1

    Please explain why try-catch is not cheap in spring

  • @heyyrudyy404
    @heyyrudyy404 Рік тому

    Is there a way to write a Java API using Record, Sealed Class, pattern matching Monad and Applicative ?

  • @averagedev7768
    @averagedev7768 2 роки тому

    After a year practicing spring boot i am pleased to see i would do the mostly the same to this code

  • @henrivalencia21
    @henrivalencia21 2 роки тому +3

    yay! Generics! I haven't use this, hope this video can help

  • @poltix1239
    @poltix1239 2 роки тому +1

    A quick reminder: You forgot a space between the link in the description and the next sentence. Not that anyone doesnt get to the page

  • @AsifAlli
    @AsifAlli 2 роки тому +1

    Ramadan Mubarak akhi

  • @erfan_rad
    @erfan_rad 2 роки тому

    Could you make a video on "How to write a Telegram bot"? I searched and searched for a good Java Spring video but didn't find anything useful at all.

  • @Sahil-a-vim-user
    @Sahil-a-vim-user 2 роки тому +3

    Yes, please do a video on why try and catch is heavy. 😊

  • @daddiramba8886
    @daddiramba8886 2 роки тому +1

    @Amigoscode a quick question : why you always remove Autowired and use constructor? what the advantage of building a constructor instead of using Autowired???

    • @OmarEnglish
      @OmarEnglish 2 роки тому

      Field injection is discouraged. Constructor injection is the preferred method of dependancy injection, especially for dependencies that are required for the object that you're constructing. Autowired on the constructer isn't necessary anymore since some version of Spring that I can't recall right now.

    • @LukitaSsS2
      @LukitaSsS2 2 роки тому

      Constructor injection is easy to test. You could easily mock any dependencies, but with autowired it's much more complicated

  • @dune4095
    @dune4095 2 роки тому +1

    Assalamualaikum, Ramadan Mubarrak, you should make spring core video in details. this will helps everyone cause learning spring boot without knowing spring core concepts is very trouble-sum. Please make a detailed video..... thanks.

  • @amol_
    @amol_ 2 роки тому

    I think try catch is not expensive only throwing an exception is costly.

  • @marxjung5751
    @marxjung5751 2 роки тому

    I love this kind of topics relating to reviews

  • @cyberpunkguy4580
    @cyberpunkguy4580 2 роки тому

    Im waiting as well for this. reaaaaallly sweet! 😀

  • @hakanguneser
    @hakanguneser 2 роки тому

    Do you have plan to teach most used design patterns ?

  • @BloodyScythe666
    @BloodyScythe666 2 роки тому

    always love these! keep it up!

  • @oladimejiomotosho1887
    @oladimejiomotosho1887 2 роки тому +7

    I am the first 😀 to view

  • @firmanramadhan9564
    @firmanramadhan9564 2 роки тому

    assalamualaikum borther, i like your video
    btw how your ramadan activities?
    i'm curious about ramadan activities at your place

  • @needtubes121
    @needtubes121 2 роки тому

    would have been much simpler with a factory that creates currency or crypto service based based on passed url.

  • @caffeinejavacode1475
    @caffeinejavacode1475 2 роки тому

    Code review and refactoring best series ever

  • @TischBacchus021
    @TischBacchus021 2 роки тому

    A video about SOLID would be very nice to have!

  • @NakMs
    @NakMs 2 роки тому

    I'm curious could you please help me understand why you declare private final and create constructure (eg. Clientwrapper, Httpconfig) instead of using @autowire ?

  • @aayush5474
    @aayush5474 2 роки тому +1

    please make tutorial on that caption generator you showed in vlog

  • @taurus-fu7rk
    @taurus-fu7rk 2 роки тому

    Please continue with this series. Thanks

  • @Soromeister
    @Soromeister 2 роки тому

    Pretty please make a video about how Try/Catch is expensive (also SOLID principles)

  • @tarikmujcic2966
    @tarikmujcic2966 2 роки тому

    Video on Solid Principles would be great !

  • @jaysizmir9432
    @jaysizmir9432 2 роки тому

    Salam Nelson, just to wish you a ramadan kareem brother !

  • @davidnguyenit
    @davidnguyenit 2 роки тому

    Can you make a video about oauth2 and openid, thank you

  • @sachinkainth9508
    @sachinkainth9508 2 роки тому

    I love Cranberry juice, but only when it has no added sugar.

  • @Sasikumar-kr7xy
    @Sasikumar-kr7xy 2 роки тому

    Solid Principles, try catch looking forward

  • @DeGoya
    @DeGoya 2 роки тому

    informative video. So much to learn from

  • @Runnable19
    @Runnable19 2 роки тому +2

    That's what you get when you decide to quit your job, not so premium cranberry juice. 😂 ❤️ , have a nice Ramadan, and thanks for all the great content.

  • @slahomar1497
    @slahomar1497 2 роки тому

    code you please put your courses on Udemy ?

  • @osidii
    @osidii 2 роки тому

    You need to fix your Nord VPN link the .try at the end gives a 404 error

  • @raycarlbrown-amory3509
    @raycarlbrown-amory3509 2 роки тому

    Yes do a video on Solid principles

  • @oussamaandaloussi
    @oussamaandaloussi 2 роки тому

    why try catch is not cheap

  • @videosbypan
    @videosbypan 2 роки тому

    whats that ide?

  • @caffeinejavacode1475
    @caffeinejavacode1475 2 роки тому

    Where is Code Review #1 and Review #2 ?

  • @MatheusAugustoGames
    @MatheusAugustoGames Рік тому

    Not sure this can be called a refactor. You said it youself that you aren't sure if it was behavior-preserving.

  • @maid768
    @maid768 2 роки тому +2

    Thanks for drinking in the intro when it‘s ramadan 😒😂

    • @amigoscode
      @amigoscode  2 роки тому +2

      Lol this video was recorded 2 weeks ago

  • @odedoyinakindele8540
    @odedoyinakindele8540 2 роки тому

    Solid principles? Yes please 🙏 🥺

  • @squ34ky
    @squ34ky 2 роки тому

    0:03 AmigosASMR

  • @dave6012
    @dave6012 2 роки тому

    Waiting here for the owner of the repo to tell us it works

  • @benedictchin2275
    @benedictchin2275 2 роки тому +1

    private final RestTemaplate restTemplate = new RestTemplate()
    Why is this not recommended?

    • @Jeka-ji2yu
      @Jeka-ji2yu 2 роки тому +1

      Firstly, your object will be initially constructed not on purpose and don’t forget about DI where we basically transfer the control of managing the object to another object where IOC container will take care about RestTemplate inside a constructor using a proper DI mechanism. Moreover in this section RestTemplate isn’t even a bean so it’s under control of Spring IOC mechanism and it just no makes sense to create an object by “yourself”. I hope you understand what I’m talking about.

    • @hamadimhissen5072
      @hamadimhissen5072 2 роки тому

      @@Jeka-ji2yu thanks for the effort you put in your explanation

  • @mingerlumiscane
    @mingerlumiscane 2 роки тому +4

    Waalaykumsalaam. Please do a video about Dependency injection, Sir 😁

    • @raxkhmanLite
      @raxkhmanLite 2 роки тому +1

      I remember there is already a video about it on the channel. Check it out

  • @mrcoder9401
    @mrcoder9401 2 роки тому

    Assalamu alaikum brother,
    Great video, Very much helpful.
    I am really intrested on knowing why try/catch are expensive? why we should avoid? Please make a video...

  • @wolfie6512
    @wolfie6512 2 роки тому +1

    NordVPN is not exactly private. NordVPN still knows all your activity.

  • @edwardmike7523
    @edwardmike7523 2 роки тому

    Too much ads in your videos..just a small interval ,2 videos..control it OK

  • @aj8__8
    @aj8__8 2 роки тому

    Discord link not working

  • @hadymahmoud8373
    @hadymahmoud8373 2 роки тому

    ramadan kareem ❤🌙

  • @Another0neTime
    @Another0neTime 2 роки тому

    SOLID video!!!!

  • @muaathali2852
    @muaathali2852 2 роки тому

    Yes, please SOLID, and dependency injection

    • @hamadimhissen5072
      @hamadimhissen5072 2 роки тому

      He already has a video on dependency injection. You can search up videos in his channel

  • @RustySilver-w1q
    @RustySilver-w1q 2 роки тому

    Nelson, you could be tested the maqui juice... Aristotelia chilensis. thx

  • @ОлександрПаскар-ж6х

    great! thanks :)

  • @АнимусАнанимус
    @АнимусАнанимус Місяць тому

    Class "clazz"? Lmao. If it can be anything just call it a single letter.
    Event the language hints that "class" is a poor name :D

  • @wadie4682
    @wadie4682 2 роки тому

    Allah bless you brother 🙏

  • @j.maginnenu6291
    @j.maginnenu6291 2 роки тому

    Cranberry juice. LOL

  • @theophilus494
    @theophilus494 2 роки тому

    I just like your heart

  • @matiaszalazar9876
    @matiaszalazar9876 2 роки тому

    Amigo esta seríe está goood

  • @captainperoxidecool9503
    @captainperoxidecool9503 2 роки тому

    Assalamualaikum bro please make tutorial on c++ full course please

  • @raycarlbrown-amory3509
    @raycarlbrown-amory3509 2 роки тому

    Yes this very code

  • @lparzivall
    @lparzivall 2 роки тому

    Solid)

  • @ericbroun4657
    @ericbroun4657 2 роки тому

    💯💯💯💯💯💯💯💯

  • @bobby9568
    @bobby9568 2 роки тому

    Cool

  • @itscooldawgdonteventrip
    @itscooldawgdonteventrip 2 роки тому +1

    I am not even muslim but every time he say bismillah I am hyped lol maybe I am just a stupid guy but it's so funny

  • @FunTime-kh7lx
    @FunTime-kh7lx 2 роки тому

    you are cool

  • @Riccoani
    @Riccoani 2 роки тому

    ✌️❤️

  • @dreamdancer8212
    @dreamdancer8212 2 роки тому

    Did you ever have to listen with headphones to someone deliberately making these smacking and swallowing drinking sounds into his microfone?
    It is extremely arkward and unpleasant.
    I really wonder why you think you have to do this?
    So unless there is a vey good reason that is unknown to me I would really prefer you´d stop doing this.
    It would free me from being prepared to mute my audio in time to escape this and instead allow me to focus to the very good content.

  • @tafarakasparovmhangami2356
    @tafarakasparovmhangami2356 2 роки тому