Skip to content

Suggestions to Improve SOLID Principles Adherence #18

@emiemilioo

Description

@emiemilioo

Hi Kalutu!,

First of all, congratulations on creating this repository! It's an excellent resource for Java beginners, and the variety of projects is fantastic.
I was analyzing the structure of some of the projects to study software design principles, and I'd like to share some constructive feedback on how they could be even more aligned with the SOLID principles. I believe this could serve as an excellent learning exercise for the repository's users.

I've noticed a common pattern in several classes that could be improved:

  • Single Responsibility Principle (SRP): Classes like Calculator, ContactBook, and FileEncryptionDecryption tend to mix business logic with user interface logic (console printouts). Separating these concerns would make the code more reusable and easier to test.
  • Open/Closed Principle (OCP): In classes like AddressBook and Calculator, using switch blocks to manage menu options requires modifying existing code to add new features. This could be solved by applying the Command Design Pattern.
  • Dependency Inversion Principle (DIP): Classes like Library and BankAccountManagementSystem create their own dependencies (e.g., new ArrayList<>(), new HashMap<>). Injecting these dependencies through the constructor would make the code much more flexible and decoupled.

This is not a critique, but rather a suggestion to take the projects to the next level of software quality, which would be very educational for the beginners who study them.

Thanks again for your great work!
Best regards,emiemilioo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions