4 ms·
Also Java and C# developers often produce bad SQL procedures because they tend to think procedurally about problems.
by nickpeterson 10y ago
Also Java and C# developers often produce bad SQL procedures because they tend to think procedurally about problems.
- Something1234 10y agoWhat would be the better thought process for writing sql procedures? It seems like PL/SQL is fairly procedural.
- nickpeterson 10y agoThe rule of thumb would be, use SQL statements to model and execute business logic, not cursors/variables. While the execution is still procedural, the goal is to make all the decisions 'at once' rather than explicitly looping. Behind the scenes a similar set of steps are taken, but the dbms is free to perform the operations as it sees fit.
- maxxxxx 10y agoI think if they were better integrated with the IDE and easier to debug then they would probably write better stored procedures.
- ZanyProgrammer 10y agoAs a C# dev myself, fuck stored procedures, to be quite honest.
- intrasight 10y agoPlease elaborate
- ZanyProgrammer 10y ago1.They are a pain in the ass to keep track of in version control. 2. They are hard to debug, especially when lots of business logic gets dumped to them
- maxxxxx 10y agoTotally agree. It's hard to do code and stored procedures right with the same level of quality. The tools are different and the thinking is different.
- lmm 10y agoAnd easier to unit-test, and profile, and had a better standard library available, and... SQL is a terrible general-purpose programming language by the standards of today, which makes it a terrible way to express business logic.