Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implement the Business Services in PL/SQL or Java? Favor/Cons?

Tags:

java

oracle

plsql

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)

  • Scalability
  • Monitoring
  • Object Oriented Language
  • Sync/Async process
  • Rich domain
  • Testability
like image 595
irobson Avatar asked Jan 07 '11 18:01

irobson


People also ask

Is SQL a good place for business logic?

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.

Is Plsql faster than Java?

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.

Why shouldn't we put all business logic in stored procedure?

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.


3 Answers

You may find the following articles interesting and helpful:

  • A Working Definition of Business Logic, with Implications for CRUD Code
  • Business Logic: From Working Definition to Rigorous Definition
  • Theorems Regarding Business Logic
  • Can You Really Create A Business Logic Layer?
like image 177
Eddie Awad Avatar answered Oct 23 '22 22:10

Eddie Awad


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.

like image 37
sblundy Avatar answered Oct 23 '22 23:10

sblundy


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.

like image 43
Nrj Avatar answered Oct 23 '22 23:10

Nrj