![]() | |
![]() ![]() |
![]() | Imperfect C++ Practical Solutions for Real-Life Programming By Matthew Wilson |
Table of Contents | |
Chapter 3. Resource Encapsulation |
3.1. A Taxonomy of Resource EncapsulationThe classic texts [Stro1997] discuss resource encapsulation in terms of the Resource Acquisition Is Initialization (RAII) mechanism (see section 3.5). However, as with so many things in software engineering, there are several levels of resource encapsulation. The most basic level of resource encapsulation is, of course, no encapsulation at all. Beyond that, we need to consider the services that resource encapsulation provides
Given this list, we can postulate the following taxonomy of resource encapsulation:
We're going to use a couple of examples to take us through the journey into this concept in this chapter. Before we get into it, I should tell you that this chapter and the next took more thinking time (vs. writing time) than any others in the book. That's not because they're terribly complicated concepts, rather because the two concepts are so very similar that attempting to delineate cleanly between them was challenging, to say the least. As a consequence, you may find some of the examples in these chapters a bit contrived, but I ask you to bear with it and understand that the focus is on separating the concepts clearly. ![]() |
![]() | |
![]() ![]() |