Top 5 Terrible Java Coding Techniques You Need to Be Using Right Now

  Рет қаралды 115,118

Coding with John

Coding with John

Күн бұрын

How to write horrifically awful Java code!
Complete Java course: codingwithjohn.thinkific.com/...
Any fool can write good Java code, but it takes an expert to create truly awful, unreadable, impossible-to-maintain Java code. That's what we'll be learning in this lesson!
What makes code bad? There are many ways you can create terrible Java code, and we'll go over a handful of techniques you can use to make other developers hate trying to read your code.
By the end of this video, you'll be able to create Java code so bad that no one will be able to decipher it for years to come.
Learn or improve your Java by watching it being coded live!
Hi, I'm John! I'm a Lead Java Software Engineer and I've been in the programming industry for more than a decade. I love sharing what I've learned over the years in a way that's understandable for all levels of Java learners.
Let me know what else you'd like to see!
Links to any stuff in this description are affiliate links, so if you buy a product through those links I may earn a small commission.
📕 THE best book to learn Java, Effective Java by Joshua Bloch
amzn.to/36AfdUu
📕 One of my favorite programming books, Clean Code by Robert Martin
amzn.to/3GTPVhf
🎧 Or get the audio version of Clean Code for FREE here with an Audible free trial
www.audibletrial.com/johnclean...
🖥️Standing desk brand I use for recording (get a code for $30 off through this link!)
bit.ly/3QPNGko
📹Phone I use for recording:
amzn.to/3HepYJu
🎙️Microphone I use (classy, I know):
amzn.to/3AYGdbz
Donate with PayPal (Thank you so much!)
www.paypal.com/donate/?hosted...
☕Complete Java course:
codingwithjohn.thinkific.com/...
codingwithjohn.com

