Database Reference
In-Depth Information
In computer terms, abstraction layers are often implemented as layers
of software that the user or other applications access. Some common ab-
straction layers include the Windows Hardware Abstraction Layer (HAL),
the Open Systems Interconnection (OSI) model, and the Open Graphics
Library (OpenGL). All these provide access to the functionality of the un-
derlying objects without providing direct access to the objects.
Now let's look at what an abstraction layer is in terms of our SQL
Server database. The complexity we are trying to hide is the schema,
which includes all the tables, relationships, indexes, columns, data types,
and so on. Why we want to hide this complexity is covered in the next sec-
tion. Our abstraction layer in SQL Server is made up of views, stored pro-
cedures, user-defined functions, and a few other SQL Server objects. In a
perfect world with a perfect abstraction layer, neither a single piece of code
nor a user would have any permission to access a physical table; everything
would be handled via an abstraction layer.
Why Use an Abstraction Layer?
Now that you know what an abstraction layer is, it's our job to explain why
you would want to use one. Our hope is to make a good enough case that
the whole world will understand that a database without an abstraction
layer is a problem. As we have discussed, an abstraction layer masks the
complexity of the underlying database structure. This is crucial for several
reasons. First, it provides a means to manage security without compromis-
ing the data in your database. Second, it creates a database that it extensi-
ble. Finally, it allows you much greater flexibility than would otherwise be
possible. Let's look at each of these in a little more detail.
Security
First and foremost, a correctly designed abstraction layer provides you
with more options for the security of your database. By not allowing direct
table access, you avoid the pitfalls that come with data changes or over-
permissions. To illustrate this let's look at a single table in our database,
tbl_customer, as shown in Figure 11.1.
This table contains sensitive data; not only do privacy laws and regula-
tions abound that could create problems if a person's information is com-
 
 
Search WWH ::




Custom Search