Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Professional Code Refactor - Cleaning Python Code and Rewriting It to Use Classes

Keith Galli via YouTube

Overview

Learn how to refactor Python code to a professional standard in this comprehensive tutorial video. Explore the process of transforming a basic game program into a well-structured, object-oriented application. Master the art of creating classes for players, enemies, colors, and game logic, while implementing subclasses and understanding the importance of getters and setters. Discover techniques for organizing code into separate files, debugging issues, and utilizing the "__main__" concept. Apply newly acquired skills to extend game functionality, create challenging levels, and incorporate custom images. Gain valuable insights into writing clean, maintainable code that mirrors industry standards used by top tech companies.

Syllabus

Video overview & code setup
Creating a Player Class
Creating subclasses for our Enemy & HumanPlayer
Creating a Color class
Creating a screen class or all our game visuals
Creating a game class for all our game logic
Information on Getters & Setters in Python
Bringing it all together in our main.py file!
Testing our code & Debugging issues
if _name_ == "__main__" information
Creating more difficult game levels using our new class structure!
Fixing the "cheat" where you can go off the screen
Loading in custom images as the enemy blocks

Taught by

Keith Galli

Reviews

Start your review of Professional Code Refactor - Cleaning Python Code and Rewriting It to Use Classes

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.