5 ms·
How about move the business logic to stored procedures
by kgbcia 3y ago
How about move the business logic to stored procedures
- lmm 3y agoWriting my business logic with no libraries, no standard testing framework, and a syntax and overall feel comparable only to COBOL? No thanks. (Some databases allow writing stored procedures in other languages, true, but that means a nonstandard interface, tightly coupled deployment model, and testing is still awful)
- funcDropShadow 3y agoThere is e.g. https://pgtap.org/ https://pgtap.org/ as a testing library for Postgres.
- leosanchez 3y agoMy first employment did this. All the business logic was in stored procedures. These procedures quickly grew bigger and bigger and were nightmare to understand and test.
- blagie 3y agoThis would be the right way to go if: 1) Databases had a consistent language for storage procedures 2) It was sane The problem is that stored procedures work differently in every database, and most have come up with crazy / stupid ways to do them. That's a fixable problem, but it has not been fixed.
- hardware2win 3y agoOh god, no, never. Painful to maintain, test, debug, etc.
- nunez 3y agothat's also nightmare enducing since sql is great for interacting with data but less great at expressing how that data should be stored and the relationships within the data. this worsens quickly the more complex the business logic gets. stored procs also tie you to that database engine, which could be bad if, for example, you're paying a fat stack of cash to oracle and they come back asking for more. i think a business logic api in a programming language that leverages raw SQL is the best middle-ground IMO.