Member-only story

Rule Engine: A New Library That Eradicates If-Else Statements

From 20 to 0 if-else statements

Mohammed Ayar
11 min readMar 30, 2023
Image generated using MidJourney

My colleague recently messaged me a link to a GitHub repo hosting a Microsoft C# library called “RulesEngine.”

Word is, the library has caught the attention of our dev teams.

Sure enough, it didn’t catch mine — I’d never heard of such a library.

But since I’m always keen on keeping up with the latest software development trends, I decided to get down the rabbit hole.

It turned out I made a good decision.

“Rules Engines” definitely shines when used appropriately!

Thanks to it, I could eliminate an entire corpus of complex if-else statements in an end-to-end project.

And in this article, I’ll walk you through the exact same project where I accomplished that showcasing the remarkable capabilities of Rules Engines.

Table of Contents

Rules Engine: Definition?
Rules Engine: Architecture?
Project Time:
#1. Requirements
#2. Data
#3. Business Rules
#4. Friendly Advice
Design
Implementation
#1. Input/Output
#2. Rules Handling
#3. Students and Classes
#4. Allocations
Testing
Code Quality: Cyclomatic…

--

--

Mohammed Ayar
Mohammed Ayar

Written by Mohammed Ayar

Software and crypto in simple terms. Ideas that make you think.

Responses (18)