If you want all of the following, you want the Vergosity Framework:

  1. Testable Business Logic and Rules
  2. Extensible Code to add features whenever, wherever you want.
  3. Maintainable code that is sustainable for the life of the software.

As a developer, you want to create high-quality software. In order to achieve this, you will need to follow many disciplines, use a variety of tools and processes. There is an art and a science when developing software. One way to improve the quality of your software is to make it more consistent. Consistency in the code-base also carries another benefit – the code is easier to maintain over time. Therefore, consistent code throughout the life of the project increases the quality of the code. You have to have an easy way to create consistency – the Vergosity Framework provides the tools and process to do this.

The Vergosity Framework provides a structure or set of patterns to implement business logic for applications. One of the main goals of the framework is to make it easier to test your applications unit tests and/or test-driven development approaches. Many times the reason for not unit testing is not that the developers does not know how to do it – it is that the architecture, patterns, or structure of the code do not allow for unit testing. The Vergosity Framework removes this barrier immediately and allows you to begin unit testing. You can even start down the path of test-driven development.

Business Logic

A common outcome of not using a framework or a consistent pattern to implement business logic is that business rules and logic are scattered throughout the code base. You will have business rules and logic implemented in many different ways. It is difficult to know where to make changes or to extend application behavior. The Vergosity Framework handles this by using a simple design pattern called the template method pattern. The business action part of the framework provides a class-based approach to implementing your business logic. Typically, most business logic is implemented in class methods. However, using a class-based approach allows you to use all of the object-oriented goodness available. Methods cannot inherit from anything or have base methods. Classes provide the mechanism to implement base classes, abstractions, and common behavior to your business logic. Putting your business logic in distinct classes also allows you to implement unit tests, use mocking frameworks, and to use dependency injection techniques. A lot more bang for the buck when you use a class-based approach verses business methods. Most business logic implemented in methods typically turn into method-chaining exercises that really do not promote consistent, maintainable code. The techniques used in the business action framework are part convention, part patterns, and part process. There are also some productivity benefits when you use the business actions within the Vergosity Framework.

Business Rules and Data Validation

The Vergosity Framework contains a business rule and data validation engine that allows for a consistent implementation of business rule evaluation and data validation. The framework contains a set of validation rules that can be used individually or combined with other rules to create a rich validation framework. There are framework classes that allow you to create your own custom rules that can be used within the Vergosity Framework. Each rule can also be evaluated separately within your code or from unit tests. To make rule implementation and data validation easy, the Vergosity Framework allows you to decorate fields, properties, or even the business action classes with validation attributes that provide the hook into a rich set of validation and business rules. If you prefer to implement your rules with code, you can create and initialize any rules from within your code at any time.

When business rules and data validation occurs, the results are made available to the specified business action. You can evaluate the rule results and make business logic decisions based on the results of the rules. Sometimes, you may require the ability to create complex business rules. The rule engine uses a composite design pattern to allow for the creation of complex rule sets where a rule is the combination or a set of rules, and a rule within the rule set may be another composite rule. These composite rules are evaluated in the same hierarchy as they are configured. Since the evaluation of a rule provides a single result, it doesn’t matter how many or how complex the rule set is, it will always evaluate and provide a single result. You may also want to configure how a rule set is evaluated. For example, the rule engine will allow an exit on the first false evaluation. You can also configure the rule evaluation to use XOR logic where the rule evaluates to true if at least one of the rules in the rule set evaluates to true. The default rule rendering is that all rules within a composite rule are evaluated and the results of all rules are provided back to the calling code.

Scaffolding T4 Templates

The Vergosity Famework also provides some productivity tools that allow you to scaffold your business logic and rule implementation. You can use the package manager console along with the scaffolding tools from the NuGet package to increase your productivity. The Vergosity Framework contains a set of T4 Templates that allow you to create new rule attributes, new business rules, and new business actions from templates.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s