Database As a Fortress

?

Database As a Fortress

Dan Chak

THE dATABASE iS WHERE All oF THE dATA, both input by your employ- ees and collected from your customers, resides. User interfaces, business and application logic, and even employees will come and go, but your data lasts forever. Consequently, enough cannot be said about the importance of build- ing a solid data model from Day One.

The exuberance over agile techniques has left many thinking that it’s fine, or even preferable, to design applications as you go. Gone are the days of writ- ing complex, comprehensive technical designs up front! The new school says deploy early and often. A line of code in production is better than 10 in your head. It seems almost too good to be true, and where your data is concerned, it is.

While business rules and user interfaces do evolve rapidly, the structures and relationships within the data you collect often do not. Therefore, it is critical to have your data model defined right from the start, both structurally and analytically. Migrating data from one schema to another in situ is difficult at best, time consuming always, and error prone often. While you can suffer bugs temporarily at the application layer, bugs in the database can be disastrous. Finding and fixing a data-layer design problem does not restore your data once it has been corrupted.

A solid data model is one that guarantees security of today’s data, but is also extensible for tomorrow’s. Guaranteeing security means being impervious to bugs that will—despite your best efforts—be pervasive in an ever-changing application layer. It means enforcing referential integrity. It means building in domain constraints wherever they are known. It means choosing appropriate

?

??keys that help you ensure your data’s referential integrity and constraint satis- faction. Being extensible for tomorrow means properly normalizing your data so that you can easily add architectural layers upon your data model later. It means not taking shortcuts.

The database is the final gatekeeper of your precious data. The application layer, which is by design ephemeral, cannot be its own watchdog. For the data- base to keep proper guard, the data model must be designed to reject data that does not belong, and to prevent relationships that do not make sense. Keys, foreign key relationships, and domain constraints, when described in a schema, are succinct, easy to understand and verify, and ultimately self- documenting. Domain rules encoded in the data model are also physical and persistent; a change to application logic does not wash them away.

To get the most out of a relational database—to make it a true part of the application as opposed to simply a storehouse for application data—you need to have a solid understanding of what you are building from the start. As your product evolves, so too will the data layer, but at each phase of its evolution, it should always maintain its status as Fortress. If you trust it and bestow upon it the heavy responsibility of trapping bugs from other layers of your application, you will never be disappointed.

Dan Chak is the director of software development at CourseAdvisor Inc., a Wash- ington Post company. He is the author of Enterprise Rails (O’Reilly).

时间: 2024-09-30 15:43:57

Database As a Fortress的相关文章

oracle database resident connection pooling(驻留连接池)

oracle在11g中引入了database resident connection pooling(DRCP).在此之前,我们可以使用dedicated 或者share 方式来链接数据库,dedicated方式是oracle数据库默认的链接方式,无需过多的配置,而且关于dedicated的bug也是非常少的,因此,通常情况下,建议使用dedicated方式来链接数据库.但是,在服务器资源有限,并且同时连接数据库的用户量非常大时,dedicated方式就无能为力了.假设并发用户为5000,每个d

Oracle Database 12c Release 1下载安装(自身经历)

1.访问Oracle官网:https://www.oracle.com/index.html,下载Oracle Database 12c Release 1 (注意:File1和File2都要下载!!不然后期安装会报一堆错误,可参考:http://www.2cto.com/database/201503/386272.html) 2.将文件解压,把winx64_12102_database_2of2文件夹中database\stage\components目录下的所有文件夹,复制到winx64_

The SQL Server Service Broker for the current database is not enabled

把一个数据恢复至另一个服务器上,出现了一个异常: The SQL Server Service Broker for the current database is not enabled, and as a result query notifications are not supported.  Please enable the Service Broker for this database if you wish to use notifications. 截图如下: 解决方法: 参

Mac 下locate命令使用问题WARNING: The locate database (/var/db/locate.database) does not exist.

想在Mac下使用locate时,提醒数据库没创建: WARNING: The locate database (/var/db/locate.database) does not exist. To create the database, run the following command: sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist Please be aware that the d

backup, file manipulation operations (such as ALTER DATABASE ADD FILE) and encryption changes on a database must be serialized.

昨天在检查YourSQLDba备份时,发现有台数据库做备份时出现了下面错误信息,如下所示: <Exec>   <ctx>yMaint.ShrinkLog</ctx>   <inf>Log Shrink</inf>   <Sql> --  ======================================================================== -- Shrink of log file E:\SQ

Windows 7 64bit上安装Oracle Database 12c [INS-30131] 错误的解决方法

Windows 7 64bit上安装Oracle Database 12c,出现以下错误: 解决方法: 第一步:控制面板>所有控制面板项>管理工具>服务>SERVER  启动 第二步:控制面板>所有控制面板项>管理工具>计算机管理>系统工具>共享文件夹>共享   右键单击“共享”>新建共享> 点击“下一步”>   单击“浏览”> 选择"本地磁盘(C:)">确定   单击“下一步”:     单击“

oracle 11g RMAN:Active Database Duplication for standby database 创建dg 命令解读

基于生产的duplicate 复制,如果事先没有手动配置pfile(设定内存,进程,dg相关配置参数,数据库相关路径参数)则会出现各种参数无法转换的问题: 因为duplicate 会从生产自动拷贝pfile,控制文件,密码文件过来,如果主库和备库环境不一样(数据库软件路径,数据文件存储路径) 如果没在duplicate的命令中完整指定新环境备库的各种参数涉及路径,及转换参数,就会默认使用从主库拷贝过来的spfile中的参数设置(会忽略oracle 自定义的的缺省配置:比如adr 缺省会放在ORA

Magento database maintenance

OverviewThis article examines the various ways to maintain an efficient Magento database, even when large in size. Magento does many things well, but maintaining an efficient database is not one of them. Having many products is a good reason to have

The Security Database on the Server Does Not Have a Computer Account

这两天在做微软App-V应用程序虚拟化的试验,公司需要测试自有C/S架构产品在其上的部署. 搭建过程比较顺利,突然的今天上班后发现App-V Server(域成员服务器)使用域用户登陆时报错: The Security Database on the Server Does Not Have a Computer Account for This Workstation Trust Relationship Google到该问题的解决方法,说不上准确的道理来,比较"有趣",记录下. 微