A fellow programmer told me that I shouldn't put Business Rule in JSPs. This really confused me.
I'm really having a hard time understanding this. I mean I don't know how can I identify which in the code is the Business rule.
Questions:
Business rule is a criterion used in business operations to guide behaviour, shape judgements and make decisions.
What I see is most of the times, a confusion between different types of logic, and they all are called business rules by mistake. There are many reasons that you should not implement business rules into your source code. Generally, your application should take care of different types of logic: Application Logic and Business Rule. When you separate these from each other, then you allow business rules to be updated independently, with no application code change by business people. For example, when a tax rate is changed, business can update the tax rule without need to ask IT team (developers).
So in your question, if you still keep the business rule in JSP codes, then there still is dependency to developers (and IT) so that's not much beneficial from what I just mentioned. However structuring in a better way in your code, would be beneficial in long run of the project, so developers will be update them easier.
If you want to extract them totally from your source code, and let them be managed out side of your source (JSP) you need a business rule management system (BRMS). One component of a BRMS is a Business Rule Engine (BRE) which allows you to execute the business rules that are modelled in different forms. When we are talking about BRMS, it is not only the execution (BRE) aspect of it but also other capabilities like, standard modeling language and authoring, debugging, testing, version control, deployment and hosting as a service (REST), security and permission control and so on... therefore a BRMS solution should cover the whole lifecycle of business rules.
Regarding to identifying them in your code, IMHO, in an existing application, it is not easy to identify and extract the business rules out. It really depends on the complexity of application domain and how well it is written. Pick one specific scenario, sit with your BA, define the business need and requirement of the implemented scenario, check if a logic is application logic, or business related logic. Here is an example of how business rule can be separated from source code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With