Friday, April 28, 2023

Improve Code Coverage Metric

 I know, every body knows that Code Coverage is a weak metric (Link). But there are two ways to improve the value of he code coverage metrics:

  1. Remove all exclusion pattern
  2. Remove integration test from the calculation

Point 1 should avoids that you cheat your self.

Point 2 is not so obviously but it's easy to explain. Integration tests ensure that the whole software or larger parts work. Unit tests are the result of TDD and code coverage could measure the TDD impact. That's the reason why only unit tests should part of the code coverage calculation.

Friday, April 7, 2023

CQRS/CQS is a way to share data over two micro services via common data source

 Best practice in micro service design is share nothing. every micro service have it own data store. This makes the micro services resilient against slow data provider and resilient against outages of data delivering micro services. But there is one way to speed up this micro service architecture. If you use the CQRS pattern (Query Responsibility Segregation) or CQS pattern (Query Command Separation), my favorite pattern, and combine it with micro services.

Service A write or modify data only e.g. import billing data as large CSV  from the main frame. And Service B (E-Commerce-Backend) read only the data. Service B doesn't alter the data, it's a read only service. Both services using the same data source. Under this conditions (CQS) a common data source is a save and easy way to handle common data in a micro service environment.