Questions people ask

These are the ones I'd ask too. If yours isn't here, ask it.

Why not just write if/else?

For a dozen rules that rarely change, you should. The Why page says the same thing.

rulii is for when there are enough of them that you can't find them any more, and they change often. At that point an if statement inside a service method is expensive. Nobody is sure what else the method does, so every change means retesting everything around it.

A rule has a name, a test of its own and a page in the explorer. It's still plain Java. It just has an address.

Where did rulii come from?

It started as ruling-class. I began it around 2017 in my spare time and released it in 2019. Some of my clients put it into production, and a few still run it today.

Most of what's in rulii was already there in some form. ruling-class has been on GitHub since July 2019. Rule sets went in nine days after the first commit, rule flows a week after that, and the validation rules started that September. Bean validation followed in January 2021. That's 523 commits, most of them before 2022, and you can read every one.

In 2024 I rewrote it from the ground up as rulii, with a functional style, proper builders and a redesigned core. The Why page has the whole story.

How fast is it?

Fast enough that it won't be the slow part.

On one thread, rulii 2.3.0 runs about 8 million simple rules a second, 329,000 rule sets of twenty rules, and 1.5 million five-step flows. That's the engine on its own, with rules that do next to nothing.

Your rules will do something. If a rule calls a database, it runs as fast as the database. What I can promise is that the engine isn't what you'll be waiting for.

These numbers are rulii against its own last release, and how they got there is written up, including what didn't work.

Was this written by AI?

The engine: I designed it and wrote almost all of it. AI helped me where I lacked the time. It helped me polish, test and document it. ruling-class was poorly documented, with little Javadoc, and I was struggling to reach 50% test coverage. I don't believe I could ever have tested or documented rulii to the level I have without the help of AI. It helped me make the leap from something I used to something I could put in front of a wider audience.

The engine is older than the tools, as the history above shows, and I wrote the 2024 rewrite too. The Claude Code skills are checked into the repositories, in plain sight, and I've written about how I'd use an assistant on a project like yours.

The explorer and Bean Validation are a different story.

The explorer is where it did more. It's new this year, there was nothing like it in ruling-class, and AI did a lot of the heavy lifting there, the user interface most of all.

Bean Validation sits in between. What I'd written was a good start, but it wasn't on par with Hibernate Validator. AI found the differences and helped me bridge them. What's left is written down.

Either way, I answer for every line of it, whoever typed it.

It's a single maintainer. What if you stop?

It's a fair worry, and yes, it's me.

What I can offer is this. It's Apache 2.0. The engine is one jar with no required dependencies, about 400 source files and over 1,700 tests, in plain Java. One person can read it, and one person can fork it.

It's been in the open since 2019, first as ruling-class, and it runs in production. I built it because I needed it, and I'll keep at it for the same reason.

If that's not enough, the usual insurance applies. Send a pull request and become the second maintainer.

You bind by parameter name. What if the names aren't in the class file?

The names come from the class file. Maven keeps them by default, so most people never notice.

If your build strips debug information, a rule class needs one of two things: compile with -parameters, or put @Param("name") on each parameter. Both work.

Lambdas are different. Their parameter names only exist in debug information, and -parameters doesn't write them. So keep debug information on, or write that rule as a class, and bind values with bind("name", value).

When a name is missing, rulii matches by type. That works while one value has that type. If two do, it stops with an exception that names the parameter. The details are in the overview.