Пікірлер: 486
@talk9415
@talk9415 2 жыл бұрын
I died when he said: "Now you will always know in which line of code you have the problem..." (when you only have 1 line)
@WthyrBendragon
@WthyrBendragon 2 жыл бұрын
I, too, had a good laugh at this. Of course, real programmers understand the distinction between "line of code" vs "executable statement."
@computer_science10
@computer_science10 5 ай бұрын
XD🤣😂
@wilmarbarrick3194
@wilmarbarrick3194 2 жыл бұрын
Should've saved it for April 1.
@CodingWithJohn
@CodingWithJohn 2 жыл бұрын
I didn't even think about that but you're totally right. Missed opportunity there.
@jeromesimms
@jeromesimms 2 жыл бұрын
@@CodingWithJohn instead now you can make a part two with even more techniques 🔥
@kous7av
@kous7av 2 жыл бұрын
Well said! I'm lucky I watched this video for the first time on April 1. 🤣
@JThompson_VI
@JThompson_VI 2 жыл бұрын
You can get pretty down thinking about all the things you don't know. Sometimes it is good to be reminded of what you do know. So thanks this was oddly encouraging haha
@Astroz87
@Astroz87 2 жыл бұрын
Here's an advanced technique I like to call Re-try: Surround the contents of each method with a try / catch block, and in the catch block, re-call the method with the same parameters. This will enable the application to continuously run a method until it succeeds. Now you've got persistence both in the business logic AND the data layer! After all, if at first you !succeed...
@CodingWithJohn
@CodingWithJohn 2 жыл бұрын
Another awesome idea for the next one
@Astroz87
@Astroz87 2 жыл бұрын
@@CodingWithJohn Feel free to throw it in there! I'm placing that 'advice' under MIT license.
@HrHaakon
@HrHaakon 2 жыл бұрын
Do you just catch Exception, or do you also catch Error, so that if you run out of memory, or the stack overflows, you can add allocate some more memory and add a new call to the stack to fix it?
@bobboo101
@bobboo101 2 жыл бұрын
@HrHaakon y e s
@HuntingKingYT
@HuntingKingYT 2 жыл бұрын
@@Astroz87 throw LOL
@greg9252
@greg9252 2 жыл бұрын
Another PRO tip, use as many different libraries as possible. Somebody put a lot of sweat and tears in them and they deserve that they're work is being used. Furthermore you can prove to the team and your boss how much libraries you know!
@encrypt3d587
@encrypt3d587 2 жыл бұрын
Just like this, you're on your way to professional JavaScript development!
@nomoe.5072
@nomoe.5072 2 жыл бұрын
@@encrypt3d587 lmfao!!!!
@ThePeacefullplay
@ThePeacefullplay 2 жыл бұрын
Im new to Java. Could you explain why using a lot of libraries might not be the best thing?
@greg9252
@greg9252 2 жыл бұрын
@@ThePeacefullplay absolut valid question, I realized my statement was misleading. Of course you want to use libraries, but you want to avoid using different libraries for achieving the same thing within a project. For instance there are tons of different implementations to do a simple REST call. You should stick to the same way across your project. This is especially important when using a more advanced framework (like Spring in my case), you want to use the implementation offered by Spring (RestTemplate). Hope this helps!
@mikeruchington4882
@mikeruchington4882 2 жыл бұрын
This is TERRIBLE code. Really you should be writing ALL the code yourself - no libraries! This way everyone can see exactly how your code works!
@DmitriiGlandarius
@DmitriiGlandarius 2 жыл бұрын
You know what Java really misses to be a great language? A goto statement. It's a shame that at some point they decided to get rid of such advanced feature.
@derda3209
@derda3209 2 жыл бұрын
and inline assembler
@smrtfasizmu6161
@smrtfasizmu6161 2 жыл бұрын
Oh man, one of the things which made disassembled C code hard to read is that assembly instructions jump all around every time you use a loop or an if statement. Have I not see that I wouldn't be as thankful that there are other ways of doing conditional logic in higher level languages.
@marcinhubert2800
@marcinhubert2800 2 жыл бұрын
Precompiler directives would be pretty handy too! You would also hide a massive amount of boring code in #define section and never read it again. It would be really awesome! No more type-checking induced headache again...
@Katniss218
@Katniss218 2 жыл бұрын
goto is pretty useful if you need to have nested loops (in things like parsing) to break out of the outer loop.
@derda3209
@derda3209 2 жыл бұрын
@@Katniss218 only if you don't know how to code properly. Break and continue are everything you should need
@Miketar2424
@Miketar2424 2 жыл бұрын
lol, the int i global was hilarious. Someone I know spent a lot of time debugging a program when one of the i variables was being accessed outside the loop. Not me of course, I would never...
@xhappybunnyx
@xhappybunnyx 2 жыл бұрын
Good lord I only know a little Java to do random projects every couple months and that'd make me set my project down forever
@austingarcia6060
@austingarcia6060 2 жыл бұрын
"You're not here to _think_, your here to code." I laughed for a solid minute.
@HrHaakon
@HrHaakon 2 жыл бұрын
I cried, but then again, I'm a tech lead.
@Soromeister
@Soromeister 2 жыл бұрын
I laughed so hard on this one, I almost had a heart attack.
@austingarcia6060
@austingarcia6060 2 жыл бұрын
@@Soromeister More or less, I had to pause the video to catch my breath.
@Inkeri94
@Inkeri94 2 жыл бұрын
wow, what if someone tryes to read your code? its a giga security factor that someone might understand what's going on with those nicely named variables and methods, isnt it better to just call variables like... v1, v2, v3? same goes for methods -> m1, m2, m3.. you could try harder you know! its almost a readible code, who would want that? its not like you write your code once, refactor and then read it hundreds of times... a well written code does not need to be checked upon ever again anyways
@CodingWithJohn
@CodingWithJohn 2 жыл бұрын
These are some great ideas for the next one of these videos
@siriusthegrim
@siriusthegrim 2 жыл бұрын
@@CodingWithJohn Code obfuscation done right :) Why obfuscate code if you can make your code unreadable in the first place?
@1947wdx
@1947wdx 2 жыл бұрын
There are actually programs out there to do just that. They obfuscate the code prior to compilation so if/when someone decompiles your java code, they can't figure it out.
@kriptonis
@kriptonis 2 жыл бұрын
why even use more than one variable like, ever, when you can just use an array of objects? List allTheThings; You never need to scroll up again to remember your variable name. Thank me later.
@ferry6700
@ferry6700 2 жыл бұрын
@@kriptonis yeah, you are genius
@OwenGalaxy
@OwenGalaxy 2 жыл бұрын
As a new java programmer, some of these ideas seem really good to implement into my code! Thank you for the tips :)
@CodingWithJohn
@CodingWithJohn 2 жыл бұрын
😨
@arrowspawnnope
@arrowspawnnope 2 жыл бұрын
Nooooooooooo
@HuntingKingYT
@HuntingKingYT 2 жыл бұрын
@@CodingWithJohn What have you done😓😓
@friskasmaniacalabomination2372
@friskasmaniacalabomination2372 Жыл бұрын
NO
@acra3dpictures272
@acra3dpictures272 2 жыл бұрын
There's a SERIOUS logical flaw in your code. You're passing a single boolean to the if condition, which is nonsense as it could be either true or false. There is a common practice to help Java to understand booleans, like literally: String.valueOf(printBoard).equals("true"). Hope I could help writing more robust code.
@Nick-lx4fo
@Nick-lx4fo 2 жыл бұрын
Great minds think alike
@bobboo101
@bobboo101 2 жыл бұрын
I prefer “ String.valueOf(printBoard).equals(“true”) == true “
@HrHaakon
@HrHaakon 2 жыл бұрын
You need to see if that is true though, so it really ought to be: if(String.valueOf(printBoard).equals("true") == true) { // code here }
@HuntingKingYT
@HuntingKingYT 2 жыл бұрын
@@bobboo101 (int)String.valueOf(printBoard).equals("true") + 41 == 42
@dryjoints454
@dryjoints454 2 жыл бұрын
Do note that after you replace all of the newlines with spaces, you should replace all of the tabs with spaces too. That way, the file size becomes incredibly smaller and your monitor will thank you!
@CallMeJoshua
@CallMeJoshua 2 жыл бұрын
unironically replacing tabs with spaces is the cornerstone of python programming because tabs are inconsistent and weird
@Tom-cq2ui
@Tom-cq2ui 2 жыл бұрын
Genius! By having more compact code, you don't have to scroll your one line as much to debug or update it!! I highly recommend replacing long and tedious variable names with single letters. Even more compact code YAY!
@Zeero3846
@Zeero3846 2 жыл бұрын
@@CallMeJoshua Just use braces and semi-colons to write all your Python programs on one line. It is pretty much just like English, and that's typically written in one line with word wrap turned on. Do the same for your Python code, and just read it like a blog.
@HuntingKingYT
@HuntingKingYT 2 жыл бұрын
And if the file was CRLF use double spaces...
@Zeero3846
@Zeero3846 2 жыл бұрын
If you're working at the enterprise level, remember that you gotta work fast and with minimal impact. Every time you're asked to implement a new feature that's similar to another existing feature, never spend the time to factor out commonality. Doing so is error-prone, and when it comes to testing, you now have to test the all the similar existing features as well as the new one, and who knows how long it takes to fix those? There's just too much work for very little gain. Instead, you copy-paste the most similar feature, renaming it to whatever it is you need. Don't worry if you miss a few things in the comments. No one but you reads this code anyways, and really you should just be reading the code, because you're a professional. Then, you modify it as needed per your customer requirements. Not only does this avoid triggering a retest of existing features, but it scores you points with your customer, who will be very impressed with your turnaround time. Now I know what some of you more experienced software engineers are thinking. Doesn't this vastly increase your technical debt? Trust me. Your customer doesn't care about that. They're paying top dollar for you to solve theirs and any that you incur ought to be included in the price, and you're gonna get paid that price, because you're working at the enterprise level. I mean, by the time the technical debt really starts causing problems, you'll probably be working somewhere else that pays more because you gotta keep up with inflation.
@kayson971
@kayson971 2 жыл бұрын
"Do you have an int i variable for your for-loop? Yep, you guessed it! Global." gave me a good laugh
@rudigerheissich9800
@rudigerheissich9800 2 жыл бұрын
People underestimate the power of "teaching" like this. If you do the complete opposite of the way it should be done, you can keep it better in mind how you really have to do it. Great work, John :D
@smrtfasizmu6161
@smrtfasizmu6161 2 жыл бұрын
I feel called out a little bit when he talked about making everything global. I made my first game app (which was a chess app, which is again, similar to tic tac toe in the sense that it is doable by a beginner) and I made an object which has bunch of info about the game be a public static member of another class. And for what purpose? So that a lot of info about the chess game can be easily accessed from within anywhere in the program. What was my thinking? Isn't it wasteful to pass around variables everywhere instead of having them in one place only and making them global. I made this chess app several months ago, I knew my approach was bad before watching this video. I also have 1 method for sending and receiving moves from the opponent (if your opponent is another PC from the WiFi network) but I am not sure if that is also considered to be bad. The method is then calling a method to receive move and to play a move.
@HuntingKingYT
@HuntingKingYT 2 жыл бұрын
As a javascript developer, I honestly agree with the extra processing power that is saved from putting all the code in one line.
@markusvonhanisch8452
@markusvonhanisch8452 2 жыл бұрын
Hey John. Im having a problem withe the advice you gave in this video. so pretty much, im trying to make a recursive Ken-Ken solver, but every time i replace the recursive method with itself there always appears another call to that method out of nowhere. any idea on how to fix this? Thanks in advance!
@DanioniCampiel
@DanioniCampiel 2 жыл бұрын
You can add support to up-to 10 reappearances of the method and call it a day if it needs more than that, what would need so many calls anyway? That's inefficient!
@imusthegreat
@imusthegreat 2 жыл бұрын
that's just asking for a stackoverflowerror! you should unroll it and solve it with a switch statement so you also have the added benefit of having pre-calculated all the paths. win-win!
@HrHaakon
@HrHaakon 2 жыл бұрын
The actual technique you want is a Y combinator. No, I'm serious. that would let you get away with what you're describing.
@HuntingKingYT
@HuntingKingYT 2 жыл бұрын
@@imusthegreat Asking in StackOverflow*
@TheSeanUhTron
@TheSeanUhTron 2 жыл бұрын
ProTip: Name your variables, methods and such using really difficult to understand names. Like: public class c____ { int i = 0; int i__ = 1; int i___ = 2; int i____ = 4; } That way your coworkers will ask you what they do instead of trying to figure it out for themselves.
@avananana
@avananana 2 жыл бұрын
After years of studying at university with no success I gave up and got a job as an intern at a big corporation dealing with large chunks of Java source code. I had no idea how to code in Java but thanks to you I've learnt the very basics and I realized that the source code they used was incredibly flawed. I've now updated the entire code base to follow your tips and standards, and I have to say that everyone is super pleased with the increased file sizes, the massive reduction in lines of code, and the amount of keyboards broken by developers debugging problems on line 1, that last one really adds a lot of enthusiasm to the workspace atmosphere. Thank you for this. Yours Sincerely, A now-very-good Java programmer
@nachosanz4630
@nachosanz4630 2 жыл бұрын
I never thought I could cry of laughter with a programming video yet here I am. The final one line trick was the icing on the cake.
@smrtfasizmu6161
@smrtfasizmu6161 2 жыл бұрын
The part from 4 20 to 4 30 sounded like a commercial trying to sel you some dumb thing. The video is great I love it.
@luziferius3687
@luziferius3687 2 жыл бұрын
I once wrote a Java program for a coding exercise task. It was supposed to run some algorithms, like computing the convex hull, on some input data. Algorithm to use was determined by a positional parameter. So how do you do that? First, create an enum with constants for each algorithm, so that you can simply pass the argument as a string into the enum constructor to find the algorithm constant. Each constant had a string attached that contained the Java source code of said algorithm. When the algorithm to use was determined, it took the string, fed that into the Eclipse Java compiler imported for that purpose, and stuffed the result into a byte array. I then used a ByteArrayClassLoader to load the class from said byte array and accessed the method required via Reflection. That was hilarious fun to review^^
@tomerwolberg37
@tomerwolberg37 2 жыл бұрын
Actually you can improve the doAnything function by instead of having boolean variables just let the function do all of them and if someone wants to do only some of the functionalities of the function he can always go to the function code and choose which lines to comment / uncomment in order for the function to do what he wants. The benefit of this method is that it would make your function have a lot of comments so it would be clearer.
@okkoheinio5139
@okkoheinio5139 2 жыл бұрын
1:04 the fact that you initialize a new cat makes me burst out laughing for some reason.
@CodingWithJohn
@CodingWithJohn 2 жыл бұрын
Oh I do that in probably 70% of my videos. Can't have enough cat objects!
@gabucarneiro
@gabucarneiro 2 жыл бұрын
Man, for a minute I just thought I was doing everything wrong!! Hearing about coding from you, John, sounds like "this' the correct way of programming/coding"! I had to double check this video's title a couple of times. By the way, thank you a lot for so many awesome and instructive videos!
@aidangarvey7049
@aidangarvey7049 2 жыл бұрын
Naming the Variables class "V" reminded me of when I was brand new at coding and actually thought having a smaller file would make my program faster lmao. I'm sure my high school teacher thought my space bar was broken
@The_Vict0r
@The_Vict0r 2 жыл бұрын
Thank you for sharing these amazing technics! Now my code looks much cleaner :)
@BaldJewishBastard
@BaldJewishBastard 2 жыл бұрын
Glad do have you back, your videos are a lot of help
@azaria_phd
@azaria_phd 2 жыл бұрын
Great video, very informative. Everyone in my job already applies all of your advices, that's how smart this video is. I wanna cry.
@wolfie6512
@wolfie6512 2 жыл бұрын
These are great tips! Going to apply them all on the next project! Thanks, John!
@toxic_narcissist
@toxic_narcissist Жыл бұрын
I'm a C++ dev, but the tip with making the loop variable global is a 300 IQ pro coder move. I will definitely use it in my code
@vitorgouveia5378
@vitorgouveia5378 2 жыл бұрын
I'm so glad I saw your video today, I'm going to implement all of your tips in my company now, you really need to tell my workmates that 12 tabs indented if-else statements aren't that bad they always think that I'm crazy Well, nice the see other good self taught programmer out there
@Dalendrion
@Dalendrion 2 жыл бұрын
I would keep these tips secret. This helps with job security. Your boss will soon see that you understand your code and everyone else's, but your code is just above the understanding of others. They will be happy to keep you so that at least someone can work with what you've written.
@AndrzejCzarny
@AndrzejCzarny Жыл бұрын
The first programming tutorial that made me cry. I'm serious! Thanks for that :)
@edgelamer
@edgelamer 2 жыл бұрын
Finally something I can relate to.
@ylap1261
@ylap1261 2 жыл бұрын
😂😂😂
@joren_combs
@joren_combs 2 жыл бұрын
I have worked with libraries where the API call is literally just a method named .call(mask) that takes a bitmask of all the possible options - some of which even contradict each other! A true joy to work with 😅
@nesuleo1779
@nesuleo1779 2 жыл бұрын
Man! You are on fire! I have also purchased your course and I am enjoying ever single lectures! Also in KZbin. Keep it up Johny!
@CodingWithJohn
@CodingWithJohn 2 жыл бұрын
Awesome! Thanks, I'm really glad you're enjoying them!
@nesuleo1779
@nesuleo1779 2 жыл бұрын
@@CodingWithJohn More than you can imagine. let me be a little bit personal. I borrowed some money to join your course. Worth every singe penny. ( so it is more than enjoying) Still a winner. Thnx a lot for providing such great explanation with fun.
@j.r.a.1171
@j.r.a.1171 2 жыл бұрын
I made a game in Java for a highschool project, and did about 90% of this. I had this exact thought process when I was first learning.
@tibimose823
@tibimose823 2 жыл бұрын
When you created the "doAnything" method and started passing booleans, I remember seeing methods that take in one integer, e.g. 10=1010b, which is equivalent to passing (true, false, true, false). What do you think about those. I'm too young to understand why such methods exist, I think
@Anthropoworphous
@Anthropoworphous 2 жыл бұрын
Im not a experienced java developer but this is how I understand it The integer is changed using with x
@admiralakbar9673
@admiralakbar9673 2 жыл бұрын
I have seen this in c before. it is a way to reduce the number of arguments that have to be passed and (theoretivally) increase readability, if your function has a lot of boolean inputs that work like "options". You define the opions outside of the function and then bitwise-or them together when you call it: #define PRINT_BOARD 1 #define CALL_MUM 1
@smrtfasizmu6161
@smrtfasizmu6161 2 жыл бұрын
@@admiralakbar9673 Exactly but then you are not passing true or false you are passing constants which can be easily understood, as opposed to an array of true/false
@matthewparker9276
@matthewparker9276 2 жыл бұрын
This can also be used to reduce memory, since a Boolean only needs 1 bit, but most computers can only allocate memory by bytes, so if memory is really limited, you can store multiple bools in a byte and use logic to parse the value.
@smrtfasizmu6161
@smrtfasizmu6161 2 жыл бұрын
@@matthewparker9276 Your comment reminded me of studying computer science in highschool. We were learning theory for 2 years straight without any practice (except for excel, photos hop and a couple of programs like that, but we did no programming where all that theory would be useful). Studying theory like that was incredibly boring. I didn't have good grades in that class. I couldn't care less about bits and bytes, CPU, ALU, cache memory, RAM, Endianess, what are compilers, what is assembly, about variable types in programming languages (int, float, boolean etc.) etc. These things were so removed from being anywhere near relevant. Yet, as soon as I started studying the practice of computer science (writing computer programmes, first in Pascal, then in C, now in Java) I find all of these things very interesting and relevant. I wish computer science classes started teaching with practice and theory combined instead of teaching a bunch oftheory before practice which makes theory incredibly dry, boring and irrelevant. Learning what you would consider the basics about computers in the first 2 years of highschool was one of the most boring subjects back then.
@lindascoon4652
@lindascoon4652 2 жыл бұрын
Man you are so convincing I almost started to agree with you
@naykrausfreeham8111
@naykrausfreeham8111 2 жыл бұрын
this have to be one of the funniest thing i have watched in awhile, the replace all new line with spaces really got me
@SC1240
@SC1240 2 жыл бұрын
Hey John, would you do a video about reflection? It's one of those concepts I always get on paper but I never got the full power of them. Love the videos, thanks!!!
@realtitedog
@realtitedog 2 жыл бұрын
Good video! Also I have a suggestion which is to talk about Annotations in java and reflection
@mckenziepictures
@mckenziepictures 12 күн бұрын
From a newbie's perspective, THIS IS AWESOME! It shows what not to do if a person does not know what they are doing.
@hunelysium
@hunelysium 2 жыл бұрын
Hi John Thank you ALL Of your wonderful videos!! Truly appreciate your hard work! I have seen people argue about defining a global variable static or NON static & and it’s pros & cons, would it be possible to make one video to explain which way you prefer & why? (I believe the background might’ve been related to JDBC ) I’m sure it would help thousands of Java enthusiasts like myself in the days, or even decades to come. (Given we still use Java in the future) Thank you in advance!!
@bking9137
@bking9137 2 жыл бұрын
I love how you explain JAVA to make it make sense. Would you have a KZbin video for understanding GUI and scanner names or integers? I have not seen it yet..
@feiseyouto
@feiseyouto 2 жыл бұрын
Good ideas! Let's create a hashtable called "universalAnswers'", which the key is just the set of all questions in the universe unique, and value is there answers. Everything returns in O(1)!
@lycanthropic1122
@lycanthropic1122 2 жыл бұрын
I already do most of this, so I'm way ahead of the curve.
@NickKraftor
@NickKraftor 2 жыл бұрын
Dangerous video, my man. Someone is going to rock a global variable helper class now
@Leeon4rdoo
@Leeon4rdoo 2 жыл бұрын
Thank you kind guy. I'll use these tips at work!
@CodingWithJohn
@CodingWithJohn 2 жыл бұрын
😨
@kenmatson9035
@kenmatson9035 2 жыл бұрын
Hi. Do you have or could you do a tutorial on socket Communications in Java? Something where you could set up the basics of a microservices architecture?
@adityapatil5050
@adityapatil5050 2 жыл бұрын
Thanks for your effort. Please make video on sets and map.
@WithASideOfFries
@WithASideOfFries 2 жыл бұрын
I loved this video so much. I hope you make more.
@SergioGomez-qe3kn
@SergioGomez-qe3kn 2 жыл бұрын
The first example with method doAnything plus flags is called _control coupling_ in software engineering. Look for coupling and cohesion to learn about other related problems.
@abhaytiwari5991
@abhaytiwari5991 2 жыл бұрын
Please be consistent your videos are awesome.
@silver_david2498
@silver_david2498 2 жыл бұрын
Every once in a while, I try to code something intentionally without using something else. The weirdest one I used was not using if statements (or the ? one liner). Instead, I relied on a while loop for the if, and threw different types of exceptions in a try/catch to either move to the else block or exit the "if/else" statement.
@libertymedicalcommunicatio4908
@libertymedicalcommunicatio4908 2 жыл бұрын
Awesome stuff!
@ScienceCodeCreations
@ScienceCodeCreations Жыл бұрын
Hey, just a quick question: What IDE do you use for these tutorials? just asking
@enixfu
@enixfu Жыл бұрын
Add Goto to the list and you are exactly where we're at in CNC programming. It's awful.
@CodingWithJohn
@CodingWithJohn Жыл бұрын
I'll see if I can get a goto going in Java for the next one
@ilyaivlev6620
@ilyaivlev6620 2 жыл бұрын
thank you for your video! It's amazing!!!!
@a7mdbest15
@a7mdbest15 2 ай бұрын
I fell in love with the one line technique ❤
@aminmotiwala5141
@aminmotiwala5141 2 жыл бұрын
hey John, awesome videos :) can you cover topics for OCA and OCP exams for java?
@kiryre
@kiryre 2 жыл бұрын
Sometimes the faster way to learn how to do somerhing is to learn first how not to do something. Great content.
@bayon8852
@bayon8852 2 жыл бұрын
Thx for the tips i will use it all ❤
@roquecp
@roquecp 2 жыл бұрын
Hi John, I really like your videos and explanations. Could you make a video with examples of CompletableFuture?
@technoultimategaming2999
@technoultimategaming2999 2 жыл бұрын
This is unironically helpful in understanding why do we do certain things in programing
@jamesyang4515
@jamesyang4515 2 жыл бұрын
Wow, you got me. Here I was thinking that I was learning something useful just to find out this whole video was joke lmao! I've lost 8 minutes to work on my project haha.
@viktru
@viktru 2 жыл бұрын
Very good video as always. Interestiing to see what's on your mind most of the time; feeding the cat, calling mum, bloody mortgage... :D
@shanede-hayr1324
@shanede-hayr1324 2 жыл бұрын
Funny video, all of those hints are a nightmare when you are debugging or adding new features especially replacing all the function calls with multiple lines of code. It would take a lot of time to find all of function calls and even longer when you need to add new features.
@SuperFlamethrower
@SuperFlamethrower 2 жыл бұрын
I wrote a program that is working on decompressing or compressing a file (reverse-engineered custom compression in a videogame). I had the file being worked on as a global so any functions could read or write to the file, as needed during the operation. Is it such a sin to do that?
@bagasadifirdaus9278
@bagasadifirdaus9278 2 жыл бұрын
nice tutorial, make part 2 please!
@mohammadkarim5764
@mohammadkarim5764 2 жыл бұрын
Hi John, please make a video tutorial on " interface and implementing interfaces in java", java process memory. Thank you so very much.
@nikvolkov1409
@nikvolkov1409 2 жыл бұрын
Hey, great channel! Could you please make a video with complete explanation of Iterator in java? Thanks in advance.
@heritageking
@heritageking 2 жыл бұрын
This generated my headache for the day. Thank you! 😅
@codeZarathustra
@codeZarathustra 2 жыл бұрын
Thank Jhon greeting from Colombia!
@AnkurVashishtha01
@AnkurVashishtha01 2 жыл бұрын
While going through the video at some point of time, everyone must have forgot whether you are telling the right things or pointing out the bad things. You have a really high level of sarcasm going in this video.
@WthyrBendragon
@WthyrBendragon 2 жыл бұрын
In my very early days writing code I had a decision tree that I mapped out successfully as ternary operators nested 5 layers deep.. Sure, it was fast... but, at least I had the good sense to include documentation of what was happening. OH! And this was in Oracle 8i PL/SQL.
@rchlmdn83
@rchlmdn83 2 жыл бұрын
Hi John, do you have any tutorial with GUI in java?
@timothy6786
@timothy6786 2 жыл бұрын
I like changing all my variable, method, and class names to single characters. It saves me so much memory space!
@jorgelenny47
@jorgelenny47 2 жыл бұрын
Once when creating a method that received a string, I mispelled it and put (String LL). Since then, when I need to use a string as a parameter I always call it LL
@prx1i170
@prx1i170 2 жыл бұрын
Thanks for using my methods John, appreciate it
@shubhamsharma9614
@shubhamsharma9614 2 жыл бұрын
What a savage video to cover horrible coding😅, for a moment I thought what the hack😆. Anyway nice video 👍
@CHALLENGESTORY
@CHALLENGESTORY 8 ай бұрын
please make your full java course free on youtube. we'd love to go through your videos.
@MattXChrist
@MattXChrist 8 ай бұрын
I learned so many skills today after watching this.. I also learned this is the quickest way to get fired as a backend software developer… maybe they were just jealous of my code ;)
@CodingWithJohn
@CodingWithJohn 8 ай бұрын
Haters gonna hate
@MattXChrist
@MattXChrist 8 ай бұрын
@@CodingWithJohn Hey John, would you be able to make a discord community where your subscribers could join and learn more or even discuss topics related to your content ?
@MagnusOsterlund
@MagnusOsterlund 2 жыл бұрын
Unfortunately, those who developed the central program in the project I work for have followed most of these "tips". Methods that are several hundred lines long, lots of global variables and a spider web of bidirectional dependencies between all classes.
@Uerdue
@Uerdue 2 жыл бұрын
This came 9 days too early, but it was still fun to watch. :D
@jaimesastre6393
@jaimesastre6393 2 жыл бұрын
Very funny, I love the style :) :) :) :) explaining how to do wrong ! and a list of variables made me remind the nice environment variables of the machine ... find your var in this ...
@maliniarjun2362
@maliniarjun2362 2 жыл бұрын
Would you be able to help with heat map please?
@callmenick9569
@callmenick9569 2 жыл бұрын
Great video! I'm in physical pain now.
@greg9252
@greg9252 2 жыл бұрын
I'm indeed using a global class for all my constants. have to try it for variables as well 😀
@FVT-tn8ji
@FVT-tn8ji 2 жыл бұрын
I got nightmares when he said to make the "i" variable from a for-loop global :D
@paulmanuilenko7894
@paulmanuilenko7894 Жыл бұрын
It was fun, thanks!)))
@yogayudha1288
@yogayudha1288 2 жыл бұрын
That one line is interesting enough i should try it.
@Mr5nan
@Mr5nan 2 жыл бұрын
Do you know the book Implementation Patterns by Kent Beck? Should probably make a series of your version :)
@AliJardz
@AliJardz Жыл бұрын
the global int i is hilarious
@thetimeee1312
@thetimeee1312 2 жыл бұрын
Would be nice to see a video on the topic of destructors in Java. Yes, i know they "don't exist" but thats exactly my point. Because if for example you're working with native code manual memory management might be neccesseary.
@ebenolivier2762
@ebenolivier2762 2 жыл бұрын
Destructors do exist in Java... sort off. There is the finalize() method that can be overridden as well as try (with resource).
@thetimeee1312
@thetimeee1312 2 жыл бұрын
The finalize() method is deprecated and not guranteed to be called at all.
@ebenolivier2762
@ebenolivier2762 2 жыл бұрын
@@thetimeee1312 Yes, I was hesitant to even mention the finalize method because I thought I would get a comment like this. You are correct though, this method is deprecated. There are a number of ways though to implement a destructor still : The Cleaner class, PhantomReference and even Weak Reference to some extent. To be honest though, it is rare that one creates a resource where you are not in control of when to close it, so you very rarely have to use these features for this purpose.
@raulalbanil1984
@raulalbanil1984 2 жыл бұрын
I'm somewhat new to java, but at 2:36 wouldnt you only be able to do the first true statement as its all inside an 'if else if' ? You wouldn't be able to do multiple functions even with multiple true parameters
@philippeamon7271
@philippeamon7271 2 жыл бұрын
if (statement) {author.compliment()}... And also, feed(new Cat), doesn't feed John's cat, it calls the constructor to build one.
@smrtfasizmu6161
@smrtfasizmu6161 2 жыл бұрын
Correct. But that's also the part of a joke, it becomes easier to make mistakes when you code like that.
@NeverSnows
@NeverSnows 2 жыл бұрын
Well, that was disgusting and went against everything that i've ever known and swore to protect. Loved it!
@manoflead643
@manoflead643 2 жыл бұрын
Getting it down to one line that way is good and all, but what about writing your program as a single, enormous line of nested anonymous functions? Doing OOP is for amateurs - we all know that Function is what real computer scientists use! It looks so complex! Why else would they let you pass anonymous functions to each other if not for this?
@AKW91
@AKW91 2 жыл бұрын
If anyone ever has the pleasure to work with an "IDE" called TIA Portal and WinCC Proffessional to develop user interfaces for industrial machines, you are in for a treat. It features a global variable table, which can be accessed from everywhere and if your project is large enough it also IS accessed from everywhere, also you never really know if the variable is global at your station or global over all clients in your network. Your options for your programming languages are C and VBScript, and the best thing of all, you can mix and match, the only problem is calling a C script from VBScript, which is only possible by changing a property on a graphic element and calling the C-Function on the Changed-Event, but at least you know, if someone increases the width of a button by 1px he is trying to call a C-Function. Usually VBScript is preferred, so you also have zero type safety and inevitably strings are you used for everything, including a massive C-Function-DoAnything-Call table, which accepts a function name and a string array for arguments to change certain Graphic-properties to call C functions. And as a bonus, the arguments are set in global variables.
@codewithfelix3940
@codewithfelix3940 2 жыл бұрын
hey john please make a video on the java native methods .. i want to learn how to implement a java method in c++ . tnx
@WistrelChianti
@WistrelChianti 2 жыл бұрын
I'm getting Nam flashbacks to tutoring UG labs.... oh god no... not the 50 page if structure... nooo I don't want that memory...
Vectors in Java: The 1 Situation You Might Want To Use Them
16:13
Coding with John
Рет қаралды 75 М.
How Senior Programmers ACTUALLY Write Code
13:37
Thriving Technologist
Рет қаралды 1,3 МЛН
100😭🎉 #thankyou
00:28
はじめしゃちょー(hajime)
Рет қаралды 20 МЛН
Can You Draw The PERFECT Circle?
00:57
Stokes Twins
Рет қаралды 94 МЛН
Optionals In Java - Simple Tutorial
15:53
Coding with John
Рет қаралды 194 М.
Why Does Scrum Make Programmers HATE Coding?
16:14
Thriving Technologist
Рет қаралды 487 М.
How I Memorized ALL IntelliJ Shortcuts Effortlessly
4:55
Coding with John
Рет қаралды 42 М.
Java Strings are Immutable - Here's What That Actually Means
7:06
Coding with John
Рет қаралды 601 М.
3 Tips To Write Clean Code (from an ex-Google software engineer)
17:12
Clément Mihailescu
Рет қаралды 189 М.
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 751 М.
Java is ALWAYS Pass By Value. Here's Why
5:22
Coding with John
Рет қаралды 116 М.