946 B
946 B
Refactor the specified code to improve quality and maintainability. Focus on:
-
Code Structure
- Extract complex methods/functions
- Reduce function/method length
- Separate concerns appropriately
- Apply SOLID principles
-
Code Quality
- Remove code duplication (DRY)
- Improve naming for clarity
- Simplify complex conditionals
- Replace magic numbers with constants
-
Design Patterns
- Identify applicable design patterns
- Suggest pattern implementations
- Improve abstraction levels
-
Maintainability
- Reduce cyclomatic complexity
- Improve testability
- Enhance readability
- Add appropriate comments for complex logic
-
Backward Compatibility
- Ensure existing functionality is preserved
- Maintain existing test coverage
- Document any breaking changes
Provide before/after code examples with clear explanations of the improvements and their benefits.