Тёмный

10 Most Common Java Developer Mistakes 

Amigoscode
Подписаться 918 тыс.
Просмотров 101 тыс.
50% 1

In this video, we'll be discussing the top 10 most common mistakes that Java developers make and how to avoid them. As a Java developer, it's important to stay on top of your game and avoid these common pitfalls to ensure your code is efficient, effective, and bug-free.
So, whether you're new to Java development or a seasoned pro, this video is a must-watch. Don't let these common mistakes hold you back from writing high-quality, efficient code.
Tune in now to learn how to avoid these top 10 most common Java developer mistakes.
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
⭐ Table Of Contents ⭐
===========================================
00:00 - Intro
00:21 - Deleting inside Loop
03:12 - Generics
05:08 - Equality
06:19 - If Statements
07:36 - Ternary If Statement
08:39 - Static
09:43 - Switch Statements
10:51 - Try with resources
12:15 - Excessive Garbage Allocation
13:09 - Nulls
14:36 - Libraries
🙊 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

Наука

Опубликовано:

 

27 май 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 148   
@masterdjon
@masterdjon Год назад
I'm a senior software engineer and I didn't need to listen to this video, but I did. I positioned myself as a beginner and I found your video really interesting. The method of iterative corrections (in the "bool == true" example) is awesome. People learn and retain better this way (from my experience). I would like to express an amelioration you could do: give reasons why this or that is better and I also would tell in which circumstance. Example: In the ternary example, I do prefer one liner too, but only if it is short. And moreover, why there was a mistake (because, in fact, in terms of code execution, there is no difference at all)? (This is not a question to answer here, I already have the answer). That's it! Great video!
@KidJV
@KidJV Месяц назад
i too prefer one liner as long as it is readable else give me an if-else
@MrMineadrian
@MrMineadrian Год назад
Since java 14 (i think) we can write switch statement using ->. for example: switch (caseIndex) { case 0 -> System.out.println("zero") case 1 -> System.out.println("one") default -> System.out.println("sth") } and using that we don't have to add break statement
@ReasonableRadio
@ReasonableRadio Месяц назад
that's not too bad. Is it ever really necessary to have a switch statement in the first place though? I suppose it allows you to skip the step of having a table if you're truly just processing a unique output
@zazahead
@zazahead Год назад
Good Information! The only thing I think is important to mention additionally is that in the first example, you should also check for null values to avoid a NullPointerException. In general I think just comparing Strings with equals without considering null values is one of the most common beginner mistakes!
@salawujonathan6722
@salawujonathan6722 Год назад
Exactly. NullPointerException is one of the most common exceptions in the language.
@ilhomjonaxmatov6714
@ilhomjonaxmatov6714 Год назад
thanks for the info. But I think it would have been much easier to use the "new switch expression" available since java 12, if we used that our code would have been switch (caseIndex) { case 0 -> sout("zero"); case 1 -> sout("one"); case 2 -> sout("two"); case 3 -> sout("three"); default -> sout("default") }
@moromann1
@moromann1 Год назад
Cool! I didn't know that! Is it only when the case is a one-liner?
@rvbsm
@rvbsm Год назад
@@moromann1 not only. Just use curly braces if code is longer than one line
@KingstonFortune
@KingstonFortune Год назад
yes! same thing came to mind immediately I saw the switch
@schleuxy2
@schleuxy2 Год назад
From my side its can be better by return ning the value and apply the sout outside the switch. Because in this actual case thé switch is doing two things so its not single responsibility. If after you need only the values without print them you would have to create à New method to do the same thing. Or you would have to refacto your code to what I proposed before.
@soniablanche5672
@soniablanche5672 Год назад
I wouldn't even use a switch for this, just a simple array. String[] numbers = {"zero","one","two","three"}; if(index < 0 || index > numbers.length) { return "default"; } return numbers[index];
@Apopjak
@Apopjak Год назад
I am very new programmer, I took Amigoscode Java Master Class and I can proudly say that I am not doing not even one of these mistakes because the course taught we well. Thanks buddy! Now I see how the powerful your teaching really is
@YaroMalik
@YaroMalik 3 месяца назад
Is it paid?
@ITZollx
@ITZollx Год назад
Good format mate, knew some but certainly not all... fun to follow along.
@hiro6164
@hiro6164 Год назад
i started learning java 5 months ago and just found your channel
@smarttrupti2007
@smarttrupti2007 Год назад
Thanks for sharing such nice quick tips. Can you please make detailed video on garbage collector in java and optionals topics, please? Appreciate your explanations 👍
@gokuls2293
@gokuls2293 Год назад
Man i just love watching ur videos, learnt a lot of standards from ur code review videos. Currently i am planning to change jobs and quite afraid that i am not up to the level. :(. Keep posting these videos, i learn a lot from you, Thank u for everythiing
@yhwh7346
@yhwh7346 11 месяцев назад
Thanks for this, comrade! Excellent summary
@GianfrancoTerrazzano
@GianfrancoTerrazzano 6 месяцев назад
Really amazing, man! As junior developer I really want to thank you for the tips.
@zip3144
@zip3144 Год назад
12:09 you can write do-while loop instead the while loop to make it good concepts of loops
@ms-pf9ow
@ms-pf9ow Год назад
Learned a lot, thanks Nelson
@jeffersonfreitas4554
@jeffersonfreitas4554 Год назад
Very usefull tips. Thank's!!
@muoiomanuel4708
@muoiomanuel4708 Год назад
5 Months ago, I started studying cs in university, i still have no clue about coding... (lol) Afters seeing your video, i got smarter. Nice teaching!
@hamidoyempemi27
@hamidoyempemi27 Год назад
Thanks for the lessons man. May Allah reward you abundantly.
@developer_hadi
@developer_hadi Год назад
Many things looks similar to JavaScript, I'm thinking of learning Java after mastering JavaScript
@houssemmhamdi1137
@houssemmhamdi1137 Год назад
Salam Bro, This is very helpfull, barak allah fikom, eid mubarek
@mattstyles4283
@mattstyles4283 Год назад
4:45 Worth stressing how important it is to use interfaces. This is a very simple example, but if it’s being passed around your codebase as the concrete implementation, that’s a lot of places you’ll need to change if you decide to use a different implementation… The same is true for when you use third party libraries, database etc. You will usually want some interface to that code
@IvanRandomDude
@IvanRandomDude Год назад
Sounds like 2 sec job using any decent code editor
@jihedbouchnak
@jihedbouchnak Год назад
wow realy good work thanks a lot i love to see tips and optimisations
@isahbala2540
@isahbala2540 Год назад
Very helpful in fact at the right time against cosc211 Java OOP exams we'll have tomorrow.
@mookayreet8518
@mookayreet8518 Год назад
keeeeep doing theeeese short clips. I love them. Thanks
@pablopronsky7364
@pablopronsky7364 Год назад
great content amigo!!!! hope you are doing great!!!
@flaviuvanca9289
@flaviuvanca9289 8 месяцев назад
Hey @Amigoscode, I have been watching your channel for a while and I think it's the best Java programming channel on RU-vid. Keep up the hard work and wish you all the best.
@786Peacelover
@786Peacelover Год назад
Asalamu aliakum wr wb. MashaAllah.. Love the content. May Allah make you Mufti Menk in programming. Love to hear your advices.
@irmuunirmuun3580
@irmuunirmuun3580 11 месяцев назад
really helped me thanks a lot
@Maged_Mohsen
@Maged_Mohsen Год назад
Thanks for the video and Ramadan Mubarak, brother!
@navedakther4039
@navedakther4039 Год назад
I literally laughed for 5 mins after seeing the thumbnail 😂😂
@Starchaser38
@Starchaser38 Год назад
I was staring at it a few seconds thinking "Who in the world compares a datatype and a value??" 😂
@pyroandi6797
@pyroandi6797 Год назад
@@Starchaser38 In Java it's boolean, you probably thought about some other language like C :D
@Starchaser38
@Starchaser38 Год назад
@@pyroandi6797 Yes, I come primarily from C/C++ 😅 Those were very hilarious few seconds, before I realised about the different type names 🤣
@JamesRitala
@JamesRitala Год назад
Great piece of info for Java developers.
@michelchaghoury9629
@michelchaghoury9629 Год назад
Can you please make a video about event-driven architecture with Spring Boot and Axion Framework please ? and thank you
@arulkumar_ap
@arulkumar_ap Год назад
Hai brother, very useful your videos thank you so much... Please make video relate to Java Design patterns
@bakhtiyor_sulaymonov
@bakhtiyor_sulaymonov Год назад
Thanks for the video
@rajkhare5949
@rajkhare5949 Год назад
thanks for the nice tips!!!
@caffeinejavacode1475
@caffeinejavacode1475 Год назад
nice to hear you, maestro :)
@freetiime5444
@freetiime5444 2 месяца назад
Thank you a lot for your video. I am interested in your course master class, but it is a little high course. Do you provide any ways to get coupons?
@valentineezerins6888
@valentineezerins6888 Год назад
Can you make separated playlist for same videos, pls? Also thank for video i will share this with some collogues which cant write good code
@user-ig5bf9ps4x
@user-ig5bf9ps4x 2 дня назад
Thanks Amigos
@kalaimaranmadhavan4182
@kalaimaranmadhavan4182 Год назад
Thank You man
@hadiya2.016
@hadiya2.016 Год назад
بارك الله فيك!
@gleitonfranco1260
@gleitonfranco1260 Год назад
Top tips! 💡
@AyraSikil
@AyraSikil Год назад
Thanks for your videos! BTW, I was thinking about this situation: there's an enum for statuses - and I was writing a method, that would make something depending the enum and then return enum.toString - but formatted to a more common format - first letter capital, than all letters in lower case, and _ replaced with spaces. What would be a better way - using StringBuilder, or getting substring(0,1) + substring(1).toLowerCase().replaceAll etc.?
@KingstonFortune
@KingstonFortune Год назад
might as well use streams...
@KingstonFortune
@KingstonFortune Год назад
Arrays.stream(Status.values()) .map(s -> s.getVal().substring(0,1).toUpperCase() + s.getVal().substring(1)) .map(c -> c.replace("_", " ")) .forEach(System.out::println); enum Status { ON("available"), OFF("offline"), BUSY("brb"), CALL("in_a_meeting"), DND("do_not_disturb"); final String val; Status(String s){ this.val = s; } String getVal(){ return val; } }
@firaskedidi9868
@firaskedidi9868 Год назад
God bless you brother 🙏
@thembamakinita5526
@thembamakinita5526 Год назад
For next Video can you Kindly show us how to make our spring docker images connect and communicate with non-dockerized applications or databases
@cdhagen
@cdhagen Год назад
1:30 surprised that you didn't touch on .removeIf() method that is present on all Collection subclasses. It's much less cumbersome than using Iterators and basically a one-liner. Functional trumps imperative style.
@Jazzon234
@Jazzon234 Год назад
He mentioned .removeIf() on 3:08 but yeah it was quite short explanation and can easily be overseen.
@praveens2272
@praveens2272 Год назад
I think I could consider myself as a senior developer because whatever you explained in this video i know all of these.
@alaaitanii
@alaaitanii 5 месяцев назад
وعليكم السلام! جزاك الله خيرا!
@emanueltanase6638
@emanueltanase6638 Год назад
A very useful video! Can you make one with common mistakes in Spring boot?
@finelooksfashion2732
@finelooksfashion2732 Год назад
Literally it's the video before this one..
@ReasonableRadio
@ReasonableRadio Месяц назад
Huge bait that you have a switch statement and the approach is "don't forget to make the syntax the same" rather than bleach your code
@kundaimusindo5658
@kundaimusindo5658 Год назад
Hi bro i am writing an ecommerce site using Java for backend. What better way to store product images.
@sirojiddinsaidov3657
@sirojiddinsaidov3657 Год назад
MashaAlloh. JazakAllohu xoyron
@shehzadamalang969
@shehzadamalang969 Год назад
Very help full video, your explanation very easy to learn n understanding. Sir amigoscode you mostly use intelji idea but now which editor is this? this is nice because we can see all method in the class very easily. please let me if every person know about that thanks
@xiaotao9319
@xiaotao9319 Год назад
still intellij idea,but use [structure] window instead of default [project] window,u can find it on the top of ur intellij idea menu,choose Views -> tool window -> structure
@alexisantonindioulo4225
@alexisantonindioulo4225 Год назад
you can also use Vscode
@talbiabdelali5914
@talbiabdelali5914 Год назад
Thanks bro
@nnoliraphael5448
@nnoliraphael5448 Год назад
Amazing content as usual
@sridhar3623
@sridhar3623 Год назад
Amazing your java programming videos I have one doudt of oops concepts Give me one real time examples video , like gaming topics example on oops
@alexanderkomanov4151
@alexanderkomanov4151 Год назад
Awesome!
@mohammadtoficmohammad3594
@mohammadtoficmohammad3594 Год назад
thanks brother
@23ZeuZ23
@23ZeuZ23 5 месяцев назад
Optional blew my mind
@lovetheentertainment9949
@lovetheentertainment9949 Год назад
👇👇🙏🙏🙋‍♂️🙋‍♂️👇👇 Need clear video on how to store date and time seperately into Database table columns For example: patient take appointment for doctor on particular day and time and also update them Can you make a spring boot angular app explaining this And also how to store date and time seperately using rest API
@rydmerlin
@rydmerlin Год назад
Interesting that Java does not let you get a reference to the iterator in a for loop that internally uses an iterator.
@tanveerbaba1155
@tanveerbaba1155 Год назад
My grandfather used to wear that type of cap😅😅❤❤…. Love from kashmir❤❤❤❤
@Md_sadiq_Md
@Md_sadiq_Md Год назад
Pushing the algorithm ❤
@OffdayTherapy
@OffdayTherapy 7 месяцев назад
Awesome content
@friedec3622
@friedec3622 Год назад
"Don't return null, it's bad" JavaScript: Invent undefined
@eskos4338
@eskos4338 Год назад
great video!... but i wouldnt really agree with the ternery example return age >= 18 ? "Adult" : "Child" -> it is a very short way of writing the right logic but just isnt simple even if you are familiar with this expression i prefer the "if else" variant its easier to read
@alexisantonindioulo4225
@alexisantonindioulo4225 Год назад
write less and do more
@eskos8031
@eskos8031 Год назад
@@alexisantonindioulo4225 and therefore be more cryptic ... If you are writing the code for machines yes... But usually human beings will read the code
@yaphetb5717
@yaphetb5717 Год назад
I start watching Nelson's videos after I smash the likevbutton first😆.
@salmanpatel2968
@salmanpatel2968 9 месяцев назад
superb you are
@joaoruss0
@joaoruss0 Год назад
BTW, new UI's default dark theme is different only on MacOS, Windows and Linux have the same color scheme. Unsure why.
@Apopjak
@Apopjak Год назад
my intelliJnew UI is much darker tho. Windows 11
@joaoruss0
@joaoruss0 Год назад
I think I know why, "Edit color scheme -> Dracula Contrast"
@soheilrf4280
@soheilrf4280 Год назад
what is your intelliJ theme in this video?
@sharadsingh2856
@sharadsingh2856 Год назад
Awesome
@nikolaik.3489
@nikolaik.3489 Год назад
awesome
@user-el7fr6if3e
@user-el7fr6if3e Год назад
great content amigos, well done
@isaacwhiz
@isaacwhiz Год назад
Kareem Ramadaan. Thanks bro
@faizan346
@faizan346 Год назад
good to know that I don't do these mistakes.
@ExSpoonman
@ExSpoonman 7 месяцев назад
The thumbnail def looks like something you'd expect from Java devs 😂
@khalidessamoudi2291
@khalidessamoudi2291 Год назад
How can I communicate with you brother directly thanks
@nurmuhammadikhsan5876
@nurmuhammadikhsan5876 Год назад
my company started migrating all java code to kotlin, is that a great decision?
@stalker200368
@stalker200368 Год назад
Yes, kotlin is java on steroids
@glaze4629
@glaze4629 Год назад
Kotlin and Java are almost 100% interoperable, aside from a kotlin module for some libraries to work with it, you'll enjoy it a lot
@17_hariprasath.j41
@17_hariprasath.j41 Год назад
Bro is it possible to build a website using Java .
@alienwarex51i3
@alienwarex51i3 Год назад
Yes
@17_hariprasath.j41
@17_hariprasath.j41 Год назад
@@alienwarex51i3 how
@17_hariprasath.j41
@17_hariprasath.j41 Год назад
@@deadw1nter679 ohh okie thank you
@alienwarex51i3
@alienwarex51i3 Год назад
@@17_hariprasath.j41 Spring Boot, JPS.. Apache Tomcat. Lots of ways
@17_hariprasath.j41
@17_hariprasath.j41 Год назад
@@alienwarex51i3 okie
@alvidediev97
@alvidediev97 Год назад
My dear ahi, please, dont forget about اَلسَّلَامُ عَلَيْكُمُ‏‎ 🤗❤
@monishwarmc1829
@monishwarmc1829 Год назад
15:10🤨🤔🥴😁
@hammer9185
@hammer9185 Год назад
how can i change my inntellij build loading animation with different color. I saw that yours is like rainbow🌈.
@xiaotao9319
@xiaotao9319 Год назад
plugin:nyan progress bar
@user-eh4ep7yc9w
@user-eh4ep7yc9w Год назад
It's a joke with switches? Why don't just use "->" syntax?
@amigoscode
@amigoscode Год назад
Not everyone using latest version of Java
@V4dk4n
@V4dk4n Год назад
Many projects are java 8.
@alexisantonindioulo4225
@alexisantonindioulo4225 Год назад
@@amigoscode yes i'am agree with this almost people dont know the last version of java, so in the demo he used the basic version to explain how to use Switch case correctly.
@filipstojiljkovic4711
@filipstojiljkovic4711 Год назад
Amigo are you cold, whats with a cap on ?
@norte-code
@norte-code Год назад
I wish some RU-vidr to spring/Java like Phillip lackner on Android, cuz he teach something that is reaaaally problems, not this simples thinks
@salmanqudrat6741
@salmanqudrat6741 Год назад
isnt arraylist heterogenous?
@alexisantonindioulo4225
@alexisantonindioulo4225 Год назад
No, if you define a type all information in the ArrayList must be the same type
@cheikhtidianediouf5968
@cheikhtidianediouf5968 Год назад
where is the " assalamou allaykoum amigoscode " ?
@cheikhtidianediouf5968
@cheikhtidianediouf5968 Год назад
I finally heard it at the end of the first part ❤
@stalker200368
@stalker200368 Год назад
I honestly dislike new ui. It became too minimalistic, less functional and comperhensive, now every button only has icon instead of icon + name, so you cant say what is what without clicking on it, the color is also more blue, so it hurts my eyes
@Mikenight120
@Mikenight120 Год назад
I really love the new UI, you can change the theme of the editor too just in case. I never clicked on things and usually have everything at the reach of keyboard shortcuts so its very nice to remove the clutter in my opinion.
@Ahmed-zeno
@Ahmed-zeno Год назад
وعليكم السلام
@sorieran8695
@sorieran8695 Год назад
Number 1: Develop anything in Java
@frsh3083
@frsh3083 Год назад
1. in the first example you don't even have to use any explicit loop, just use .filter(), it's thread-safe as well 2. doesn't really someone use generics? is it java 4 or what? 3. I second that, string pool and equality are literally the basics of that language, but still a lot of people doesn't understand it 4. intellij screams "if statement can be simplified", I'd rather give an piece of advice: "listen to your linter!" 5. the ternary's cool :) 6. when it comes to static fields, I'd rather pay attention to not allocate any particular amount of memory to them since they won't be garbage-collected 7. the proper use of switch statements are good, but the switch expressions are better :) 8. agree 9. generally I recommend to get familiar with the jcmd tool, you can check memory dumps thanks to it and many many more 10. optional is a good step forward, but vavr option is even better
@tofahub
@tofahub Год назад
This was helpful. I knew most of what he covered but your points are a step further. Did you find this in the "Effective Java" book?
@lordtrollalot8707
@lordtrollalot8707 Год назад
1st mistake: started a Project in Java xP
@mayconfrr
@mayconfrr Год назад
Bro, if you’re having to explain to someone how .equals work, you probably shouldn’t be telling about string optimization on memory poll
@JatBadmos
@JatBadmos Год назад
👍👍
@infoelekblog9688
@infoelekblog9688 Год назад
I think the advice about using List instead ArrayList does not apply when working with local variables, by doing so you limit yourself to use only interface that List provide (without casting). Generally your device is good but the way you change the code is is a bad practice :|
@Jazzon234
@Jazzon234 Год назад
It depends on the implementation you are using. Speaking of List and ArrayList, there is no reason to use ArrayList because it doesn't really provide any additional functionality that you would need to use. If the specific implementation provides additional functionality, then yes you are right :)
@ilyatemnikov9624
@ilyatemnikov9624 Год назад
Judging by the cover, one gets the impression that Java is programmed by people with Down syndrome and cerebral palsy at the same time
@manilladrift
@manilladrift Год назад
LMAO so true 😂😂
@CVenture
@CVenture Год назад
Switch to New UI pls. Classic UI sux.
@felipe1876
@felipe1876 Год назад
is that ok to state in our portifolio that we used chat gpt to refactor the code?
@SanidhyaKumar-lf2pv
@SanidhyaKumar-lf2pv Год назад
java or jewa
@EhteshamShahzad
@EhteshamShahzad Год назад
8:17 I beg to differ. That's less readable, more cryptic. Especially for someone who is new to coding. I like your previous approach better, just remove the else condition.
@YounisLY
@YounisLY Год назад
The topics you talk about are interesting and you never fail to make me click, but i can never finish your videos because you are way way too slow, you always lose me halfway through. Please speed it up a little more
@deadw1nter679
@deadw1nter679 Год назад
Who tf write this bad code
@Jazzon234
@Jazzon234 Год назад
Beginners?
@hiro6164
@hiro6164 Год назад
your mom
@asennikolaev8106
@asennikolaev8106 Год назад
trainees
@deadw1nter679
@deadw1nter679 Год назад
n00bz
Далее
Being A Java Developer Is The Best Job In The World
17:29
Kinoni bulg'ashda davom etasiz | Million jamoasi
00:47
КВН 2024 Высшая лига Первая 1/4
1:47:58
1❤️
00:20
Просмотров 23 млн
Let's Review Your Backend Code | SHALL WE???
36:24
Просмотров 299 тыс.
How Senior Programmers ACTUALLY Write Code
13:37
Просмотров 1,3 млн
Java 21 Is Good?! | Prime Reacts
27:08
Просмотров 209 тыс.
JAVA DTO Pattern Tutorial | Simplify Your Code
19:12
Просмотров 186 тыс.
Generics In Java - Full Simple Tutorial
17:34
Просмотров 1 млн
You've Been Using Java Strings WRONG All This Time!
9:15
Nokia 3310 versus Red Hot Ball
0:37
Просмотров 3,1 млн
📱 SAMSUNG, ЧТО С ЛИЦОМ? 🤡
0:46
Просмотров 1,6 млн
Эволюция телефонов!
0:30
Просмотров 6 млн
Живая клавиатура
0:56
Просмотров 39 тыс.