Back in 2005, I wrote code as a contractor for a company that transmitted a set of data to an external server. It was okay, written in C# 1.2. A couple of years later, I was hired back by the same company for some other projects. The manager had been replaced and the new guy was complaining about my original code, saying that it was unmaintainable and every time someone touched it, it broke. They wanted it re-written in C# 2.0. Not only did I just do an in-place upgrade to the .EXE file, I added new features that weren't available in 1.2. I re-compiled and had it up and running within a couple of hours. I went back to that manager and told him that every person who said my code was unmaintainable should be fired on the spot because my code was clean and _EASILY_ maintainable. I have no idea who he had that "touched" it, but if they broke it, it was because of their lack of skill, not my code.
@ziakhan-tk7rk2 жыл бұрын
Well finally a video where I can watch from the starting till the end without even getting bored for a second I hope this continues for all your videos.
@CodingWithLewis2 жыл бұрын
Glad you enjoyed it zia :)
@Volkskomissar Жыл бұрын
NEVER seen this guy coding anything! I doubt that he is succesfull at coding. All i´ve learned from him is: if you cant make it, upload shorts with fotm buzz words and stock videos
@ziakhan-tk7rk Жыл бұрын
@@Volkskomissar Well that doesn't mean that he can't code. No one would share or show code unless he is doing an open source project. He will have to make shorts like that only then people will watch.. People are interested in more content like this which drives curiosity and this is no different from other YT shorts. Everyone does it. It's upto him to show or not to show the code. May be you or I can request him to do some tutorials which can speak about his skills. By the way I am not doubting just telling
@Volkskomissar Жыл бұрын
@@ziakhan-tk7rk Thank you, that's a view I hadn't thought of at all, unfortunately. When I reflect on my statement, I realize that behind it is actually the following desire: "Your short videos are interesting I would believe your info more if you would back them up with tutorials or projects.
@jimmea63172 жыл бұрын
People who say coding isn’t an art form are just salty they can’t do it themselves
@capybaraponque61124 күн бұрын
it really isn't an art form, and I've been developing for years. You must think you're special.
@jimmea631723 күн бұрын
@@capybaraponque611 that's a very condescending and unprovoked response, but I suppose you get out of your work what you put into it after all
@capybaraponque61123 күн бұрын
@@jimmea6317 if code is art then literally everything in life is art.
@stevethackery9853 Жыл бұрын
Coding is an art form, but it's also a rigorous engineering discipline. All the fundamentals - encapsulation, defined interfaces, modularity, resilience, reusability, error-checking, exceptions, etc - are pure engineering. Building on those engineering fundamentals is where pure art can be created.
@daniel-godin Жыл бұрын
Really great video! I appreciate that you not only gave clear and concise information, you also referenced places we could learn more about these concepts. Then you put the actual links in the description. Thank you!!
@randyleberknight7049 Жыл бұрын
Excellent! This tutorial shows clear maturity and professionalism! Every beginner should trust this guy! And we can all learn here, or reinforce what we may have learned already.
@Jabberwockybird Жыл бұрын
I like guard clauses, but 4:18 broke the logic of the original code.
@sketchionic63563 ай бұрын
Separation of concerns is the principle I benefit a lot from. And also make sure to go through the SOLID principles.
@Fungustus125 күн бұрын
look at you! you were celebrating 40k subs, now you're at ~600k subs!!! Well deserved and thank you!!!
@maurolimaokАй бұрын
Half a million now! CONGRATS!
@RobelGetnet19972 жыл бұрын
good stuff! I'm a Game Dev, was kinda spooked when you called me out at Guard Clauses 😅 but I've been implementing them for a while, thanks for letting me know what they're called
@CodingWithLewis2 жыл бұрын
Good stuff!
@ahmedmanhy9899 Жыл бұрын
here after one year and u r 340k subs, u deserve a lot Lewis all the support.
@Eric-sy3dm Жыл бұрын
I loved watching your video. Those are some good lessons learned.
@mansoorsoomro85852 жыл бұрын
Dude, Guard clauses have made my life so much easier. Great Video!
@CodingWithLewis2 жыл бұрын
Glad they helped! THey really helped me!
@Aura_Mancer2 жыл бұрын
Watching the video right now. I'm a beginner, and the guard clauses was very needed! Thank you
@CodingWithLewis2 жыл бұрын
Pleasure is mine ☺️
@reddaxtor56622 жыл бұрын
I have found a really great channel. It feels like found a mentor.
@CodingWithLewis2 жыл бұрын
Glad you enjoy ☺️
@khalidsaifullahfuad2 жыл бұрын
Really love your videos. You deserve way more subscribers. Best of luck
@danielleblanc5923 Жыл бұрын
The guard tests (or functions) implement the "fail fast" principle. If the parameters are wrong fail as quickly as possible. But beware of complex "check everything" guard functions that could take a toll on performance. If performance is really an issue, you have to find the right balance by separating "safe" internal functions and public APIs that need extra security. Generally speaking any time or effort skipped on design will be spent tenfold on debugging. If code looks messy it is because your thinking is ... messy or at least cluttered.
@andreasbr8302 жыл бұрын
Thank you for the video. I think the length is perfect. It is a little Snack for in between and it is deep enough to improve your skills. The shorts are Unfortunately to short und of course not deep enough.
@iqbalibrahim47135 ай бұрын
I love the second advice, will go read about it right now
@MayukhSaikia2 жыл бұрын
Awesome video. Learnt a lot. Specifically the guard clauses
@CodingWithLewis2 жыл бұрын
Glad it was helpful Mayukh 😃 Thanks for watching!
@MayukhSaikia2 жыл бұрын
@@CodingWithLewis Welcome. Please make a video on how to make unique projects for CS degrees/personal portfolio. Specifically I was searching for some 'multi-stack' projects like using two very different languages like big projects do. I dont know whether I am thinking right or wrong.
@CodingWithLewis2 жыл бұрын
@@MayukhSaikia would love to!
@MayukhSaikia2 жыл бұрын
@@CodingWithLewis Thanks
@methanesulfonic2 жыл бұрын
I'm just starting to learn to code and your channel is a goldmine, there's so much to learn. thanks a bunch!
@CodingWithLewis2 жыл бұрын
Great to hear!
@profleadАй бұрын
Still relevant! Thanks for sharing!
@laxmanadhikari39892 жыл бұрын
I started really loving your content. Thank you for all these I learned many things from you. I have a small request can you please make some short videos on how to create efficient database architecture for both SQL and Non-SQL databases.
@dglasswine Жыл бұрын
Short, focused and really helpful
@malicious89092 жыл бұрын
Good editing skills, keep it up. Thanks for all those shorts about open source projects too :)
@devkishore13882 жыл бұрын
As always, helpful video
@CodingWithLewis2 жыл бұрын
Glad you think so! :)
@oyleolduboyleoldu36772 жыл бұрын
keep up the good work man I really appreciate your videos 🙏
@CodingWithLewis2 жыл бұрын
Thanks so much :D
@Yagamiar152 жыл бұрын
Quality content man... Loved this
@hankobrat2 жыл бұрын
Thanks for the good tips and sources. Keep them coming. 🙂
@CodingWithLewis2 жыл бұрын
Thanks hankobrat :D
@BlackdestinyXX2 жыл бұрын
Love your editing style! Keep make videos!
@CodingWithLewis2 жыл бұрын
Thanks so much Blackdestiny! :D
@md.mohiuddinmaruf77377 ай бұрын
Great video, Make a playlist on SOLID Principles in detail.
@Zeioth Жыл бұрын
100% on the spot. Recommended.
@emmanuelgenga74212 жыл бұрын
This is an awesome video... I have issues with hard to read code for projects...
@arkandash2 жыл бұрын
Thanks, this video helps me out.
@CodingWithLewis2 жыл бұрын
I’m glad it helped 😀
@BatCorkill29 күн бұрын
3:45 really hits home with me.
@xX12VincEXx2 жыл бұрын
Really great video. Helped a lot. Please make more of the longer type videos :).
@CodingWithLewis2 жыл бұрын
Would love to :) Thanks for watching!
@walaamohamed2067 Жыл бұрын
Amazing and clear one !
@by_asilbek Жыл бұрын
Thank u so much is amazing!
@bob456fk6 Жыл бұрын
When nesting code, I find it very helpful to put a Number as a Comment for each bracket. Then it's easy to tell when the code within a set of brackets begins and ends. Example: { //10 lines of code here ; { //20 more lines of code here; } //20 { //30 lots of code here; } //30 } //10
@wardibald Жыл бұрын
Much better to just extract each level of nested code into its own well named method.
@CodingWithLewis2 жыл бұрын
Thanks for waiting everyone! Let me know what you think :) More frequent videos coming now that I am back from vacation 🌴
@blendermaster89342 жыл бұрын
Amazing Video About Improving to Code!!
@CodingWithLewis2 жыл бұрын
Glad you think so! :D
@maurolimaokАй бұрын
"A jack of all trades, is a master of none!" What about MacGyver? I'm beginning The Odin Project, at 56yo. This stuff will be useful. Thanks a lot.
@emmanuelgenga74212 жыл бұрын
Also if you have any advice on coding for a 2nd year student I'd be glad to hear from you.. thanks
@RogerKaptunik Жыл бұрын
Thats funny. I just came from a video here which told me to remove these guard clauses
@waitun30194 ай бұрын
One complaint: Some clips are so short that I had to literally pause just to get the joke . Overall, Love it. subscribed
@liwordsonvijayabalan83872 жыл бұрын
Great production value on this one. Best dev channel on KZbin!
@CodingWithLewis2 жыл бұрын
👑👑👑
@GfoxSim11 ай бұрын
Very very very useful.
@Allium-Cepa Жыл бұрын
solid, cyclomativ complexity, coding guidelines = everything you need to know
@bsummer2 жыл бұрын
0:25 Love it. LOL
@PeterPankowski Жыл бұрын
Wow…extreme helpfull
@tntredstone2 жыл бұрын
I like using cases/matches in python to make if statments readable
@dushalkumar2 жыл бұрын
Which compilers we choose like something looks stylish i use turbo c++ but it's looks like any games to my mom think I'm paying game 😂
@HairyandFinanciallySolvent2 жыл бұрын
What looks clean imo depends in large part on the size of your monitor and structure of your IDE sections ... I have no clue how people do serious programming on laptops. I see people screen sharing and I'm at a loss
@CodingWithLewis2 жыл бұрын
Lol yep! 😂. You could always zoom your code out a little bit but monitors are essential
@airman122469 Жыл бұрын
If you use a tight column count it’s actually really easy to program on a laptop. Also, the less you have to use the mouse, the better on a laptop. So basically, use neovim or another vim-like clone.
@keit99 Жыл бұрын
@@airman122469or just use actual vim.
@anderssjoqvist7816 Жыл бұрын
Is "def send_email(to_email, email): email.send(to_email)" a good example of clean code? Because it's still somewhat confusing to me. I would use different words for (email) address and (email) message but, on the other hand, I don't know the rules of clean code. Maybe we need to limit the number of words we introduce?
@keit99 Жыл бұрын
Why not use void SendMail(Listreceivers, String Message) Or def send(receivers, message)
@HoD999x Жыл бұрын
1. comment what would otherwise be a "why would anyone do this?" 2. simpler is always better, minimize the number of things one has to keep in mind to understand the code 3. make sure test cycles are quick 4. forget all explicit principles
@Anna369362 жыл бұрын
Your videos are absolutely amazing, informative, helpful and so entertaining as well. I can't thank you enough!
@rebok232 Жыл бұрын
when the class has more than 1 arg(or few smaller args) in kotlin then i always use the named arguments
@thewelder3538 Жыл бұрын
If you use guard clauses, maybe it makes your code easier to read, but it certainly makes the code less performant. I'm not going to write a detailed explanation as to why because it requires understanding how branch prediction actually works. But like it or not, if/else will, in the majority of cases out perform using if statements to eliminate conditions. Every branch taken costs you a least a cycle and every if statement is going to end up as a branch instruction, or if you're lucky, maybe the compiler will make your code branchless, but good luck with that. Okay, so what's a few cycles here and there, eh? We're all friends here. Well, run that routine using those extra few cycles a few million times and now it's orders of magnitude slower. So whilst it may seem good to eliminate a few conditions right out of the gate, don't think of it as a panacea to solve your coding woes. Although that being said, breaking things down into smaller and smaller functions is a much MUCH worse idea, as all those stack frames have to be built and it's not free! Finally, DON'T if possible use exceptions either. That's another classic way to make your code run like dog shit. Treat an exception like it's name suggests, an Exception. An error is not an exception, an I/O failure is not an exception etc. etc.
@keit99 Жыл бұрын
That's really only useful if you need Performance critical Code. (Like Video games, ...) otherwise it's fine to use.
@thewelder3538 Жыл бұрын
@@keit99 Well, I guess that it's kind of lucky that I write games for a living, then.... Look, I'm not saying that exceptions aren't useful, I'm saying that they really shouldn't be used for general error handling. If you think of what the actual meaning of the word exception is, it's kind of obvious. Performance does matter; if your application took 3 weeks instead of 5 seconds to produce results, should you care? Obviously this is an absurd example, and I'm not talking about hyper optimized hand crafted assembly, but performance always matters, just maybe not a few milliseconds here and there. But a good coding practice is going to serve you better than trying to optimize your code because it is taking 3 weeks instead of 5 seconds. Using exceptions where you should be using them, is one of these practices, with the added bonus that you get someone performance back too, although that's not generally your focus. Best way to understand the concept is to code in C where you can't use exceptions so that when you code in C++, you get good use of them.
@keit99 Жыл бұрын
@@thewelder3538 fair enough. And I Think I may have missed the point. But yes Exceptions aren't great for error handling (unless the error could Lead to crashes). I kinda thought more of guard clauses (although I still would use them in Moderation)
@thewelder3538 Жыл бұрын
@@keit99 The problem is, this video starts out demonstrating these intrinsicly bad concepts and ideas, hence my comment. There are going to be people watching this who are learning and this video isn't going to help them. It's going to steer them down a road of bad practices that is going to cost serious money in the real-world when their code doesn't perform to expectations. I'm not saying that exceptions and guard clauses are bad, they serve a purpose, but it isn't the panacea to error handling that this video makes it out to be. These are the kind of lessons I've learned in 35+yrs of game development and some of them have been hard lessons too.
@keit99 Жыл бұрын
@@thewelder3538 I've found that most "clean" Code advice goes in that direction
@addictedtocode4929 Жыл бұрын
hi lewis, i wish that i had a feedback on your content, so i might be able to help you and (thank you) but, your contents are already amazing, and the only way you can improve, is to keep making contents ❤🔥❤🔥❤🔥
@navjotsingh24579 ай бұрын
ty
@diogolsq52956 ай бұрын
if you have a clarifying comment, is a great sign, that you could do some simple function extraction with a meaningful name.
@kissgergo5202 Жыл бұрын
4:25 this code doesn't do the same thing though, you never send the email notification in this version
@TheOriginalJohnDoe Жыл бұрын
Him: “I’ll use Python and JavaScript” Also him: uses PHP
@LudvikM8 ай бұрын
There was a brilliant joke on How I Met Your Mother that I keep coming back to. Characters X and Y faced a tough decision, and their happy and exciting conclusion was "do you know who can take care of it? Future X and Y! YEAH!" Of course, at some future point they were like "damn X and Y from the past! Those guys are THE WORST". Well, that's the mindframe my team seems to be in when they produce code, with the exception that, instead of blaming themselves and learn from it when shit hits the fan, they USE how messed up things are to justify their lazy and shortsighted ways to produce MORE unmaintainable and buggy code. They'd watch this video and say "yeah, I wish our applications were like that, but at this point there's nothing that can be done... Now let me resume the making of our next set of bugs".
@StarDust_20773 ай бұрын
If you have to write more than 3 of statements just use switch or a map
@gvijay20002 жыл бұрын
Lovely
@djtomoy Жыл бұрын
I like to leave some mystery and ambiguity in my code that way when it breaks (and it will!) I’m the only person who can fix it…more money for me 🤑!!!
@pepperdayjackpac45212 жыл бұрын
3:02 what is inversion control?
@CodingWithLewis2 жыл бұрын
in "version control" aka git :) means it's in your code history
@artwork-studios3 ай бұрын
The way I write cleaner code is.... Umm....... Ehhhh...... Formatting my code Is the most you'll ever see me do actually
@Westkane11 Жыл бұрын
Good video. Just a one i observed. Your refactoring with the guard clauses left out the "member.sendEmailNotification()" part, so it can only "member.renew()". One way to fix this is to put the "member.isLifeTimeMember()" as the last guard, with member.sendEmailNotification()" in the true part of the check followed by return;
@ZipClipChannel Жыл бұрын
no matter how clean your code is, there's always that one nit-picky PR reviewer that literally complains about small nothings
@camerobaird5939 Жыл бұрын
Yeah, I almost never use comments but I think I split my code into smaller functions a bit too much.
@gingeral253 Жыл бұрын
You said 40 thousand subscribers? More like 400 thousand.
@josepharoh79586 ай бұрын
Where's the discord?
@PrometheusMMIV Жыл бұрын
2:21 "int elapsedHoursInDays" That is not a good variable name. I don't even know what that's supposed to mean. Is it counting hours or days? And since it's an int, it obviously can't be counting partial days.
@brockdaniel88459 ай бұрын
Hey uncle Bob. F CleanCode™ and DRY.
@dailymeow32832 жыл бұрын
I don't comment, so my code is the ugly 😸
@CodingWithLewis2 жыл бұрын
😂😂
@SkyFly198532 жыл бұрын
Why not give short names to variables and use a separate text file to explain those variable names? Because of that, your code would be clearer and faster to process?
@CodingWithLewis2 жыл бұрын
You’d have to cross reference 2 files in that instance.
@SkyFly198532 жыл бұрын
@@CodingWithLewis At least, entire code would be more organized itself.
@fadimoussa83822 жыл бұрын
Having to reference a separate text file to figure out the purpose of a variable is a no-no. When reading code it should be easy and fast to read and understand.
@Mrmcwarpather Жыл бұрын
@@SkyFly19853 this man making a dictionary for his code 💀💀
@apmcd47 Жыл бұрын
The second file will get out of date really quickly. It would make more sense to put the explanation in a comment at definition of the variable, but once you've done that you may as well create better variable names.
@ninjazhu Жыл бұрын
I would have chosen if ((age > 18) && (isActive === false)) { renew(); } because it is simple and doesn't warrant 7 lines of code. I haven't seen many situations though someone needs to be 19 years old for something...
@gabydewilde Жыл бұрын
You can also chain them wiht &&'s !member.isSubscribed() && (member.age >= 18) && renew(); member.isSubscribed() && !member.isLifeTimeMember && member.sendEmailNotification(); I figure sinds we won't be sending 100 emails per second we can test member.isSubscribed() twice without issues.
@MiningForPies Жыл бұрын
I have. Our code needs to handle adult offenders differently.
@Fluiding Жыл бұрын
5:03 this goes against java
@doekewartena5729 Жыл бұрын
Your clean code does a totally different thing :/
@airman122469 Жыл бұрын
There’s no such thing as “self-documenting” code. If anyone tells you their code is self-documenting, feel free to laugh at them.
@promant6458 Жыл бұрын
I think this might be the most stupid thing I read today, and still it's 9AM.
@argi0774 Жыл бұрын
The thing is: if you are only coding in Python and JS, you don't even know the word "efficiency"
@lynskyrd Жыл бұрын
spoken like a true C++Ahole or are you one of those Object-Oriented snobs that create classes... 'just because'.
@Megaheropap2 жыл бұрын
40k subsribers? More like 50
@CodingWithLewis2 жыл бұрын
Check out my shorts :) where most of my views are!