在哪里放你的代码 - 数据库与应用程序? [英] Where to put your code - Database vs. Application?

查看:134
本文介绍了在哪里放你的代码 - 数据库与应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了大约6年的web /桌面应用程序。在我的职业生涯过程中,我遇到了使用存储过程在数据库中大量写入的应用程序,而很多应用程序只有很少的基本存储过程(读取,插入,编辑和删除实体记录) 。

I have been developing web/desktop applications for about 6 years now. During the course of my career, I have come across application that were heavily written in the database using stored procedures whereas a lot of application just had only a few basic stored procedures (to read, insert, edit and delete entity records) for each entity.

我已经看到人们争辩说,如果您已经为企业数据库付费,广泛使用其功能。虽然很多面向对象的架构师告诉我它绝对的犯罪,把任何东西超过必要的数据库,你应该能够使用这些类的方法驱动应用程序?

I have seen people argue saying that if you have paid for an enterprise database use its features extensively. Whereas a lot of "object oriented architects" told me its absolute crime to put anything more than necessary in the database and you should be able to drive the application using the methods on those classes?

您认为余额在哪里?

感谢,
Krunal

Thanks, Krunal

推荐答案

我认为这是一个业务逻辑与数据逻辑的事情。如果存在确保数据一致性的逻辑,请将其放在存储过程中。

I think it's a business logic vs. data logic thing. If there is logic that ensures the consistency of your data, put it in a stored procedure. Same for convenience functions for data retrieval/update.

其他的应该放在代码中。我正在开发一系列存储过程用于生物信息学中的数据分析算法。我认为他的做法很有趣,但从长远来看不是正确的方法。我主要的反对意见是可维护性和缺乏适应性。

A friend of mine is developing a host of stored procedures for data analysis algorithms in bioinformatics. I think his approach is quite interesting, but not the right way in the long run. My main objections are maintainability and lacking adaptability.

这篇关于在哪里放你的代码 - 数据库与应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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