Oh yeah testing for sure. There is actually something called cyclomatic complexity that can be used to measure the complexity of a piece of code. I intentionally chose to not mention it, but now kinda wish I had. Oh well lmao.
Good stuff, one rule I have is to never use classes unless you have mutable data where you need to track it's state. Even then you may not need a class. It's easier to test, debug, and maintain function vs classes.
I must disagree with you on this. Using classes means that you can handle a bunch of objects that have predefined operations rather than big if-elif trees with the same operations that may take a while to select. It's hard to explain in writing but in the project I'm working on, it makes performance slightly better.
At 3:16 In my opinion, shifting the return False to the next line makes it less readable, and it should stay in an else block. BUT, the part after that makes it more readable.
Yeah it wasn't the best example for that specifically, but I just wanted to show off that's generally how it would work. It would work best where there were multiple negative cases you needed to pick off.
I really agree with the idea of splitting up complex functions, makes testing a lot easier too!
Oh yeah testing for sure. There is actually something called cyclomatic complexity that can be used to measure the complexity of a piece of code. I intentionally chose to not mention it, but now kinda wish I had. Oh well lmao.
Good stuff, one rule I have is to never use classes unless you have mutable data where you need to track it's state. Even then you may not need a class. It's easier to test, debug, and maintain function vs classes.
Thank you! Honestly that's a pretty good rule.
I must disagree with you on this. Using classes means that you can handle a bunch of objects that have predefined operations rather than big if-elif trees with the same operations that may take a while to select. It's hard to explain in writing but in the project I'm working on, it makes performance slightly better.
@@largewallofbeans9812if you are worried about performance you are using the wrong language
Classes allow for dependency inflection, and therefore better testing
Thanks, I like your practicality!
Good stuff and you got me idea on how to write the clean code. I have a request, can you make a view on your VS code setup/cnfiguration?
Thank you! And I already have! There's a link in the description.
At 3:16
In my opinion, shifting the return False to the next line makes it less readable, and it should stay in an else block.
BUT, the part after that makes it more readable.
Yeah it wasn't the best example for that specifically, but I just wanted to show off that's generally how it would work. It would work best where there were multiple negative cases you needed to pick off.
@@squishy-tomato yeah thats prob why.
Since I never read code in that manner, it looks wierd.
"y" no love?