filmov
tv
Professional Code Refactor! (Cleaning Python Code & Rewriting it to use Classes)

Показать описание
In this video we take the code from my “How to Program a Game (in Python)” tutorial and refactor it to be of a more professional quality. To do this we abstract out similar parts of the code into their own classes & files. Once the new code is written, we go through some examples of how we can extend its functionality in fun ways. We make a couple more difficult levels of the game which is made very easy by the new code architecture. The final product is a lot more similar to code you would write as a full time software developer at a company like Google, Facebook, etc…
As always I left a video timeline in the comments! If you enjoy this video please consider giving it a like & subscribe for future content :). If you have any questions let me know in the comments!
Follow the homies!
Source code for Game (original & refactored):
Link to original How to Program a Game (in Python) Tutorial:
Link to video on Classes & Object Oriented Programming:
Additional information on Getters & Setters:
Some great resources if you want to write better/cleaner code! (affiliate links)
Join the Python Army to get access to perks!
---------------------
Follow me on social media!
---------------------
Video Timeline! (& some additional resources)
0:00 Video overview & code setup
3:04 Creating a Player Class
10:43 Creating subclasses for our Enemy & HumanPlayer
11:26 Creating a Color class
14:35 Creating a screen class or all our game visuals
27:00 Creating a game class for all our game logic
32:54 Information on Getters & Setters in Python
43:36 Testing our code & Debugging issues
47:20 if _name_ == "__main__" information
48:26 Creating more difficult game levels using our new class structure!
54:00 Fixing the "cheat" where you can go off the screen
55:44 Loading in custom images as the enemy blocks
*I use affiliate links on the products that I recommend. I may earn a purchase commission or a referral bonus from the usage of these links.
As always I left a video timeline in the comments! If you enjoy this video please consider giving it a like & subscribe for future content :). If you have any questions let me know in the comments!
Follow the homies!
Source code for Game (original & refactored):
Link to original How to Program a Game (in Python) Tutorial:
Link to video on Classes & Object Oriented Programming:
Additional information on Getters & Setters:
Some great resources if you want to write better/cleaner code! (affiliate links)
Join the Python Army to get access to perks!
---------------------
Follow me on social media!
---------------------
Video Timeline! (& some additional resources)
0:00 Video overview & code setup
3:04 Creating a Player Class
10:43 Creating subclasses for our Enemy & HumanPlayer
11:26 Creating a Color class
14:35 Creating a screen class or all our game visuals
27:00 Creating a game class for all our game logic
32:54 Information on Getters & Setters in Python
43:36 Testing our code & Debugging issues
47:20 if _name_ == "__main__" information
48:26 Creating more difficult game levels using our new class structure!
54:00 Fixing the "cheat" where you can go off the screen
55:44 Loading in custom images as the enemy blocks
*I use affiliate links on the products that I recommend. I may earn a purchase commission or a referral bonus from the usage of these links.
Комментарии