Single responsibility principle (SRP)
The first principle that the team applies is the single responsibility principle (SRP). The team identified that the actual mechanism of writing to the console is not the responsibility of the InventoryCommand classes. Because of this, a ConsoleUserInterface class is introduced that is responsible for the interaction with the user. SRP will help keep the InventoryCommand classes smaller and avoid situations where the same code is duplicated. For example, the application should have a uniform way of prompting the user for information and displaying messages and warnings. Instead of repeating this in the InventoryCommand classes, this logic is encapsulated in the ConsoleUserInterface class.
The ConsoleUserInteraface ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access