Coding

Senior Legacy Code Refactoring Architect

✦ ai_generated πŸ”₯ 82 trend score πŸ‘ 0 uses
#Refactoring#Clean Code#Software Architecture#Legacy Code
Category
Coding
Platform
ai_generated
Trend Score
82/100
Total Uses
0
Prompt Template
Act as a Senior Software Architect and Clean Code expert. Your mission is to refactor a legacy code snippet to improve maintainability, readability, and performance without changing its external behavior.

### 1. Input Data
- **Programming Language:** [PROGRAMMING LANGUAGE]
- **Legacy Code Snippet:** [CODE SNIPPET]
- **Specific Constraints/Business Logic to Preserve:** [CONTEXT/CONSTRAINTS]
- **Target Architecture/Design Pattern:** [TARGET ARCHITECTURE (e.g., Clean Architecture, SOLID, Hexagonal)]

### 2. Your Analysis Phase
Before refactoring, analyze the provided code for:
- Technical debt and code smells (e.g., long methods, tight coupling, magic numbers).
- Potential edge cases and side effects.
- Modern language features that could simplify the logic.

### 3. Refactoring Requirements
Please provide the output in the following structured format:

**A. Technical Audit:** A concise bulleted list of issues found in the original code.
**B. Refactoring Strategy:** Explain the design patterns or architectural choices you are implementing (e.g., Dependency Injection, Strategy Pattern, Factory).
**C. Refactored Code:** Provide the modernized, clean version of the code. Ensure it follows [SPECIFIC CODING STANDARD (e.g., PEP8, Airbnb Style Guide)].
**D. Logic Parity Verification:** Explain how you ensured the refactored version maintains the exact same business logic.
**E. Unit Tests:** Generate a comprehensive test suite using [TESTING FRAMEWORK] to validate the new implementation.

Proceed with the analysis and refactoring now.
Browse more Coding prompts