Bytz.Collections.Dispatch 1.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Bytz.Collections.Dispatch --version 1.3.0                
NuGet\Install-Package Bytz.Collections.Dispatch -Version 1.3.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bytz.Collections.Dispatch" Version="1.3.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Bytz.Collections.Dispatch --version 1.3.0                
#r "nuget: Bytz.Collections.Dispatch, 1.3.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Bytz.Collections.Dispatch as a Cake Addin
#addin nuget:?package=Bytz.Collections.Dispatch&version=1.3.0

// Install Bytz.Collections.Dispatch as a Cake Tool
#tool nuget:?package=Bytz.Collections.Dispatch&version=1.3.0                

Bytz.Collections.Dispatch

Issue

If-then-else blocks are cumbersome and also require a lot of repetitive executions by a developer and qa testing time in order to troubleshoot.

Being able to consolidate conditions (rules) into a testable container would increase software product quality without ever calling any method call or function return.

Goals

  • Have more concise expression of boolean conditons.
  • Simpify understanding of boolean conditons to programmers conversant with LinQ expressions.
  • Allow testing of boolean conditions without executing code that may call complex calculations, make calls to databases, etc.

Benefits

  • Conciseness of the definition of if-then-else conditions.
  • Ability to test logical branching without having to create dependent instance trees.
  • Potential performance increases could be attained by the order that conditions are defined.

A Customer Order Discount Examples

A simple example of a calculation involving customer discounts follows is as follows:

  • If the customer has any order over 50K in the last year, they get a discount of 18%.
  • If an "individual" customer has an order within the last six months over $500, they get a 10% discount

Implementation as If-Then-Else

Alt text

Implementation within a Dispatch Function-List

Alt text

Calling of the Dispatch Function-List

A fairly simple example of calling a dispatch list of functions could be where a customer is checking-out to calculate a discount for the current order.

Alt text

Testing

Since the "rules" are defined in a FunctionList, we can validate that our indexes are as expectd by testing with various inputs. Alt text

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.8.0 283 11/23/2023
1.3.1 148 11/12/2023
1.3.0 132 11/12/2023
1.2.0 144 11/12/2023
1.1.11 141 11/12/2023
1.1.10 116 11/12/2023
1.1.5 141 11/12/2023
1.1.4 127 11/12/2023
1.1.3 138 11/12/2023
1.1.2 119 11/12/2023
1.1.1 135 11/12/2023
1.1.0 146 11/5/2023
1.0.10 159 11/4/2023
1.0.9 138 11/4/2023
1.0.8 151 11/4/2023
1.0.7 148 11/4/2023
1.0.5 144 11/4/2023
1.0.4 138 11/4/2023
1.0.3 143 11/4/2023
1.0.2 144 11/4/2023
1.0.1 134 11/3/2023
1.0.0 146 11/3/2023