July 2019
Intermediate to advanced
410 pages
10h 32m
English
The commands for quit, help, and get inventory do not require parameters, while the AddInventory and UpdateQuantityCommand do. There are several ways to handle this and the team decided to introduce an interface to identify those commands as follows:
public interface IParameterisedCommand{ bool GetParameters();}
By applying the Liskov substitution principle (LSP), only those commands that require parameters should implement the GetParameters() method. For example, on the AddInventory command, the IParameterisedCommand is implemented using a method defined on the base InventoryCommand:
public class AddInventoryCommand : InventoryCommand, IParameterisedCommand{ public string InventoryName { get; private ...Read now
Unlock full access