The right option is "adding business logic to stored procedures"

Source: Internet
Author: User
There are many places where the business logic can be stored in a system. Some people choose to store it in the stored procedure, and some choose to store it in the business components. These methods can be used to determine the business logic. Since these methods can be used to determine the business logic, the rationality of their existence is proved. Just like in the design process, many people will encapsulate the conditional selection statement into refactoring of different classes to meet the "open-closed" Principle in the design, there is reason for doing so. However, it does not mean that conditional transfer statements are not needed in the future. How can a development language support the conditional transfer syntax. We need to choose whether to refactor based on the specific situation. For example, we only need to create an object. If we want to refactor it, imagine how many classes we need to create. The maintenance header is not big enough.

Is it possible to choose one method in project development? Of course it is not advisable. Many of them are based on specific situations. It is not good to say yes only in specific situations. For example, it takes one month for a project to have a good design and 10 days for a poor design. Which one should you choose? More people will choose a one-month design because of their pursuit of design. But if this project only takes one month, how do you choose? Of course, this example is not very accurate, but I just want to explain one thing: the right is the right one. Writing a business into a stored procedure can be used to find many reasons to overturn this practice, and many reasons can be used to approve this practice. This problem can be viewed in different project environments. For small projects, the logic is relatively simple. to quickly reduce the development scale and write the business logic into the stored procedure, it is a good method. For large projects, considering the complexity of the business logic, it is a relatively good method to encapsulate business logic into components. Is it safer and more convenient to modify, maintain, and deploy stored procedures? At the same time, writing business logic into the stored procedure will increase the load on the database server. At the extreme point, there is a complicated logic that requires reading a lot of data for comparison and concurrent access by many people, should we consider the burden on the database server and whether we can put some work on the client or application server ?. There are too many things to talk about, but it should be noted that the right fit is correct!
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.