Search code examples
language-agnosticconfigurationdrybusiness-rules

How do you share configuration information or business rules between languages


I'm looking for best practices for using the same data in different places without repeating yourself - this could include configuration or business rules.

Example 1. Data validation rules where you want to validate on the client using javascript, but you want to make sure by validating on the server.

Example 2. Database access where your web server and your cronjobs use the same password, username.

Ease of processing and a human-readable solution would be a plus.


Solution

  • Encode your data in JSON. There's a JSON library for pretty much any language you'd care to think of, or if not, it's pretty easy to code one up. If JSON is not enough, perhaps look at YAML.