如何在语言之间共享配置信息或业务规则 [英] How do you share configuration information or business rules between languages

查看:220
本文介绍了如何在语言之间共享配置信息或业务规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找在不同地方使用相同数据的最佳做法,无需重复自己 - 这可能包括配置或业务规则。

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

示例1.要在客户端上使用javascript验证数据验证规则,但要确保

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.

示例2.您的Web服务器和您的cronjob使用相同的密码username的数据库访问。

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.

推荐答案

JSON 。有一个JSON库,几乎任何语言你会想,或者如果不是,它很容易编码一个。如果JSON不够,请查看 YAML

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.

这篇关于如何在语言之间共享配置信息或业务规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