SOLID Design Principles - Single Responsibility Principle #shorts

preview_player
Показать описание
Single Responsibility Principle in Java
#shortsfeed
#shorts
#short
SOLID principles

Single Responsibility principle in Java says that a class is responsible for only one thing.
This makes class easier to understand, modify, maintain. It also makes class modular and testable.

Example: For a class like EmailSender, its only purpose should be to send emails.
If you add functionality like creating email templates or managing email contacts , then you are violating single responsibility principle.

Instead you should create separate classes like EmailTemplates and EmailContacts to handles such tasks.

Subscribe Channel:
Рекомендации по теме