General Business Rules for C # and Java Objects

I have a system with Java server side objects and C # client objects. Objects can be modified on both sides of the system and therefore business rules are attached to them. The fact is that business rules live only on the server side, and I really want to avoid the need to access the server every time I want to check objects.

Ideally, I want to have general business rules that can be used in both C # and Java, so when a change is needed, I apply it only in one place (and, obviously, expand it in 2).

Are there any suggestions on how I can do this?

+4
source share
2 answers

It may seem awful at first, but you can really consider coding business rules in javascript.

There are javascript engines available both on the Java platform and on the .NET platform. Thus, by hosting a (different) javascript engine on both the server (java) and the client (C #), they can execute the same javascript to enforce business rules.

Think of it as your choice of business rules. This is not a bad choice for the task, as it is concise, flexible and well-known.

I once did something similar to set up flexible rules for playing a java game. Javascript engines are surprisingly easy to set up, and these days they are also becoming very fast.

+5
source

Try using IKVM

+2
source

All Articles