SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in


By Steve Jones,

One of the core tenets of good software design is to abstract away details in any particular part of an application. We want to use well defined and constructed interfaces so that the implementation of any particular method or section can change without affecting the way the system works. This allows for improvement and upgrade over time. The same thing occurs in hardware, where we can replace a hard drive, a graphics card, or other components and the system should still function in the same manner. There might be a bit of work, such as updating a device driver, but the core system should still work.

This is also present in the real world. I can replace the wheels and tires on my car, since as long as I have the same pattern for the bolts to attach to the axle, things still work. Electrical systems work this way, allowing any device that has the correct plugs and uses the expected voltage to interface with an outlet. The examples of abstraction are numerous, and the more we use abstraction, the more flexible our systems can be. Where we haven't abstracted away details, it becomes complex and expensive to change part of a system.

In a database setting, we want to use abstraction where possible. The use of views or stored procedures (or functions) allow the underlying table implementations to change without an application being too tightly coupled to the structure. This isn't always well adhered to, despite the well known practice of building a data access layer into an application. Too often developers want to tightly couple their application to the underlying table structure.

But, how abstracted should you be? Certainly I'd hope that your application had the ability to easily change connection settings, and these days I'd hope you actually had two: a read/write connection and a read-only connection. What about the database name? Should that be abstracted away? Again, I'd hope so, even in a multi-database application. If for no other reason than to simplify development by allowing the database name to change on a development server. Certainly security objects, especially encryption mechanisms, need some abstraction to prevent the requirement that they exist in non-secure environments.

Are there other abstractions you'd want to see widely implemented? I wonder what other examples might be important to developers or DBAs out there. I know that allowing abstractions also brings complexity, and the ability to change those values between environments is critical. This could be performed with injection of different parameters as software changes are deployed, but the mechanisms for doing this are still immature and not standardized.

There are plenty of other places we can abstract away implementations, but without mentioning too many, I want to know what you'd like to see. What abstractions would you want, or do you implement in your systems?

Total article views: 88 | Views in the last 30 days: 1
Related Articles

Always Abstract

When developing your code, should you use views? There are reasons why you might choose to do so, or...



Comments posted to this topic are about the item [B]Abstraction[/B] My creations these days are excl...


My Feedback on my PASS Abstracts Feedback

Brent Ozar recently published the feedback he got on his abstract submissions for PASS Summit 2016 a...


Views for Abstraction

Views are one of the more basic constructs in SQL Server, but often it seems that developers are not...


Always Abstract

Comments posted to this topic are about the item [B]Always Abstract[/B] Not sure this is where I nee...