Step-By-Step Chess Game Refactoring | Code Roast

preview_player
Показать описание

It’s been a while, but I am back with a new code roast video! Today I'm refactoring a Chess game. By practicing code reviewing you greatly improve your own coding abilities, become more critical of your own code and open up your mind.

🔖 Chapters:
0:00 Intro
2:03 Example code explanation
5:03 Analysis of the current code
5:10 Wildcard imports
6:30 Hardcoded values
7:19 Initialising issues
7:57 CommandHandler misplacement
9:30 Precise type hints
10:30 Reuse buttons and images
17:20 Law of Demeter violations
18:38 Refactor 1: Guard clauses
20:59 Refactor 2: Change the Piece inheritance hierarchy to a single class
24:18 Refactor 3: Create a Board class that has useful methods
26:55 Refactor 4: Fill the board from a FEN string
29:07 Refactor 5: Split out the valid moves functions
30:35 Abstraction with Protocol class
30:50 Final thoughts

#arjancodes #softwaredesign #python
Рекомендации по теме
Комментарии
Автор

This format is better for highlighting the new concepts overall but I think the old format, even if its longer, takes u through the process of thinking and not just the result of the thinking. Still its good content for sure. Overall, I find that code roasts is the best content on this channel Arjan. Real Problem with real solutions.

yousofthelord
Автор

Love the code roasts. They've inspired me to refactor a lot of my 'hobby' code.
I would love watching a multi hour video of you completely refactoring a program.

janjaapvdv
Автор

Hey, thanks a lot for taking time to make a roast of my code. :D I'm not sure why, but the square coloring method doesn't seem to work on MacOS. Great video as always, I learned a lot from it.

adam
Автор

I really like these types of videos and find them very helpful. I do prefer the longer versions where we actually see all the changes being made though. I think the new format has a little more disconnect between the old code and the new code because you don't see it all being updated.

jampk
Автор

Arjan, you could do a series about “Clean Architecture” and actually implement a whole (simple, but complete) application using Clean Arch and also some Design Patterns as well, giving advices on how to use the best practices while doing it!

I’d love to watch something like this, as I haven’t found it anywhere. Also, appreciate your videos, thank you!

MaycolTeles
Автор

I also really enjoyed the old video format where you performed the actual refactoring steps, those moments where you were refactoring gave the viewer time to think and process what you had just said. Predicting how you would perform the refactoring was also a great learning practice from my perspective.

I do agree though that if I was more experienced this format is nicer because of the higher information density.

houterm
Автор

Like before viewing! The best YouTube channel for learning Python at the intermediate-advanced level! Thank you for your job, Arjan!

frost
Автор

You just can't get instructions like this anywhere else without paying a ton of money. I've learned so much from your videos I am able to apply your teachings to my own code in production.

ocnyoura
Автор

This is my first video of yours I've seen, so I'd say the new format is working well!

loved the video, by the way

dallinyauney
Автор

I've been waiting exactly for this 🔥🔥. And single video is really helpful ✨

rakesha
Автор

I'm back to watch this one again, and I just wanna say that while the coding is my favorite part of the channel, the b-roll and the gags are a **strong** second!

And to anyone who feels differently you need to - ahem- opeeeen your :D

xiggywiggs
Автор

Code roasts are the best, hope you continue the serie and find the proper format.

SylvioSaraiva
Автор

I wait for these code roasts because they are always informative and interesting!

Regarding the format, this particular example was fine for me because it was easy to follow and I already knew the reasons behind most of the changes from watching your other videos, even if I wouldn't have thought of them myself. Would be good to know what someone unfamiliar with design principles thinks

In saying that, i definitely appreciate the previous in-depth analysis format as you work through the code. I personally wouldn't mind watching a single long video instead of multi-part if that helps the yt algorithm

Maybe a best of both worlds approach would be to copy-paste code segments as you go through, instead of typing it as you go along (like old format) or showing the completed code (like new format), and a quick explanation of what is happening to make it abit faster/shorter?

acatch
Автор

I love the old format more. Seeing ten lines of codes turning into one or two lines is really satisfying.

tanjt
Автор

love the cheesy opening!

I love the roasts I pick up a lot of tricks from seeing you improve existing code.

simmonslucas
Автор

Personally I prefer the more detailed code refactor videos. I feel I learn more and it's more satisfying to watch. I do appreciate your issue with longer videos or splitting them. One possible solution is to film and edit the entire series of videos but release them all at once. I don't mind having longer videos but I can see the appeal of breaking them up into convenient stopping places. All of your videos are extremely educational but for some reason I really like the code roasts and get a lot of joy from them. I hope you continue this series regardless of the format.

scrope
Автор

Very satisfying to watch, its like these videos where people clean their room

MrTomkan
Автор

Thank you love the "Code Roast" Videos!

AessamL
Автор

Great video, tons of info! I would really enjoy a longer version where you go through a complete rewrite as well :)

akarlska
Автор

I learned a lot watching this video even though I do not work with Python, but Java. The reasoning behind it is what I find really interesting. Also, I really like your calm manner throughout the video. I could watch this type of format for hours. You got yourself a new sub! Keep it up!

sergiojimenez