Qi4CS is a free and open-source framework to help developers to manage code complexity and reduce the amount of boilerplate code. The goal of the Qi4CS framework is to let developer concentrate fully on the business features and the domain-specific requirements of the application.
The origins of Qi4CS are in the Qi4j framework, which was the inspirer for Qi4CS. The Qi4CS aims to fill the gap for tools like Qi4j in C# and CLR world.
There are several ways how Qi4CS achieves its goal to ease up the life of developers. All of following features rely on core .NET and CLR features, and don’t introduce additonal language syntax.
First, Qi4CS uses the following concepts from AOP (Aspect-Oriented Programming): method intercepting, pointcut specification. This is similar to how AOP is used in Java Spring framework, except that Qi4CS does not require additional XML files for bootstrap.
Then there is COP (Composite-Oriented Programming), which aims to make actually object-oriented code instead of class-oriented code. In Qi4CS composites are special objects, which delegate method calls to fragments, which are user-supplied objects. This enables more explicit separation of business logic from the additional and possibly not domain-related checks and other boilerplate code, which can be done in separate fragments. These composites are fully managed by Qi4CS, reducing this burden from the developer.
The fragments that are used by Qi4CS composites are the same as in Qi4j, that is, Mixins, Concerns, Side Effects and Constraints. The philosophy of the fragment types is that
- Mixins should have the actual core implementation
- Concerns should introduce some domain-specific pre- or post-checks (e.g. starting/ending transactions, etc) and act as interceptors
- Side Effects should perform domain-specific functionality after the Mixin and Concerns have finished (e.g. logging)
- Constraints should perform state-dependless checking for method input and output parameters.
Unlike in Qi4j, all fragments except Constraints have both read and write access to composite state shared between the fragments.
Last but not least, Qi4CS introduces a powerful DI (Dependency Injection, a.k.a. IoC – Inversion of Control) engine, very similar to the one in Qi4j. The DI feature of Qi4CS allows developer to declaratively specify dependencies for any of the fragments, letting Qi4CS inject the objects that the fragment depends upon. This relieves the developer of the tedious task of passing dependencies explicitly e.g. on object creation.
The Qi4CS will integrate seamlessly into your build process and will generate all the required code for your application during the build phase. Your original assemblies will not be modified – all Qi4CS-generated code will be in separate assemblies. Furthermore, only code for the used features in your application will be generated. At runtime, the Qi4CS will load the generated assemblies and the overhead for method calls will be minimal. Thus the performance penalty will be minimal for all the useful features provided by Qi4CS.
The original Qi4j is currently called as Apache Polygene. Stanislav Muhametsin from Cometa Solutions Oy is also in the Project Management Committee of the Apache Polygene project. If you wish to know more, for instance, about Domain Driven Design, Aspec Oriented Programming, Composite Oriented Programming, Dependency Injection, Qi4CS, or Apache polygene, you can contact us.