Skip to content

dylanariese/Calculator

Repository files navigation

Calculator

When a process has to perform hundreds of different calculations, some calculations depend on the outcome of other calculations and where specifications for the calculations are certain to change often. This sample is by far the fastest and cleanest way to approach such a situation by utilizing SOLID principles.

Solution

The registration below will automatically load all the classes that implement ICalculation, that have been added to the project containing the calculations, thereby obeying the single resposibility and open closed principle.

image

Calculations are segregated by two types of interfaces

IStandalone - Calculations that will be processed separately.
IDependant - Calculations that depend on the outcome of other calculations.

The calculators will be injected in the constructor of the CalculationRunner. In the constructor the segregation between IStandalone and IDependant calculations will be made based on their type.

image

All calculations will be processed asynchronous. When a calculation has completed, the outcome is added to the concurrent shared collection.

image

Dependent calculations will be processed as soon as their predicate has been fulfilled.

image

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages