OK i need to change your code. SORRY

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

Ok. In this video I will review and improve a bunch of code. The aim is to teach you how to write better code.
Don't Forget to
===========================================
💯 Subscribe to Amigoscode - bit.ly/2HpF5V8
💯 Courses Available for free here - amigoscode.com/courses
💯 Join Private Facebook Group and Discord - amigoscode.com/p/join-community
🙊 Here are the goods for all my videos video 🙊
► Recommended Books
===========================================
- Clean Code - amzn.to/2UGDPlX
- HTTP: The Definitive Guide - amzn.to/2JDVi8s
- Clean Architecture - amzn.to/2xOBNXW
► Computer and Monitor
===========================================
- New Apple MacBook Pro - amzn.to/3464Mmn
- Dell 27 INCH Ultrasharp U2719D Monitor - amzn.to/2xM3nW1
- Double Arm Stand Desk Mount - amzn.to/3aYKKfs
- USB C Hub Multiport Adapter - amzn.to/2Jz7NlL
► Camera Gear
=============================================
- Sony ILCE7M3B Full Frame Mirrorless Camera - amzn.to/346QIJn
- Sigma 16 mm F1.4 DC DN - amzn.to/2wbic3Q
- Sigma 33B965 30 mm F1.4 DC DC - amzn.to/39G37Fd
► IDE & Tools I use for coding 💻 🎒
===========================================
- ITerm
- VsCode
- GoLand
- IntelliJ Ultimate
- Sublime
P.S
===========================================
💯 Don't forget to subscribe | bit.ly/2HpF5V8
💯 Join Private Facebook Group and Discord - amigoscode.com/p/join-community
💯 Follow me on Instagram | bit.ly/2TSkA9w
❤️ Thanks for watching

