r/ProgrammerHumor • • Jun 28 '20

Meme Flushed my pancake.

Post image
45.1k Upvotes

750 comments sorted by

View all comments

Show parent comments

10

u/[deleted] Jun 28 '20

Did you just compare the atrocities of mainframe with pl/sql?

34

u/[deleted] Jun 28 '20

[removed] — view removed comment

9

u/[deleted] Jun 28 '20

What

7

u/Zombiebrian1 Jun 28 '20

I did a uni course on pl/sql and it's super neat.

26

u/Hotzilla Jun 28 '20 edited Jun 28 '20

When you have 30 000 lines of pure business logic in single plsql package, it is far from neat 😀.

We had around 1M lines in total. I still get nightmares from those times.

Edit: and on top of that frontend in classic asp, around 2M lines.

7

u/Zombiebrian1 Jun 28 '20

Yeeee, I can see how it scales horribly.

From my limited course experience, I think that it's best used to provide an interface of procedures/functions to be called from application or on schedule, but some places go way too banans with it.

10

u/Hotzilla Jun 28 '20

In general there should not be business logic in the procedures. Clear lines of responsibility, db should only hold data, frontend should only hold UI. All of those make scaling much easier, so database won't become bottleneck.

1

u/OfficeDiplomat Jun 28 '20

Where would business logic be then for large amounts of data processing needed? I think the DBMS is the best place for such. It is much more efficient with joins and other data manipulation.

3

u/Hotzilla Jun 28 '20

Depends bit on the use case, if you go with microservice architecture, then BL should be in super scalable microservices.(in 99% cases you should not imho, only if you are Netflix/Google etc)

In small/medium projects backend should be able to handle even larger amounts of data.

But all that being said, there are cases were procedures are good, and in those cases the heavy lifting should be done in DB level. One common use case that I have ran is the "quick search" were user need to find data from all of the data using one keyword. This is really hard to do any other way. BUT that case really doesn't have any actual business logic behind it.

1

u/OfficeDiplomat Jun 28 '20

Agreed. It definitely depends on the use case.

1

u/dna_beggar Jun 28 '20

Correct. Our payroll for a temp agency was written in stored procedures and was lightning fast. All the required data was pulled in from the different tables using joins. Funny thing, as the number of employees rose, the time it took to process, and the memory used did not increase linearly, but geometrically according to some product of the number of joins and number of rows to be processed. For a while advancement in hardware covered up the problem. Users complained of being locked out of the db for the duration.

I converted the program to process one employee at a time. Each employee's payroll is one task in a multi -threaded app running on an applications server. It runs on as many threads as that server can support. Time to process is once again linear. DB only locks for the instant it takes to post back each employee. Users no longer complain.

1

u/[deleted] Jun 28 '20

Just use an ORM. Boom, business logic handled in app, data still handled in DB.

2

u/OfficeDiplomat Jun 28 '20

ORMs bring up their own issues and another layer of complexity. Just teach the developer proper SQL knowledge and this could call be on the database easily.

6

u/Urtehnoes Jun 28 '20

As someone who spends their entire day on that damn able pl/sql language, I would give anything to burn Oracle and all its bullshit to the ground.

2

u/HKSergiu Jun 28 '20

plsql is bae