Where do we write business code?

7 reasons to use WAQS

WAQS documentation


Maintainability issue

The business code often is spread out pretty much everywhere in the application: in entities on the server side, in the entities on the client side, in services, in ViewModels.

This is described by the “spaghetti code” expression. It makes maintainability harder.

Furthermore, we often have a business code duplication between the server and the client sides which is not good and which is a potential risk when you have to change your business logic.

In addition, business code often is mixed with technical one. It also makes maintainability harder because the developer intention could be lost in a complex code in this case.

WAQS business code approach

WAQS address this point with a way very different than usual. With WAQS, business code is written outside the rest of the code without any technical aspect.

This code will never be executed. It will only be used by WAQS T4 templates as a model. Indeed T4 templates analyze this code using Roslyn and will inject it in the different layers mixing it with technical code on T4 generation process.

With this way, code writing and maintainability become easier.

Furthermore, contrary to private rules engines, WAQS doesn’t use any “black-box”. The T4 meta-code is available and the result code is generated in your project so it will be very easy to debug which can help you to understand it.

In addition, contrary to an XML description with a limited expressiveness, WAQS lets you use C# to write our business code.

Some solutions (often based on DSL) propose a designer above the XML. However, it is not as good as C# for productivity and, in addition, developers often dislike this way on which they don’t code anymore and they “just draw some rectangles and arrows”. With WAQS, they continue doing what they know and like: coding!

WAQS identifies three business rules kinds:

  • Calculated properties
  • Validation methods
  • Service methods

By default, you have to define your business code in the Specifications folder created by WAQS NuGet command execution.

This entry was posted in 16868. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *