Craig Oates




All Software Projects

About Console.Waterworks

Console.Waterworks is a NuGet package. It aim is to help you write extendable and command-based console programs in C# and .Net. One of the main struggles with writing software is the need to write "plumbing code". It is the code which does not solve the main problem but it is necessary for us to reach a solution. This is why we all feel frustrated when we need to write it. It feels like we are going the long way round to that dream holiday in the sun. This is qwhy I created Console.Waterworks. I believe we should face frustration when it finds us and only then. Why go looking for it?

Amongst other things, Console.Waterworks has this one very handy trick. It allows you to write methods which become a run-time command -- which is quite the time saver. When you use Console.Waterworks, you, also, do not need to parse end-user input. The reason why is because Console.Waterworks does it for you. This means, when people run your program, they type the method name in and your code begins executing. On top of that, Console.Waterworks handles bad input and method parameters, as well.

Do not panic if none of what I just said made sense. I threw a lot of information at you in a short span of time. It is okay and not unexpected. Because of this, I have prepared several images showing Console.Waterworks in action. Please feel free to check it out. It should help explain what Console.Waterworks is and how it works.

Good Input Data Flow

Good input example
Figure 1: If the user enters valid input into the console, Console.Waterworks passes it to your code for processing.

Bad Input Data Flow

Bad input example
Figure 2: If the user enters invalid input into the console, Console.Waterworks will display an error message to the user.

Code Example - Validating Input

Code Example 1
Code Example 1: When good input is entered, your code is executed. When it is not, and error message is displayed.

Code Example 2
Code Example 2: When bad input is entered.

Another feature Console.Waterworks has is the self-documenting help section. To use it, decorate your "command-methods" in the "Console Commands" class and create a command-method to display it.

Code Example - Built-in Help

Code Example 3
Code Example 3: Type 'Help' into the console to see a list of commands and descriptions of what they do.


Console.Waterworks is based on the ConsoleApplicationBase repository by TypecastException.


To use Console.Waterworks, I recommend you meet the following pre-requisites:


Console.Waterworks is on Git.Abbether. Feel free to check out the source code, clone it and fork it: Git.Abbether Repository