Python Refactoring and Code Quality

  1. Object-Oriented Refactoring
    1. Feature Movement Between Objects
      1. Move Method Between Classes
        1. Identifying Appropriate Method Homes
          1. Maintaining Object Relationships
            1. Preserving Encapsulation
            2. Move Field Between Classes
              1. Data Ownership Principles
                1. Maintaining Data Integrity
                2. Extract Class
                  1. Identifying Separate Responsibilities
                    1. Creating Cohesive Classes
                      1. Managing Class Relationships
                      2. Inline Class
                        1. Removing Unnecessary Class Abstractions
                          1. Simplifying Object Hierarchies
                          2. Hide Delegate
                            1. Encapsulating Object Relationships
                              1. Reducing Client Dependencies
                              2. Remove Middle Man
                                1. Eliminating Unnecessary Delegation
                                  1. Direct Access Patterns
                                2. Data Organization Refactoring
                                  1. Self Encapsulate Field
                                    1. Using Property Decorators
                                      1. Getter and Setter Implementation
                                        1. Data Access Control
                                        2. Replace Data Value with Object
                                          1. Encapsulating Primitive Data
                                            1. Adding Behavior to Data
                                              1. Type Safety Improvements
                                              2. Replace Array with Object
                                                1. Creating Specialized Collections
                                                  1. Adding Collection Behavior
                                                    1. Type-Safe Data Structures
                                                    2. Change Value to Reference
                                                      1. Managing Shared Object State
                                                        1. Identity vs Equality Considerations
                                                        2. Change Reference to Value
                                                          1. Creating Immutable Objects
                                                            1. Value Object Patterns
                                                          2. Inheritance and Polymorphism Refactoring
                                                            1. Pull Up Method
                                                              1. Moving Common Methods to Superclass
                                                                1. Reducing Code Duplication
                                                                  1. Template Method Pattern
                                                                  2. Pull Up Field
                                                                    1. Sharing Common Data in Superclass
                                                                      1. Inheritance Hierarchy Optimization
                                                                      2. Push Down Method
                                                                        1. Specializing Methods in Subclasses
                                                                          1. Removing Unused Abstractions
                                                                          2. Push Down Field
                                                                            1. Moving Specialized Data to Subclasses
                                                                            2. Extract Superclass
                                                                              1. Creating Abstract Base Classes
                                                                                1. Factoring Common Behavior
                                                                                2. Extract Subclass
                                                                                  1. Specializing Object Behavior
                                                                                    1. Conditional Logic Elimination
                                                                                    2. Extract Interface
                                                                                      1. Defining Protocols and ABCs
                                                                                        1. Contract-Based Programming
                                                                                        2. Collapse Hierarchy
                                                                                          1. Simplifying Inheritance Trees
                                                                                            1. Removing Unnecessary Abstractions
                                                                                            2. Replace Inheritance with Delegation
                                                                                              1. Favoring Composition over Inheritance
                                                                                                1. Flexible Object Relationships
                                                                                                2. Replace Delegation with Inheritance
                                                                                                  1. Simplifying Object Relationships
                                                                                                    1. When Inheritance is Appropriate