I work for an enterprise that will create a web-service stack architecture (probability rest based), I'm the technical leader involved. This architecture will be created using the Java Platform, but I have a problem with some team´s members: they are from Oracle´s old school (i.e. they did the legacy using PL/SQL and in their head the business logic should be only on the database, with just a little java layer calling that), I have some arguments about this but I would like to know your arguments in favor or cons about the question.
Java Favor (in my opinion)
SQL is the language optimized for operating sets of data. It isn't flexible enough and we can't rely on it to express any more or less complex domain model because it lacks the ability to create proper abstractions. And that is the single most important reason why we shouldn't use it as a place for business logic.
Doing maximum amount of data processing in SQL is efficient and faster than writing logic inside the java code. Loading data from the database into application memory and writing it back to the database after computation is a waste of application memory, bandwidth and time.
Cons of holding all the business logic on stored procedures in web application: against: Good SQL knowledge can be hard to find in many locations. Good SQL coders can be expensive. All application developers will need to be able to either change it or request a quick change.
You may find the following articles interesting and helpful:
I worked on such a project using MS SQL rather than Oracle. It was not a pleasant experience. The trouble is that T-SQL is not a very modern language and so we weren't as productive as we could have been and there was more code duplication than there would have been otherwise.
There's an argument to be made that the productivity of the developer is more important than the lang, so if these guys are just that good, so what. But you're not going to find a lot of young developers who will want to work that way.
It has to be a judicial decision. Either one can be more suitable based on the use case. For a simple example
If you have a business rule which say requires data from a number of tables and based on the data received, it decides to perform a final database operation (insert or update), then in my view pl/sql procedure is the place to do it. Since this will save n/w time and bandwidth and will be a touch faster.
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