Table of Contents
Go To References #
- Refactoring Legacy Code: STEP BY STEP (Part 1) | Continuous Delivery
- Refactoring Legacy Code STEP BY STEP (Part 2) | Continuous Delivery
- Refactoring Legacy Code STEP BY STEP (Part 3) | Continuous Delivery
- 7 Python Code Smells: Olfactory Offenses To Avoid At All Costs | ArjanCodes - Great explanation of various levels of code smells along with live refactoring
- Imprecise types -> use enum instead of a generic string
- Duplicate code -> create generic / reusable function
- Not using available built-in functions -> use list comprehension instead of writing for loop on an array
- Vague identifiers -> rename variables with units (e.g.
isinstanceto separate behavior for subtypes -> logic is in wrong place; instead use inheritance to call the subtype’s implementation (e.g.
- Using boolean flags to make a method do 2 different things -> separate into multiple, smaller scoped functions
- Catching and then ignoring exceptions -> either do something or remove try/except
- (BONUS): Throwing built-in Errors -> create custom Error class to provide more details back regarding the specific error (like values along with the message)
- More Python Code Smells: Avoid These 7 Smelly Snags | ArjanCodes
- Even More Code Smells - Purge These 7 Python Putrid Peccadilloes Now! | ArjanCodes