Skip to content

Refactor code for improved readability and maintainability#21

Merged
ZanDev32 merged 9 commits into
mainfrom
Refactoring
Aug 23, 2025
Merged

Refactor code for improved readability and maintainability#21
ZanDev32 merged 9 commits into
mainfrom
Refactoring

Conversation

@ZanDev32

Copy link
Copy Markdown
Owner

Enhance code structure by updating class visibility, utilizing getter and setter methods, and simplifying logic across various components. Improve exception handling and logging consistency while ensuring better formatting in tests and controllers. Address minor issues to further refine the codebase.

- Changed public class declarations to package-private for test classes.
- Introduced constants for repeated string literals (e.g., admin username).
- Simplified XML file loading logic in PostDataRepository.
- Added helper methods in NutritionParserTest to reduce assertion count and improve readability.
- Updated FXML test cases to use text blocks for better formatting.
- Ensured consistent method visibility across test classes.
…hods

- Updated PostDataRepositoryTest to replace direct field access with getter/setter methods for likecount, commentcount, and isLiked.
- Modified PostLikedStateTest to utilize getter/setter methods for post attributes.
- Refactored PostTest to ensure all field assertions use getter/setter methods.
- Adjusted UserDataRepositoryTest to implement getter/setter methods for user attributes.
- Revised UserTest to access user fields through getter/setter methods.
- Enhanced ChatHistoryManagerTest to utilize getter methods for message attributes.
- Updated NutritionParserTest to replace direct field access with getter methods for nutrition attributes.
- Refactored SessionTest to ensure user attributes are accessed via getter/setter methods.
… image loading utility and improve data persistence exception handling
…ity and maintainability

- Consolidated duplicated string literals into constants in PostController.
- Introduced dedicated exception for nutrition analysis retries.
- Refactored UI update methods in PostController for clarity and separation of concerns.
- Simplified nutrition facts population logic and added helper methods for better structure.
- Updated logging to use lambda expressions for deferred message construction.
- Enhanced error handling in ChatHistoryManager and FileSystemManager with clearer logging.
- Refactored image path resolution logic in FileSystemManager to reduce complexity.
- Improved fallback image handling and logging consistency across the application.
- Updated PostItemController and RecipeItemController to use a unified method for opening posts.
@ZanDev32
ZanDev32 merged commit d00f4ec into main Aug 23, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant