O'Reilly logo

Hands-On Design Patterns with C# and .NET Core by Jeffrey Chilberto, Gaurav Aroraa

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

InventoryCommand abstract class

The first thing to point out about the initial console application is that the team is using object-oriented programming (OOP) to create a standard way of handling commands. What the team learned from this initial design is that all commands will contain a RunCommand() method that will return two Booleans indicating whether the command was successful and whether the program should terminate. For example, the HelpCommand() will simply display a help message to the console and should not cause the program to end. The two return Booleans would then be true, to indicate that the command ran successfully and false, to indicate that the application should not terminate. The following shows the initial version:

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required