Skip to content

Conversation

@samshad
Copy link

@samshad samshad commented Mar 29, 2024

Added some new test cases and refactored some code smells.

Enhanced Code Clarity:
• Decomposed Conditions: Complex conditions in methods like isEmoji (EmojiManager) are broken down into smaller, more manageable checks. This improves readability and makes the code easier to understand.
• Extracted Methods: Long statements are extracted into separate methods, reducing code clutter and enhancing focus within the main functions.
• Renamed Methods/Variables: Methods and variables are renamed to adhere to Java naming conventions, making their purpose clearer.

Improved Maintainability:
• Pull-up Variables: Code duplication is reduced by pulling up repeated calls to methods like getUnicode into local variables within methods like equals (Emoji).
• Polymorphism: Conditional logic relying on specific implementations is replaced with polymorphism (e.g., isOnlyEmojis in EmojiManager). This allows for easier switching of validation strategies in the future.
• Moved Methods/Fields: Code with specific responsibilities is moved to dedicated helper classes (e.g., toString method moved to EmojiFormatter). This promotes modularity and reusability.

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