4 ms·
> I write a view for each access method (so I can change the schema without worrying about changing every access method), and a function for each update/insert/
by imposterr 5y ago
> I write a view for each access method (so I can change the schema without worrying about changing every access method), and a function for each update/insert/delete (for the same reasons)
I’d appreciate it if you could expand on what this means exactly.
- unclebucknasty 5y agoNot OP, but sounds like they're using views for reads and functions (stored procs) for writes. Idea is to insulate code from schema changes as much as possible. If the underlying schema changes, it's possible to sync the views/functions to those changes so the code itself isn't impacted, as it's just talking to the views and functions. Kind of an exposed interface to the DB. It's not perfect, and some schema changes will invariably require code changes, but should be minimized. There are pros and cons to this approach and I personally don't favor it, although I am aware of some shops that made it an absolute requirement--especially pre-ORM.