Пікірлер: 260

  • @amigoscode
    @amigoscode2 жыл бұрын

    Join the community: amigoscode.com/p/join-community Premium programming courses amigoscode.com/courses

  • @testmsf5408

    @testmsf5408

    2 жыл бұрын

    How to add icon build? Look at it funny ^^

  • @youssefsuimri9526

    @youssefsuimri9526

    2 жыл бұрын

    I need your help plz if you don't mind. How we can stop people publish ing an image of us on Facebook and whatisup?

  • @babay-mp4bq

    @babay-mp4bq

    2 жыл бұрын

    alhamdullillah da'wah and programming at the same time hehe

  • @mohammedsfr7514
    @mohammedsfr75142 жыл бұрын

    We want more of these series . It's very useful

  • @zoaybk

    @zoaybk

    2 жыл бұрын

    True, please keep them coming 🙏🏽

  • @salehhassan6057

    @salehhassan6057

    2 жыл бұрын

    True

  • @cigomba

    @cigomba

    2 жыл бұрын

    Definitely learned a lot from this. I can tell you know the fundamentals very well and that goes a long way.

  • @parvathys6665

    @parvathys6665

    Жыл бұрын

    True

  • @_blackmesa
    @_blackmesa2 жыл бұрын

    One of my main issues when I first started learning code, was not being able to understand the logic behind the code. And everyone teaching back then only focused on making sure we memorized the style of the code instead of the logic behind it. - THIS for me, is one of the BEST part of your videos. Since you explain exactly what that code does and then, when needed, fix it, explaining exactly what the fix does. If there was a dedicated series on this, it would be amazing!! fantastic work. love what you do.

  • @salih.k8939
    @salih.k89392 жыл бұрын

    Just more of this. This was literally amazing. I enjoyed every single second of it.

  • @edgelamer
    @edgelamer2 жыл бұрын

    This is amazing. More of this! Watching a senior dev correcting lower tier devs is so nice and a valuable lesson for us all.

  • @yogeshchaudhary621
    @yogeshchaudhary6212 жыл бұрын

    Man I'm just loving such kind of videos. This teaches you so much practical stuff.

  • @reggiebush49
    @reggiebush492 жыл бұрын

    New to the channel but I love this series. I haven’t used java since 1st year of uni and it’s nice to learn about declarative patterns that weren’t taught in uni.

  • @froshiga9197
    @froshiga91972 жыл бұрын

    WOW, I started as a junior java dev about a year ago and I learned more from these videos than most of my time at work!

  • @aykborstelmann8623
    @aykborstelmann86232 жыл бұрын

    Actually regarding the comparator you wrote. You could just do min(Comparator.comparing(booking -> ...)) Then this would even be smaller and neater.

  • @aadlani
    @aadlani2 жыл бұрын

    You are the best Trainer on Java so far in my experience. Keep rocking. Big Fan

  • @chandrakanthpadi
    @chandrakanthpadi2 жыл бұрын

    I think no KZreadr had done this. This code reviews is so good to see. Please continue to.

  • @odkane

    @odkane

    2 жыл бұрын

    ArjanCodes does some nice code reviews too

  • @dcascato
    @dcascato2 жыл бұрын

    Wow, I never learned so much in one video. I think the value here is you are tackling it from a professional perspective, which some of us newbies lack. Tutorials many time go around teaching things like syntax and that kind of stuff, but I believe learning best practices is really valuable. Just loved it

  • @codingwithcrisprg4274

    @codingwithcrisprg4274

    2 жыл бұрын

    You can tell he has robust understanding of Data structures and Algorithms.

  • @michelchaghoury9629
    @michelchaghoury96292 жыл бұрын

    @AmigosCode, i really love the codereview, please can you make in the future some e2e tensting tutorials, as well as CI/CD, and Cloud (AWS or GCP) pleaseee, and keep going

  • @TheDragon5215
    @TheDragon52152 жыл бұрын

    Thank you Sir for these videos. As junior for me your code review serie is more helpful than any courses I've every seen.

  • @DaBaSoftware
    @DaBaSoftware2 жыл бұрын

    The cranberry juice caught me off guard. Instant like and sub But seriously, thank you for this resource. Everything from the shortcuts, the use of optional, and just the way you were critical about naming conventions really challenged what I've learned over the last few years in school and the bits of work where I've scripted or dabbled in some code snippets. Awesome video!

  • @Qrzychu92
    @Qrzychu922 жыл бұрын

    Well, I must say that modern Java looks quite neat. Greeting from dotnet :)

  • @returncode0000
    @returncode00002 жыл бұрын

    The code review/refactor series is great, keep it 👍

  • @KolosBros
    @KolosBros2 жыл бұрын

    It's awesome to see that is going to be a new series :) Code review is the best way to exchange knowledge

  • @paoloa89
    @paoloa892 жыл бұрын

    Learning through errors correction is one of the best way to fix new things in mind ! well done

  • @soumyadeeppaul2389
    @soumyadeeppaul23892 жыл бұрын

    We need more of this. Learnt a lot,gonna apply this in future for sure💯

  • @sweetmelodies01
    @sweetmelodies012 жыл бұрын

    Sir Amigo, i love your segment with this reviewing some created codes, its really so informative. I wish you can have this added as part of your weekly content. Thanks so much, you are so awesome. Ive learned so much about Java language. Thanks again and more power to your YT Channel.

  • @mm1nt
    @mm1nt2 жыл бұрын

    Amazing thanks for the help This way my first spring boot project and ive learned a lot from you !

  • @manolo6048
    @manolo60482 жыл бұрын

    this was really awesome, I felt like all code I've ever written was being reviewed, and it was great.

  • @Namelessssssssssssssss
    @Namelessssssssssssssss2 жыл бұрын

    Please go on posting this kind of videos because they are amazing and full of tremendous concepts

  • @jorgebee65
    @jorgebee652 жыл бұрын

    I really appreciate this kind of videos, man you are awesome!

  • @daoviettu2334
    @daoviettu23342 жыл бұрын

    Extremely useful!! I don't see much video content like this... It's practical.

  • @Aspiiire
    @Aspiiire2 жыл бұрын

    Even if I'am not learning Java I'am benefiting from this video, jazakAllahu khairan brother

  • @ClaudesGomes
    @ClaudesGomes2 жыл бұрын

    This is amazing, we need more videos like this! Hugs from Brazil!

  • @irina413
    @irina413 Жыл бұрын

    Best video on KZread. your videos inspire me and make me more professional. Thank you a lot

  • @Guillen8606
    @Guillen86062 жыл бұрын

    Keep up these series. This is worth every second!!

  • @futureghost6103
    @futureghost61032 жыл бұрын

    Love this series! Please continue!

  • @leewalker9851
    @leewalker9851 Жыл бұрын

    Very nice code review!! I find writing static test classes that setup the entities that you will constantly test against makes life easier. I would probably also use some verifications in the test as well

  • @krammer123456
    @krammer1234562 жыл бұрын

    This is awesome! I would suggest writing the test first and then re-factoring.

  • @CarlosDiaz-wh4jb

    @CarlosDiaz-wh4jb

    7 ай бұрын

    I was going to comment that opinion as well 😀

  • @AhmedAlawdi_
    @AhmedAlawdi_2 жыл бұрын

    I love the subtle arabic words you throw in

  • @martintopolanek448
    @martintopolanek4482 жыл бұрын

    It is satisfying to watch it. Please continue 🙏

  • @Series0Tubes
    @Series0Tubes Жыл бұрын

    @Amigoscode this was a fantastic video. It's great to see you at work.

  • @eladriladri
    @eladriladri2 жыл бұрын

    Wow this is a great video, also I love your hat! You just earned a new subscriber :D

  • @emmanueljr
    @emmanueljr2 жыл бұрын

    thank you for this, i ;ietrally dont even know some of the built in methods used here so now i have some cool features to look into. i appreciate this. its in a way bettdr than tutorials i think

  • @tinnick
    @tinnick2 жыл бұрын

    I’m not a Java programmer so please take this comment lightly. I find that at 19:50, you refactored to not return anything but I think this differs depending on the context. If the frontend needs to be aware of multiple bookings, it should return that saved booking id instead of void. This is so that the frontend can be aware of the saved booking id to then maybe later in the same form send a patch request to update the booking.

  • @valentinpopescu6704

    @valentinpopescu6704

    2 жыл бұрын

    That would be unclean code as you're adding multiple logic to one method. What you should do in this method is only book a room, like the name implies, and if you need the id, create a DAO to retrieve the id by the bookings name and optionally the start and ending date.

  • @medabotsss1
    @medabotsss12 жыл бұрын

    Disagree with listAll The class is called booking service and it only gets bookings. Calling it getAll is better because it is less verbose and you can still figure out the meaning from the class name. Same thing with delete,find,create

  • @rocketjack4865

    @rocketjack4865

    2 жыл бұрын

    Yep exactly

  • @ivanjermakov

    @ivanjermakov

    2 жыл бұрын

    Agree. Same as naming every date in entity with date: startDate, bookedDate, createdDate... It is inferred from type information, no need to type it twice.

  • @minhan4444
    @minhan44442 жыл бұрын

    I always like coding reviews and thank you very much for the topic.

  • @IvanRandomDude
    @IvanRandomDude2 жыл бұрын

    19:25 Isn't REST standard to return 201 Created and include newly created object in the response body and URL in location header?

  • @cdhagen

    @cdhagen

    2 жыл бұрын

    I thought the same, especially because in this example, an ID (random UUID) is assigned to the newly created object. One can argue whether to return the entire object or just the URL location, but the client should receive some reference to the stored object.

  • @mishikookropiridze

    @mishikookropiridze

    2 жыл бұрын

    Yes, 201 with object is standard

  • @andrewcathcart

    @andrewcathcart

    2 жыл бұрын

    Yup. 201 with the entity created. Otherwise how would the client know what GUID was saved in the db?

  • @Michaeljamieson10

    @Michaeljamieson10

    2 жыл бұрын

    Yes 201 with object

  • @jorgebee65

    @jorgebee65

    2 жыл бұрын

    @@mishikookropiridze Yeah, make sense to me.

  • @youneselhamss2908
    @youneselhamss2908 Жыл бұрын

    Amazing stuff akhi, can’t wait to get on that level in sha Allah😍🔥

  • @oliwer4987
    @oliwer49872 жыл бұрын

    Fair cleanup, but there are some points here that caught me off guard. 7:40 - I'm curious as to why it's best practice to only import the used types and not wildcard said package. The only "issue" there is, is that it clutters the local namespace and in reality could ONLY cause you to receive a compile-time error if there were to be conflicting type names, which can be resolved on the spot. Other than the mentioned "issue", there is no obvious reason not to do this if you're certain of the type namings. You also decrease the amount of unnecessary lines of code. 9:50 - 'listAll', 'all' or 'findAll' would be fine considering the fact that it's in a type of 'BookingService'. The type of listing is already made clear in the name so IMO 'BookingService#findAllBookings' seems very exhaustive and explicit. 10:36 - same point for this as the one mentioned above. 'BookingService' already indicate that it handles bookings and therefore, 'deleteByCode' references the code of booking(s). 29:29 - why would one NEVER reference the 'Collection' type? It's useful in many cases, and quite frankly required a lot. Feel free to prove me wrong if there are reasonable doubt and arguments to the points mentioned. As a backend programmer myself, I would be glad to receive said thoughts as we can never stop learning. Other than that; fun video, Amigos!

  • @StarzzDrak

    @StarzzDrak

    2 жыл бұрын

    about the 9:50 and 10:36, it's never wrong or useless to be more explicit. You've got IDE helping you write all long names, but when it comes to reading it and tracing back it's always good to be more explicit, even if it's inside a type

  • @oliwer4987

    @oliwer4987

    2 жыл бұрын

    @@StarzzDrak Of course. Don't get me wrong, I'm not saying it's not; what I am saying is that it is not a better practise nor is it needed. Quite frankly, I feel it's unnecessarily long. If you prefer to name it that way, go for it, but it's already indicated so in reality it's all good. In this case there was even multiple repositories, so even inheritance would do good with the original naming.

  • @adrianroed2178

    @adrianroed2178

    2 жыл бұрын

    ​@@StarzzDrak Being explicit is good, but being concise is also important. I can't claim to be an authority on the best balance of explicit vs concise, but there is such a thing as being too explicit. It's the same as in 7:40. I don't think it is necessary to explicitly state every class you're importing, the domain names are explicit enough while being far more concise. To me, "listAll" is explicit enough, because this is the class "BookingService", it is the controller for the class "BookingDTO" and all it's functions implicitly refer to booking DTO. If for some reason listAll returned anything other than booking DTO I would agree that it needed to be more explicit.

  • @onebacon_

    @onebacon_

    2 жыл бұрын

    7:40 couldn't be more right. Explicit imports are just noise in your code and don't contribute anything

  • @gilzemer8113

    @gilzemer8113

    2 жыл бұрын

    @@StarzzDrak "it's never wrong or useless to be more explicit" I strongly disagree. For example, if you have a class Person with fields like "name", "age", "address", it is better to have methods like "getName()", "getAge()" and "getAddress()", and not "getPersonName()", "getPersonAge()" and "getPersonAddress()". when the code is "person.getName()", it is clear to the user what the name field is refering to, however "person.getPersonName()" just makes the code inflated for no good reason. This is just a simple example but of course it applies to the case covered in the video as well. if you have a booking service, bookingService.getById(), bookingService.getByCode() is clear enough, no need to inflate the code with the obvious context (booking)

  • @luizfernandonoschang8298
    @luizfernandonoschang82982 жыл бұрын

    Awesome video man! I'm an experienced Java developer and I'm planning to take one of your online courses, because I'm learning a lot with you. Now, I want to argue with you in one thing. I think that the BookingService should actually return a BookingDTO upon insertion. This is because, when you send a 200 CREATED status, usually you send back a link to the newly created resource, so the client can actually send a GET request afterwards. In fact, mostly of the time the client will insert the new resource and do something with it afterwards(adding to a list on the UI, for example). So, sending the created entity avoids having to do a second request. If returning the whole Entity/DTO may cause a overhead, then at least the generated ID should be returned, so you can build the link for the client. Well, this is my opinion. Congratulations again for the video!

  • @420_FORTNITE
    @420_FORTNITE2 жыл бұрын

    Thank you for making more of these!

  • @adamk2251
    @adamk22512 жыл бұрын

    20:30 honestly calling findAll on a repository and doing filtering in code is a huge code smell. you're loading an entire DB table into memory just to filter out one single entry. best case: it's just bad code, worst case: your operating cost explodes because of the memory consumption, also latency. the filter itself should be contained within a specialized DB query to the likes of (pseudo-SQL:) "WHERE startDate before now AND confirmed == true" then "ORDER BY start date ASC" and "LIMIT 1",. the repository method returns an Optional, since you're actually only interesented in one entry (which could not exist, e.g. if you don't have any bookins yet, therefore Optional). BOOM, your code just became extremely trivial. also don't forget DB indexes on startDate and confirmed DB fields fro proper DB query performance ;)

  • @adamk2251

    @adamk2251

    2 жыл бұрын

    also, regarding RESTfulness: when adding new resources, you don't return void and 200 OK, you do return the saved entity with the generated UUID and respond with a 201 Created. a HTTP DELETE is supposed to be idempotent, which means that performing the same request several times should have the same effect. thefefore you shouldnt be returning a 404 when the entity to be deleted doesn't exist, just give a 204 No Content response (since the effect that the request asked for happened: the entity to be deleted does not exist after the request is completed).

  • @adamk2251

    @adamk2251

    2 жыл бұрын

    but apart from that, great video, i pretty much agree with the way you structure and format the code and your way of thinking, love that you use assertJ. great educational stuff!

  • @mm1nt

    @mm1nt

    2 жыл бұрын

    Thanks for the tips. Appreciate it

  • @verrigo

    @verrigo

    2 жыл бұрын

    @@adamk2251 Yes. I was about to comment on this, but glad someone else did it before me :D

  • @volbla

    @volbla

    2 жыл бұрын

    So basically keep a properly organized database instead of bodging in code?

  • @andreas-fefe
    @andreas-fefe2 жыл бұрын

    Here comes the incredible Nelson. Kuddos to you bro you are the best

  • @lxdzii
    @lxdzii2 жыл бұрын

    Nice video, please make more of these, I'm hooked!... A series of these would actually make us better java developers🙂💯!!!!;

  • @adedamolababatunde2798
    @adedamolababatunde27982 жыл бұрын

    This helped me refactor my own project

  • @javatmz
    @javatmz2 жыл бұрын

    Amigos thanks for taking the time to explain this topic

  • @kenng2029
    @kenng20292 жыл бұрын

    This is great stuff! Thanks for these!

  • @Myrusaf
    @Myrusaf2 жыл бұрын

    It was amazing and I learn alot from your video, keep grinding

  • @tienu
    @tienu2 жыл бұрын

    Great video. For other watching, if you use findAll and filter afterwards its going to impact performance on a large dataset, always try to put your filtering inside your query (jparepository). You can even put your min max inside there.

  • @abeard1
    @abeard12 жыл бұрын

    I love this goofy format!

  • @rumeysas.3357
    @rumeysas.33572 жыл бұрын

    It is amazing! Looking forward to see more!

  • @swapnilbodade1336
    @swapnilbodade13362 жыл бұрын

    Thanks. Please continue this series.

  • @mugilbalagmail
    @mugilbalagmail2 жыл бұрын

    Wow. Thanks a lot for this video. This is more helpful. Please drop more videos like this.

  • @ShubhamPatidar16
    @ShubhamPatidar162 жыл бұрын

    Please bring again same videos for code reviews asap. These are amazing and you are doing great work. Thanks a lot!! Please bring asap...

  • @kitsurubami
    @kitsurubami2 жыл бұрын

    I would love to see more code refactoring videos like this.

  • @kingstonmocktail7744
    @kingstonmocktail77442 жыл бұрын

    Love your videos and this series a lot. Which font do you use for intelliJ? Is that the default JetBrains Mono?

  • @Mac1355
    @Mac13552 жыл бұрын

    hello, thanks for your demonstration how we can be better coding.

  • @KangoV
    @KangoV2 жыл бұрын

    I love this channel btw -- Subscribed

  • @02Anderman
    @02Anderman2 жыл бұрын

    Amazing Video, I love how you explain why you should refactor the code like you do here, it helps to get a way better view on the structure. Also I really appreciate you for showing the good approach of testing, am really pumped to implement tests into my backends to see some of the green bars

  • @samisaleh6186
    @samisaleh61862 жыл бұрын

    Love this content! Thank you~

  • @chandragie
    @chandragie2 жыл бұрын

    More of this series please!!! 👍

  • @yogeshchaudhary621
    @yogeshchaudhary6212 жыл бұрын

    This is really good. Plz do more of such stuff.

  • @raffayhussain6717
    @raffayhussain67172 жыл бұрын

    This is great, please make more of these

  • @abdelkader2848
    @abdelkader28482 жыл бұрын

    Thanks you so much amigoscode for this kind of videos

  • @muaathali2852
    @muaathali28522 жыл бұрын

    Walikum Alsalam, Gaza’s Allah Khair…. Loving you code ❤️😘

  • @MT2LD
    @MT2LD2 жыл бұрын

    السلام عليكم.. hello brother.. thanks for everything you did for people.. suliman from SaudiArabia ❤

  • @rafa16chagas
    @rafa16chagas2 жыл бұрын

    It's amazing. I always learn something new from your videos.

  • @rafa16chagas

    @rafa16chagas

    Жыл бұрын

    Amazing. How do I get my prize?

  • @achrafbenkerri9743
    @achrafbenkerri97432 жыл бұрын

    Very useful video. Thank you for your efforts

  • @marxjung5751
    @marxjung57512 жыл бұрын

    Great video, I got a lot of knowledge and experience

  • @gurekodok
    @gurekodok2 жыл бұрын

    Awesome, super helpful thank you so much :)

  • @techstudies5005
    @techstudies50052 жыл бұрын

    Powerful Teaching Methods Here, Thanks very much!

  • @burcubag7246
    @burcubag7246 Жыл бұрын

    Thank you for your contribution 🙏

  • @umadbroyo2388
    @umadbroyo23882 жыл бұрын

    When you "Assalamualikum", it made me so happy!!

  • @dd1.d
    @dd1.d2 жыл бұрын

    Great content. I hoped my code was under your keen eyes. May be next time inshaallah

  • @pejko89
    @pejko89 Жыл бұрын

    This is so useful! Thanks

  • @justgame5508
    @justgame55082 жыл бұрын

    On the delete booking by code (and other situations like that), rather than have them void, I like to return a bool stating where the delete was successful, for instance if an unknown code is passed it may be useful when using that function to know whether the action was successful or not and structure the logic accordingly

  • @briannkurunungi2837
    @briannkurunungi28372 жыл бұрын

    I like your good heart Sir Well done

  • @AlexG-sp7qn
    @AlexG-sp7qn2 жыл бұрын

    Hello, Would be nice to have a Spring's course about Relation between tables, the cascades, constraints, when to use REST microservice or direct relation in module, joins, and other sql stuff ;)

  • @rovsenhuseynov8368
    @rovsenhuseynov8368 Жыл бұрын

    Useful video. Thanks man

  • @oharaandrew314
    @oharaandrew3142 жыл бұрын

    This is great stuff. I'm tempted to do a kotlin equivalent.

  • @soulkepper217
    @soulkepper217 Жыл бұрын

    The Legendary Hero walking around at 1st flat of the dungeon, hanging with the children:d

  • @lubaidkhan2937
    @lubaidkhan29372 жыл бұрын

    Walaikumsalaam warehmatullahi wabarakaatuhuu...Love from Kashmir💖

  • @ivanflores8554
    @ivanflores85542 жыл бұрын

    Love this series!

  • @dawidplewik1181
    @dawidplewik11812 жыл бұрын

    Useful material, i like it!

  • @codingwithcrisprg4274
    @codingwithcrisprg42742 жыл бұрын

    Definitely do more of these videos.

  • @svalyavasvalyava9867
    @svalyavasvalyava98672 жыл бұрын

    thank you so much for the content!!!

  • @theboredasfook
    @theboredasfook2 жыл бұрын

    Nice video brother, I would like to see best practices advice for Rest API

  • @MohamedOsama-kl6ex
    @MohamedOsama-kl6ex Жыл бұрын

    Amazing 🤩 keep going bro ♥️🙏

  • @nabilelKasmiy9880
    @nabilelKasmiy98802 жыл бұрын

    Asalamoalaikom Nelson, great as always brother

  • @georgesdefo5896
    @georgesdefo58962 жыл бұрын

    Amazing nelson 🙌🏾🙌🏾

  • @salehahmed8936
    @salehahmed89362 жыл бұрын

    Best coder around!

  • @random-null-pointer
    @random-null-pointer2 жыл бұрын

    amazing series!

  • @Aspiiire
    @Aspiiire2 жыл бұрын

    Wow mashAllah, thank you so much brother, really useful stuff!!!

  • @yassinemessaoud8619
    @yassinemessaoud86192 жыл бұрын

    never new i'd be very interested in refactoring Thank you !

  • @pali240
    @pali2402 жыл бұрын

    Very usefull. Next time the code review could be a Spring Rest controller test with mocking.

Келесі