Are there any prescribed patterns or systems for allowing a user to create custom domain logic? Consider the following scenario

An application exists that allows users to run complex calculations on the applications datasets(these calculations would be the domain logic). The owners of the application are a team of mechanical engineers, they want to update the available calculations often and frequently.

This specific problem is one im facing at work, but the problem feels generic enough that I wondered if there's a common solution. For what its worth our current intended solution is to have the mechanical engineers write the calculations in vb using raw sql and handing us a dll to redeploy. So literally anything is better.

  • Maybe. a. plug-in architecture, or a component architecture....keywords to look for. But there's a lot. to think. about. Start with, how much. can you. trust their. business logic? – joshp Oct 20 at 3:20
  • This comes up at different guises and at different levels of generality. On one end of the spectrum, there are scripting engines that expose some subset of application functionality to the users. Then there are visual-node based editors, like Unreal Engine's Blueprints, or Blender Nodes. Also check out rule engines. Some simpler (or more constrained) interfaces let users define responses to input by combining predefined domain-specific "blocks" of functionality (often also parameterized in some way) using AND, OR, IF, etc. (e.g. via dropdowns) – Filip Milovanović Oct 20 at 7:16
  • Another option that may work given that the application owners are engineers is for them to learn to program in your implementation language and let them edit and publish the domain code using the same techniques that you might use yourself. You'll want to make sure you have good separation between the domain and infrastructure layers of the program, and robust automated code quality checks. – bdsl Oct 20 at 10:16

The pattern or system would be a programming language (either a general purpose language or a domain specific language) which could be implemented either by an interpreter or a compiler.

There are many unknowns in your question, so recommending a specific solution doesn't make sense. Here are just some points that should be considered to find a solution that fits the problem:

  • How complex is the domain logic? Do you just have formulas based on a number of variables in data records, or arbitrary computations with CRUD operations on the database?
  • How often is the domain logic changed, and how quickly should changes be deployed?
  • What are the security implications of users writing code to be executed in the application context?
  • Should code be executed on client workstations or on the server?
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.