the first thing my prof in uni would teach us was clean code. Names, Comments, Javadoc, Invariants, low number of nested if statements, low number of parameters in functions, a maximum of 20 lines per function (use helper functions to make that work). I hated doing all those things at first but the more I got into coding/programming the more I hated other people for not following these guidelines and how much I loved these guidelines
@JannisAdmek3 жыл бұрын
20 is quite short, I agree that most methods have only a few lines but sometimes a method does just one sequential think that's a bit more complicated (like parsing) and IMHO if you break that up tooo much, it makes it harder to read.
@Pennervomland3 жыл бұрын
@@JannisAdmek I thought the same at first but it's incredible how easy it is to write 20 lines per method if you're making good use of helper methods. and it makes it MUCH easier to read imo. Brackets/comments aren't counted obviously. My prof religiously believed in that and it really did work. he showed us some of his bigger programs (10000+ lines of code) and even I as a coding beginner was able to understand it. At least what he showed us.
@JannisAdmek3 жыл бұрын
@@Pennervomland I fully agree with you that methods should be short. All I'm daying is if you have one sequential method where you don't need to reuse any of the logic it's easy if I can look at the function in one go without having to jump around :)
@John_Hamhock2 жыл бұрын
Ha, my professor (using that term VERY loosely) just showed us Javadoc yesterday. Brought any sort of pacing we might've had to a screeching halt. We're in the second semester of this stuff and it's painful. John is a lifesaver for sure.
@KilgoreTroutAsf Жыл бұрын
@rajatpandey1593 жыл бұрын
John, you have helped me a lot. Thank you so much.
@carlosgas78003 жыл бұрын
I just learnt the basics of Java programming this semmester at uni and I just love learning more about it from your videos. Thank you very much!
@AshrafZaman3 жыл бұрын
I love how you explain things, in a very engaging way! Please do a series on Design Patterns 🙏😇
@monisha21443 жыл бұрын
You are videos are so simple and easy to understand.. Thank you
@andres983 жыл бұрын
I'm so happy that I discovered your channel some months ago. I have 2YOE working as a Software Engineer with Java and I love the way you share your ideas. Keep it up!
@Supersoaker-xy2cr3 жыл бұрын
2:15 damn you took my most commonly used variable name right out of my head
@danielzywalewski77223 жыл бұрын
Hello John. Your tutorials are amazing. Thanks to You, I finally understand foundations of Java language, and I passed Exam for Java certificate. Keep going with java tutorials
@NaweOv3 жыл бұрын
I'm loving each video of this channel. Thank you for every video and your time! Excelent work.
@gone1433 жыл бұрын
My favorite KZbin channel these days
@MiguelFarah3 жыл бұрын
Although you did mention in passing the "oh, it was me!" bit, I think this particular point is never stressed upon enough when the subject of self-descriptive code (including good variable names) comes up in classes or tutorials. Back in my code auditing days, I always insisted a lot on this point - "Think of the poor guy who'll have to maintain this in six months!" "That guy is going to be YOU!". Good, self-descriptive code eases you back in when you revisit it long after you first wrote it, without the context of its initial development in the short-term memory. A good name, a properly written loop, a good comment on a particular line (like «We don't need to check for a null value here because the constructor makes sure to replace any given null with "".») saves a LOT of time whenever doing maintenance, be the maintainer the guy who wrote it OR someone else. Cheers! //
@r3jjs3 жыл бұрын
I took a programming class in Uni decades ago. The final exam was unique to each person. They were given their own first assignment from the class back and asked to explain what it did.
@thorbenjohr3 жыл бұрын
Very important is using packages to organize the code, like if you have a lot of animal classes like dog, cat, parrot, etc. Make a package called AnimalClasses and put the 3 named above into it. Creates a clean hierarchy
@BoloH.3 жыл бұрын
I've watched several of these tutorials even though 1) I'm a veteran programmer 2) I've never had to use Java professionally. These are just good content. What would be a great short video is a tutorial to how to read documentation and why it is beneficial since a lot of beginners don't really leverage the benefits of that.
@The_Vict0r3 жыл бұрын
Great video as always, thanks! As an old subscriber of channels like Andertones and Rick Beato I did not immediately realize what I have a special confidence in this channel. Hope this makes sense ;)
@micleh3 жыл бұрын
I've been looking forward to a new episode the entire week. I wished you could do them more often. As always, great content. When instructors advise you to make methods to one thing only, I'm constantly reminded of my computer science training where one colleague who deemed himself good at programming, wrote a BlackJack game in a single method, i.e. the main method. The instructors were fascinated by the program actually working over the network and made no mention of the single method and more than a thousand lines of code. Being a mathematician, he also used single letter or cryptic variable names. You would really have liked to have his code as a perfect example of what not to do.
@CodingWithJohn3 жыл бұрын
I'm considering making a video on how to make awful code that no one can understand or maintain. I might need to get some tips from this guy.
@dragxdd3 жыл бұрын
How does one make a one threaded linear-coded game? Like the whole game's code is in a while loop or something XD
@connorpemberton9783 жыл бұрын
This channel is a gold mine
@khaledamiramin42193 жыл бұрын
John you are the best, already I could understood Junit and java concept, thank you a lot
@NEnigma77710 ай бұрын
Seriously, I may actually pass my class because of you
@warrior-kas3 жыл бұрын
Thanks John , you are doing wonders to teach us how to write good quality code
@OE93713 жыл бұрын
unreadable code means the company can’t kick you out tho
@CodingWithJohn3 жыл бұрын
That could be a fun idea for a video - how to create awful code that no one can maintain
@MiguelFarah3 жыл бұрын
@@CodingWithJohn Been there. Reimplemented that.
@alfredomenezes88142 жыл бұрын
True!
@CodingWithJohn2 жыл бұрын
I'm proud to say that a video on creating terrible code will be up tomorrow morning. Hope it lives up to the hype!
@MiguelFarah2 жыл бұрын
@@CodingWithJohn Oh, I have all kinds of horror stories in this regard.
@benatakaan6132 жыл бұрын
You are an amazing teacher!
@nikkolumahang3 жыл бұрын
The naming convention also applies to other languages not just Java. Great video. Thanks for sharing!
@deanlawrence86155 ай бұрын
Just small point - at 4:11 you mention that class names should be camel case like variables but with a capitalised initial letter. Strictly, this is Pascal case, not a variant of camel case. Picky, yes but if you're told to use Pascal case for class names, you now know what that is. So ThisIsPascalCase for classes and thisIsCamelCase for variables.
@leonardojaneis87453 жыл бұрын
Hi John, greetings from Brazil! Excellent Java videos!
@mira1m1982 жыл бұрын
Great explanation of the topic 👏
@Teloi3 жыл бұрын
Another tip of mine is that if a method's name is a yes/no question (ex: isValidInput) make it return a boolean. Please It makes code so much cleaner and more self-explanatory
@francksgenlecroyant3 жыл бұрын
Another gift from John 😍, super cool
@sencer79743 жыл бұрын
Thank you. I watch your videos with joy. Super funny 😊
@clon123sam3 жыл бұрын
So cool that you switched to IntelliJ. Would you create a IntelliJ shortcuts video just like you did for eclipse?
@rjstegbauer3 жыл бұрын
My convention for a variable in a loop is to double up the letter "ii" instead of "i". That's still easy to type, easier to *see* and more distinct when *searching* for it in the code.
@AHMED-ry2gy3 жыл бұрын
Hey john, please make a video on lambda expressions and java streams, thank you
@marcelobaldado5142 жыл бұрын
I really like and learn a lot from this, we are currently taking java in our programming class. I hope that in the near future I'll be able to master java :(((
@unkownuser84552 жыл бұрын
Helpful! Already dropped a like for your great explanation : D
@carafachera47813 жыл бұрын
Bro I love your work, thnx 😁
@Vinicius286363 жыл бұрын
Awesome video again! Thank you!
@alikhaled62533 жыл бұрын
Best Java teacher
@zepptonian3 жыл бұрын
Another naming convention is to prefix method names that return boolean with ‘is’ or ‘has’. For example, isActive() [for a User class] or hasHorns() [for a class that extends Animal].
@arjacb3 жыл бұрын
Do you think you could do a video on designing programs better? i.e what design patterns exist, which ones to use, how to use them, etc. I often run into design problems when trying to make something more complex so it’s be awesome if you could! Love your videos btw
@adimoolammohan89123 жыл бұрын
thanks for making this video ,your are saved mytime lot of
@johnmisley54113 жыл бұрын
Can you go over trees?
@troeteimarsch3 жыл бұрын
Great! I'm going to send this video to my teacher at school :D His code is plain crazyness to read :D 'String sn' is supposed to be a surname but to my mind it reads "sniffer" (huehue). 'What String sniffer are we talking about again?' :D It works, but...yeah :D
@mrmichalification3 жыл бұрын
love that fast writing :)
@andres983 жыл бұрын
I noticed you started using IntelliJ it would be awesome to have a video for tips&tricks / customization / best shortcuts as you did with Eclipse
@AnthonHax2 жыл бұрын
Clean Code (R.C.Martin) is a nice book for people trying to improve things like this
@CodingWithJohn2 жыл бұрын
Yep! Mentioned in the video and linked in the description too. Probably one of my favorite programming books. It's been around for a while at this point but the concepts still apply.
@AnthonHax2 жыл бұрын
@@CodingWithJohn for sure, thanks for the content! I do learn a lot with this channel.
@tiger78583 жыл бұрын
please make a video about lambda expression in java
@Speiger3 жыл бұрын
By the way the class names are in "PascalCase" not CamalCase and First letter up.
@dynamichashsolutions77042 жыл бұрын
Please make a video about date and datetime with zones, those are very confusing if you don't have experience.
@sadeeshadulanjana44593 жыл бұрын
John, can you do a video on JavaCC and domain-specific languages?
@TusharDwivedi193 жыл бұрын
which theme do you use ? can you also make a video on that or just add the details in description.
@sadeeshadulanjana44593 жыл бұрын
John, please do a video on reflection API in java also
@HorrorInAction3 жыл бұрын
Hey John!I am learning lot from your Vedios.Thanks man ✨.If it is possible can you please make a vedio on any applications like cab booking or ticket booking using Java.It will be really helpful for me to understand the concepts.
@benjaminkroner14853 жыл бұрын
Can you make a video about the comparable interface?
@mr.pirata84143 жыл бұрын
Will you do Spring?
@El_Fuerte3 жыл бұрын
I think it would be kinda cool if you could show some bigger java projects you did. When I learned java at school we usually just did some really small programs to learn about a keyword or function but never did something big or really interesting.
@Mr5nan3 жыл бұрын
Hi, can you make a thorough video on stream and all possible combinations and implementations of it? You can make it in several parts :)
@amineguettaby55073 жыл бұрын
your are the best john
@kobaabzianidze46773 жыл бұрын
Another great video, John can you shoot video about how you have started your first job/internship? and tell us about Roadmap of becoming java software engineer, Also what should intern know from your view as a Team lead java engineer.
@jasonformol32632 жыл бұрын
5:25 in the stream, you named a variable "a". Is that a correct variable 's name ?
@CodingWithJohn2 жыл бұрын
It's definitely a valid name technically, but it's pretty terrible if you want a good, meaningful name.
@cabalunaharoldedself.52372 жыл бұрын
Hi john, I'm one of your supporter I've watch almost half of you java tutorials. but there is a big question on my mind can you make a video explaining the maven and gradle it makes me so confused. I hope you notice this comment... by the way john, thank you so much!!!
@ervinkooo22813 жыл бұрын
Hello sir, could you please make a video about the interface comparable?
@marly75493 жыл бұрын
Hi, really my first language not is english but I understand you and you help me.
@nicolasjoulin30043 жыл бұрын
Hey, really like your videos. Although I am fairly familiar with most of the concept you talk about they are great for consolidating knowledge ! Any plan on doing a build tooling video (Maven, Gradle and the sort) ? although I am generally comfortable writing java code, the build tooling is still very much arcane to me ^^
@sssaamm299883 жыл бұрын
Hi John.Thanks a lot for the java tutorials.can you pls make a video on threadLocal?
@19891214ful3 жыл бұрын
Johny boy did it again. 😎❤️
@virtualfi3 жыл бұрын
Since I play guitar and have lots of "how to play guitar" on my feed, I had real mindf*ck on first 30sec of video. My brain had to tune in :)
@velk203 жыл бұрын
Hello there, it will be awesome if you do video about setup eclipse like yours black theme and so on.
@findlestick3 жыл бұрын
Have you stopped doing tutorials in Eclipse altogether?
@CodingWithJohn3 жыл бұрын
Yeah, I did that survey and almost twice as many viewers used IntelliJ as Eclipse. So I thought it made sense to switch. For most video topics, like this one, it doesn't really make a difference which is used. But no matter which one I use I get a bunch of comments saying it sucks and I should use the other one 🙃
@findlestick3 жыл бұрын
@@CodingWithJohn Understandable. Although, it feels like the continuity and flow between your older Eclipse-videos and these videos has been somewhat lost, by suddenly changing IDE. From my own personal beginners-perspective, consistency in the IDE used throughout a series is preferable. Never mind, still great videos. And congrats on reaching 50K subs. 👍
@maxxh3 жыл бұрын
Id really like to see a video on Streams and/or lambda expressions these always confuse me a little bit
@engineersintravel43772 жыл бұрын
Oh, man, I love you!
@sumitnegi11193 жыл бұрын
sir its my personal request please make detail videos on collection framework in which cover list set map queue all conept
@LoesserOf2Evils3 жыл бұрын
What about using conventional abbreviations in method and variable name? WeightInLb vs. WeightInPounds? My profession (library and information resource management) is trending away from abbreviations excerpting common and conventional ones, e.g., measures. Many thanks.
@hussainaqeel73713 жыл бұрын
Hey john! Could you please tell us your eclipse theme? It looks amazing and I'd love to try it
@CodingWithJohn3 жыл бұрын
Sure, it's a plugin called Darkest Dark
@hussainaqeel73713 жыл бұрын
@@CodingWithJohn Sounds great! Thanks for the quick reply, absolutely love your videos and nature!
@Marcus_Graf3 жыл бұрын
When you zoom in into code, this totally makes sense. But how do you go about documenting larger projects. I sometimes get lost in old code projects because I did not document the strategy or philosophy of a specific solution. I then still have to reverse engineer what I did. Any tips on that??
@leonardonetagamer3 жыл бұрын
Don't do that
@dianafarhat94793 жыл бұрын
Hey John, thanks for the great work. Can you please make a video that explains how we can change fields in children classes (if they're private in the super class). Is it possible or should we just use methods? Thank you.
@drannoc98123 жыл бұрын
You have to make getter/setter methods I think
@dianafarhat94793 жыл бұрын
@GabrielJ All right, thank you!! ❤️
@Hufsa3 жыл бұрын
yeah makes sense, even when I knew about some conventions I didn't do what I had and when the code grew I started to suffer
@MajidJafari3 жыл бұрын
Would it be bad practice to call the instance variable inside the Cat class only weight instead of weightInKg, but have the Javadoc comment contain information about the unit?
@CodingWithJohn3 жыл бұрын
Generally, yeah, it's still better to have that information in the name. I usually will only add a comment to describe why a certain piece of code is doing what it's doing (for example, if there's a business reason for the code to do something that would look really weird without that context) rather than describing what it's doing or clarify what a variable is. Often, if you feel the need to comment a piece of code to clarify what it is or does, it probably means the code or name could be better.
@MajidJafari3 жыл бұрын
@@CodingWithJohn I see, thanks.
@Sarakani3 жыл бұрын
6:24 line 53 is the 500IQ move
@HariKrishna-mi6is3 жыл бұрын
Waiting? For your video ☺️
@ettiennevanzyl53773 жыл бұрын
Could you make a video or perhaps by replying to this comment, explain when one would use double.Nan and when to use null?
@StillAlekh2 жыл бұрын
Please do JVM, JDK, JRE. I have been coding since 2 years yet struggle to understand it. Please help.
@johanna312782 жыл бұрын
2:16: 🤣 10 out of 10
@jensBendig3 жыл бұрын
Why not making Weight a class and then .setKg(float kg); ?
@capitanperegrina2 жыл бұрын
That "It was me!" happens a lot. ha ha ha ha ha
@flipper711002 жыл бұрын
About the method naming convention it doesn’t work every time no matter how small my methods are . In a real life project a lot of wrapper method does two three things or even more than three things at the same time , which is calling multiple methods then build list of parameters finally pass those to another method in that case it becomes really difficult to give a appropriate Nate to that wrapper method, if any one is interested I can give a couple of examples from my repo.
@mariomolnar31843 жыл бұрын
Commenting and documentation writing video next!
@mastershonobi1103 жыл бұрын
I noticed you didn’t add “Captain Crunch” in your Cereal Enum! Lmao..teasing..😜
@front-endfatih40303 жыл бұрын
1:44 that’s one fat cat 😂
@animeko4u7063 жыл бұрын
It was really helpful. I am a beginner in Java and was asking people I know how to write clean code. Unfortunately, they almost did not say anything even tried to avoid this topic. Really thankful for this video. COULD you also make video about how to write comments for codes? ))))))
@Chamarel3 жыл бұрын
I love it how cats weight 95 KG lol
@beerensaft4132 жыл бұрын
She had a lot of cookie codes
@angellyca97183 жыл бұрын
❤️😡 learn with jhonn ❤️🐒
@jericho79893 жыл бұрын
Wow you used intellij now
@Lixon2363 жыл бұрын
Why not Javadoc? Just art + enter in IDE , i think more javadoc more important than the name.
@yacoubabudayyeh75362 жыл бұрын
Enta zalme mo7taram :)
@milanjovancevic40633 жыл бұрын
2:27 hahha this made me laugh :D
@nicklausss3 жыл бұрын
I will be almost like this guy in one year.
@HariKrishna-mi6is3 жыл бұрын
New videos?
@JelleDeLoecker3 жыл бұрын
But I like snake_case for my variables!
@somanyteapots3 жыл бұрын
That example variable name is r/oddlyspecific material. What the hell did you do to Fluffy after you ran out of diet coke that Thursday?!
@germimonte3 жыл бұрын
or do what everyone does, start with short and fast to type names and refactor before committing
@Aizistral3 жыл бұрын
"...what is this code even doing, who wrote this garbage? Oh... it was me." Long story short: been there man