Simple abstractions we use to follow the CQS Principle in applications.
The CQS Principle states that "every method should either be a command that performs an action, or a query that returns data to the caller, but not both" to reduce side effects.
In our projects we use abstractions like Query & QueryHandler as well as Command & CommandHandler to follow this principle. However, there is a bit of fine print here that makes it worthwhile to reuse this in the form of a library:
- a command / query needs to be valid (determined by a MessageValidator), otherwise a Command/Query-ValidationExcption will be thrown
- a command / query needs to be valid (determined by an optional message on the handler), otherwise a Command/Query-ValidationException will be thrown
- a command / query needs to be verified by a mandatory method in the handler, otherwise a Command/Query-VerificationException will be thrown
- when a command / query is handled, any exception it may throw is wrapped in a Command/Query-HandlingException
TODO
cqs is a parent-only artifact (packaging: pom).
Use cqs-core as dependency:
<dependency>
<groupId>eu.prismacapacity</groupId>
<artifactId>cqs-core</artifactId>
<version><!-- put the desired version in here--></version>
</dependency>
TODO
TODO
TODO
TODO