Skip to content

Conversation

@Arthur-0896
Copy link

�� Pull Request

🎯 Goal

#2

🛠 Type of Change

  • [✅] ✨ New Language Implementation adding 'java' to 01-ocp
  • 🐛 Bug Fix
  • 📚 Documentation Update
  • ♻️ Refactor

📝 Implementation Details

Bad example:

  • Created a Class Salary calculator that calculates salary using conditional logic, thereby violating ocp. To add salary computation for a different type, a new conditional check would need to be added.

Good example:

  • Created an abstract Employee class that just has a 'name' property and an abstract method calculateSalary()
  • Extending classes need to provide their own implementation of calculateSalary()
  • Therefore, using ocp, the feature is a lot more scalable as new use cases can simply extend the Employee class and provide their specialized implementation.

✅ Checklist

  • [✅] I have followed the directory structure: case-studies/[case-study]/[language]/bad & case-studies/[case-study]/[language]/good.
  • [✅] Bad Version: Clearly violates the principle but still runs/compiles.
  • [✅] Good Version: Refactored code that demonstrates the SOLID principle.
  • [✅] Documentation: Included a README.md with "How to Run" instructions.
  • [❌] Tests: Added unit tests (highly encouraged!).

📸 Screenshots / Output (Optional)

Bad output:
image

Good output:
image

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