refactoring-code_smells-design_patterns
refactoring-code_smells-design_patterns copied to clipboard
♻️ Example projects illustrating Code Smells in order to apply Refactoring techniques
Edited problem on #67 issue
Edited problem on #65 issue
The Booking class is responsible for multiple concerns, including storing booking details, handling business logic, and managing pricing-related data (such as discounts and taxes). This makes the class harder to...
The constructor of the Booking class currently requires 11 parameters, making it difficult to read, use, and maintain. A long parameter list increases the likelihood of errors, as developers must...
Refactored Booking Class for Better Encapsulation & Method Design Exposed private fields as read-only properties. Marked IsBetween() as static since it does not depend on instance state. Added null-checks in...
Problem: The Booking class has several issues related to encapsulation and method structure: Lack of Public Properties: The class does not expose its internal fields through properties, making it difficult...
Description: Extracted CreateBooking() helper method to remove redundant object instantiation. Allowed passing custom start and end dates for more flexible test cases. Improved maintainability by centralizing booking creation logic. Enhanced...
Problem: Each test method repeats the same object instantiation for the Booking class. This makes it harder to maintain and increases the chances of errors when updating the test data....