Chapter 13. Database Encapsulation Strategies

Coupling is your greatest enemy. Encapsulation is your greatest ally.

Encapsulation is a software-design issue that deals with how functionality is compartmentalized within a system. The main concept behind encapsulation is that you should not have to know how something is implemented to be able to use it. Some people say that encapsulation is the act of painting the box black — you are defining how something is going to be done, but you are not telling the rest of the world how you're going to do it. For example, consider your bank. Do they keep track of your account information on a mainframe, a mini, or a PC? What database do they use? What operating system? The answer is that it doesn't matter to you; the bank has encapsulated the way in which they perform account services. You just walk up to a teller and perform whatever transactions you wish.

The implication of encapsulation in terms of software development is that you can build the separate components of a given application in any way you want and then later change the implementation without affecting other system components (as long as the interface to that component did not change).

This chapter explores:

  • Database encapsulation layers

  • The role of the agile DBA

  • Encapsulation layer architectures

  • Encapsulation layer implementation strategies

  • Marshaling and data validation

  • Error handling

Database Encapsulation Layers

A database encapsulation layer hides the implementation details of your ...

Get Agile Database Techniques: Effective Strategies for the Agile Software Developer now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.