In general, spreading business logic in different layers of the application is avoided. Imagine that other people will maintain the code, what will happen? The new programmer will have to roll a little to realize that the logic that updates the quantity of stock simply is not in the code layer responsible for changing the stock, is in the data layer.
When I studied software engineering, there was an interesting phrase that was used: 'Data layer is data layer/storage, business is business'. but then I realized it’s not that simple and that making the team maintain the conceptual integrity of a project is really difficult, requires discipline.
In this more specific case, the performance will definitely be something to discuss, since removing the Rigger will cause the application to have to perform a bank access to do the update (or other action) and this is usually slower.
You should look at the key factors that will affect your project and what architectural decisions were set at the beginning so that point maintenance implementations do not destroy your architecture but also do not destroy performance.
An article by Martin Fowler (a classic reference in POO) can help you with topics already discussed, I removed an excerpt from the text that may give you a vision:
"With Both of the first two, the database is used Pretty Much as a
Storage Mechanism. All we’ve done is Asked for all the Records from a
particular table with some very simple Filtering. SQL is a very very
Powerful query language and can do Much more than the simple Filtering
that These examples use...."
Something like: in general, the database is a mechanism for storing data, all we do is request a set of data with a particular filter criterion. SQL is a powerful language and can do much more than simply filter ... - free translation.
This text shows the basic definition and enters into the discussion of the major aspects of using logic in the application or in SQL statements, is not so didactic and assumes that the reader has experience in certain scenarios, but, will help.
http://www.martinfowler.com/articles/dblogic.html
There is another however, not so discussed, many commercial applications support more than one database (Oracle, Mysql, SQL Server, etc), the "SQL language" that each supports will vary according to the vendor, as well as features that can be used in conjunction with the language chosen for the other layers (PHP, Asp.net, etc.), so putting the business rules in the bank, will require a more complex product maintenance strategy for various Databases, as the main validations of a software are the business rules and this cost can impact directly on the product management model.
I think my answer was a little indirect, it was not clear to me if you are choosing a general architecture that will be implemented or if you are discussing a particular case to implement a functionality... Like, I will implement Trigger only here in the stock update or I will put the whole business rule in the bank and only this will stay here because it is faster..
– Intruso
You have two answers. You have solved your problem?
– durtto
Have any answers solved what you were looking to know? Do you think you can accept it now? If not, you need something else to be improved?
– Maniero