This project has moved. For the latest updates, please go here.

What

Guardly is a .NET defensive programming framework that targets to a fluent syntax, extensibility and high performance at runtime.

With the fluent syntax of Guardly you will have an access to comprehensive, extensible and high performance defensive programming practices implementation, including design-by-contract practices, fail-fast practices and runtime assertion practices.

Name "Guardly" is a pun that exploits the name of "Shouldly", which by the way has been used for Guardly unit tests.

Just as a most primitive example to start with:

public static void DoSomethingWithArgs(params string[] args)
{
    Guard.Argument(() => args, Is.NotNull, Is.NotEmpty, Has.NoNulls);
    // ...
}

Why

If you came here - you know why. Defensive programming principles help us, developers, to develop a better quality, safer and more flexible code, reducing the time to market due to less number of bugs and time spent for debugging.

Why would you spend your time copy-pasting, adopting, adjusting or refactoring the code between different solutions rather than having an extensible, well-tested and well-performing solution integrated? There are no reason for that - use Guardly.

How

Tentative plan:
  1. Install Guardly package
  2. ????
  3. PROFIT!!!
With respect to this meme, now seriously: replace the ???? with
  1. Remove duplicated null argument checks by corresponding Guard
  2. Some methods still does not have these checks at all? Add them
  3. Go further adding new contract expectations with Guard
  4. Fix the appeared issues
  5. Never get back to this code again - it's now brilliant!

Where

Guardly is available as a NuGet package.

Package Manager Console command for the latest release is easy:

PM> Install-Package Guardly

Who

You should consider to start using Guardly if:
  • You keen to design by contract
  • You want meaningful assertions
  • You like type less code and unit tests delivering more features
  • Your boss wants you to improve code quality

What's next

As a further reading check these out:

Last edited Oct 20, 2014 at 10:10 PM by Wombatush, version 19