Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding Cat vaccination, implementing Strategy pattern #358

Merged
merged 2 commits into from
Sep 27, 2024

Conversation

ghadyg
Copy link
Collaborator

@ghadyg ghadyg commented Sep 26, 2024

Pull Request Title: Implement Strategy Pattern for Pet Vaccination

Description

This pull request introduces a strategy pattern implementation for pet vaccination in the VaccinationService. Two specific implementations are provided: one for dog vaccinations and one for cat vaccinations.

Changes Made

  • VaccinationServiceImpl: Updated the save method to utilize a Map<PetType, VaccinationStrategy> for delegating vaccination logic based on the pet type.
  • VaccinationStrategyConfig: Supplies DogVaccinationStrategy and CatVaccinationStrategy beans, facilitating easier implementation and selection of the appropriate vaccination strategy in the service.
  • VaccinationStrategy Interface: Created an interface for vaccination strategies that define the vaccinate method.
  • DogVaccinationStrategy: Implemented the vaccination logic specific to dogs.
  • CatVaccinationStrategy: Implemented the vaccination logic specific to cats.
  • VaccinationServiceTest: Modified the unit tests to work with the new implementation pattern and ensure all tests pass successfully.

Notes

Please review the implementation of the strategy pattern for any potential improvements or adjustments. Feedback is welcome!

Copy link
Owner

@josdem josdem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it @ghadyg good job! just a small change before merge.

Copy link
Collaborator

@kaminuma kaminuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!
good job

@josdem josdem merged commit 0f1dfe5 into josdem:main Sep 27, 2024
1 check failed
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.

3 participants