配置存储设置[文件与数据库] [英] Configuration storage setup [file vs. database]

查看:128
本文介绍了配置存储设置[文件与数据库]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到程序员将大量信息放到数据库中,而这些信息本来可以放到保存数组的文件中.他们相信它们会使用许多SQL表,而不是数组,但我认为这很慢.

I see programmers putting a lot of information into databases that could otherwise be put in a file that holds arrays. Instead of arrays, they'll use many tables of SQL which, I believe, is slower.

CitrusDB在数据库中有一个名为假日"的表.该表仅包含一个名为"holiday_date"的日期列,其中包含假日.这个想法是让用户将假期添加到表中.与我在工作场所工作的Citrus和程序员比较喜欢将所有这些信息放在表中,因为它们是标准"的.

CitrusDB has a table in the database called "holiday". This table consists of just one date column called "holiday_date" that holds dates that are holidays. The idea is to let the user add holidays to the table. Citrus and the programmers I work with at my workplace will prefer to put all this information in tables because it is "standard".

除非您允许用户通过用户界面添加假期,否则我不明白为什么会这样.我感觉到我缺少一些东西.

I don't see why this would be true unless you are allowing the user, through a user interface, to add holidays. I have a feeling there's something I'm missing.

推荐答案

有时您想为产品设计一些灵活性.如果您的产品在假期不同的国家/地区发布,该怎么办?只需调整桌子,一切都会正常.如果将其硬编码到应用程序中,或者更糟的是,将其硬编码到应用程序中的许多不同位置,那么您可能会很痛苦地尝试使其在新的语言环境中工作.

Sometimes you want to design in a bit of flexibility to a product. What if your product is released in a different country with different holidays? Just tweak the table and everything will work fine. If it's hard coded into the application, or worse, hard coded in many different places through the application, you could be in a world of pain trying to get it to work in the new locale.

通过使用表,还有一种访问此信息的方法,这可能会使程序更一致,并且更易于维护.

By using tables, there is also a single way of accessing this information, which probably makes the program more consistent, and easier to maintain.

有时候效率/速度并不是设计的唯一动力.可维护性,灵活性等是非常重要的因素.

Sometimes efficiency/speed is not the only motivation for a design. Maintainability, flexibility, etc are very important factors.

这篇关于配置存储设置[文件与数据库]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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