This is an interesting question. If I understand correctly you are working on an application where the DB entry will essentially be a blog post (typically 500-1000 words based on most blogs I read).
You are storing the blog post as a text field in your database. You are quite reasonably worried about what happens with large blobs of data.
I fully advocate for you having a limit on the amount of data the user can enter. Without fully understanding the architecture of your system it's impossible to say what is the theoretical max size based on the technologies used.
However, it is better to look at this from a user perspective. What is the maximum reasonable amount of text for you to have to store, then let's add a bit more say 10% because let's face it users will do the unexpected. You can then add an error condition when someone tried to enter more data.
My reason for proposing this approach is a simple one, once you have defined a maximum post size you can use boundary value analysis (testing just either side of the limit) to prove that your product behaves correctly both just below and at the limit. This way you will know and can explain the product behaviour to the users etc.
If you choose to let the architecture define the limit then you will have undefined behaviour. You will need to analyze each component in turn to work out the maximum size they will accept and the behaviour they exhibit when that size is exceeded.
Typically (in my experience) developers don't put this effort in and let the users do the testing for them. This of course is generally worse because the user reports a strange error message and then the debugging is ultimately time consuming and expensive.
发布评论
评论(1)
这是一个有趣的问题。如果我理解正确的话,您正在开发一个应用程序,其中数据库条目本质上是一篇博客文章(根据我读过的大多数博客,通常为 500-1000 字)。
您将博客文章作为文本字段存储在数据库中。您非常担心大块数据会发生什么情况。
我完全主张对用户可以输入的数据量进行限制。如果不完全了解系统的架构,就不可能根据所使用的技术说出理论最大大小是多少。
然而,最好从用户的角度来看待这个问题。您必须存储的最大合理文本量是多少,然后让我们再添加一点,比如 10%,因为让我们面对现实吧,用户会做出意想不到的事情。然后,当有人尝试输入更多数据时,您可以添加错误条件。
我提出这种方法的原因很简单,一旦您定义了最大帖子尺寸,您就可以使用边界值分析(仅测试限制的任一侧)来证明您的产品在低于限制和在限制处都可以正确运行。这样您将了解并向用户解释产品行为等。
如果您选择让架构定义限制,那么您将有未定义的行为。您需要依次分析每个组件,以计算出它们可接受的最大大小以及超过该大小时它们表现出的行为。
通常(根据我的经验)开发人员不会投入精力并让用户为他们进行测试。这当然通常更糟,因为用户报告奇怪的错误消息,然后调试最终既耗时又昂贵。
This is an interesting question. If I understand correctly you are working on an application where the DB entry will essentially be a blog post (typically 500-1000 words based on most blogs I read).
You are storing the blog post as a text field in your database. You are quite reasonably worried about what happens with large blobs of data.
I fully advocate for you having a limit on the amount of data the user can enter. Without fully understanding the architecture of your system it's impossible to say what is the theoretical max size based on the technologies used.
However, it is better to look at this from a user perspective. What is the maximum reasonable amount of text for you to have to store, then let's add a bit more say 10% because let's face it users will do the unexpected. You can then add an error condition when someone tried to enter more data.
My reason for proposing this approach is a simple one, once you have defined a maximum post size you can use boundary value analysis (testing just either side of the limit) to prove that your product behaves correctly both just below and at the limit. This way you will know and can explain the product behaviour to the users etc.
If you choose to let the architecture define the limit then you will have undefined behaviour. You will need to analyze each component in turn to work out the maximum size they will accept and the behaviour they exhibit when that size is exceeded.
Typically (in my experience) developers don't put this effort in and let the users do the testing for them. This of course is generally worse because the user reports a strange error message and then the debugging is ultimately time consuming and expensive.