You'll have to catch up on my original post and Jeremy's informative post before delving into this one.
- As I brought up in my original posting. I'm curious to know what the O/R mapper world does about security? I imagine you have to fill your business objects with security checks in lieu of giving rights to stored procs and data. Does not this add a lot of code? If I were to somehow grab your .dll internally, would I be able to query and modify data at will?
- How do you handle maintaining application history? Are you manually making multiple updates on seperate database calls? I'm assuming that if you're anti - stored procedure that you are also anti-trigger. If you're ok with just overwriting data that's cool in your application scenario, but what would you do in a situation where you needed to implement something like a transactional database structure or otherwise be very agressive about tracking changes and state for rollback or reporting?
- Jeremy does make the admission that he has not written hardly any direct ado.net manipulation in a while. This suggests that his database needs are simple straightforward table writes. This is actually a situation where I tend to support things like Ruby on Rails and O/R mappers. If you don't need or care about #1 and #2 the argument for stored procedure use is relatively weak.
- "That's an easy answer Eric, stored procedures make TDD a slower, less productive process." This one really bothers me. I was under the assumption that TDD you would write a test that failed, and use loosely coupled interfaces in order to "mock" test your application? If this is true, then why is it so difficult mock a view? You can quickly create a view stub that just returns column names and mock that. You can also create a strongly typed dataset, or pass in a business object just assuming that the data will be there. The population of said object I would think is its own test. I don't know enough about TDD to make a skillful argument though, I'm just pointing out that mocking the return of a stored procedure can't be any harder than mocking the return off a table or view.
- "Expletive. NO, NO, NO!!!!! The DBA should most certainly NOT work independently of the programming team. Stored procedures are code, and potentially destructive code at that. If you change a stored procedure you *MUST* integrate and test the stored procedure against the application before it gets anywhere near production." This one is my bad since I was unclear in what I meant. What I meant was once you have a structure laid out for what data you expect from what stored procedure/view, the database team is able to make adjustments in the background and as long as the integrity is maintained the application will not be effected. You certainly should be building and running tests on a beta environment before moving to production. It sounds to me that this isn't so much an argument against stored procedures but against poor testing from DBA teams. The point I was moving ponderously towards was that a good DBA uses analysis tools on the server to locate performance choke points and then should be free to go in and tweak queries, index columns, etc without needing to involve a developer every step of the way. If all the SQL is in the application, there is no way for the DBA to tweak the sql quickly, cheaply, and efficiently.
