How do views reduce code duplication?
- by Debuger
Hi! I read something like this about db views:
Views are incredibly powerful and useful for one reason that stands out above all the other very good reasons. They reduce code duplication. That is, in most cases, the bottom line. If a query will be used in three or more places, then a view will drastically simplify your changes if the schema or query parameters change.
I once had to edit 22 stored procedures to change some query logic. If the original architecture had utilized views, then I would have had only three changes.
Can anyone explain to me how it works, and maybe give me some examples?
Best regards!