Skip to content

Conversation

@Arthur-0896
Copy link

@Arthur-0896 Arthur-0896 commented Dec 19, 2025

�� Pull Request

🎯 Goal

https://github.com/MehediMubin/solid-by-example/issues

🛠 Type of Change

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

📝 Implementation Details

Summary of Changes
Bad Example (bad/KeywordOrchestrator.java):

  • All logic (file reading, validation, API call, and database operation) is combined in a single method
  • This violates SRP because the class handles multiple responsibilities, making it hard to maintain and extend.

Good Example (good/KeywordOrchestrator.java):

  • The logic is split into separate classes/services: CsvFileParser, KeywordValidator, SearchVolumeService, and StatsRepository.
    KeywordOrchestrator coordinates these services, each with a single responsibility.
  • This follows SRP, making the code modular, testable, and maintainable.

Approach
The "bad" example demonstrates a monolithic, tightly-coupled design.
The "good" example uses composition and delegation, mimicking a microservices-like structure within the application.

Each service/class is responsible for one aspect of the workflow, adhering to SOLID principles.

Tools and Versions Used
Java Version: JDK 21
Build/Run Tool: Standard Java compiler and runtime (javac and java)
IDE/Editor: Visual Studio Code
No external libraries are required; only standard Java is used.

✅ 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