Home arrow C++ arrow Page 4 - C++ in theory: Bridging Your Classes with PIMPLs
C++

C++ in theory: Bridging Your Classes with PIMPLs


Very often, when a program takes longer to compile after you have made what appear to be trivial changes, the blame can be laid at the door of dependency chains between header files. One change can trigger the need for a massive rebuild. J. Nakamura explains a way to make header files insensitive to any change -- thus saving all that rebuild time -- by using pimpl.

Author Info:
By: J. Nakamura
Rating: 4 stars4 stars4 stars4 stars4 stars / 10
February 01, 2005
TABLE OF CONTENTS:
  1. · C++ in theory: Bridging Your Classes with PIMPLs
  2. · The Private Implementation
  3. · Pimpl Drawbacks
  4. · Summary

print this article
SEARCH DEVARTICLES

C++ in theory: Bridging Your Classes with PIMPLs - Summary
(Page 4 of 4 )

The pimpl allows you to decouple the interface of your class from its implementation. On top of that, the implementation is not permanently bound to the interface. Any compile time dependencies are completely eliminated with the pimpl. This frees you from the fear to make changes to the implementation.

So use the pimpl when you want to hide the implementation details of your class. Before you do, however, make certain that you understand the performance penalties involved.

References

[Sutter] Exceptional C++ item 26~30.

[Gamma et all] Design Patterns Bridge.

[Meyers] More Effective C++ item 11.


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus
C++ ARTICLES

- Intel Threading Building Blocks
- Threading Building Blocks with C++
- Video Memory Programming in Text Mode
- More Tricks to Gain Speed in Programming Con...
- Easy and Efficient Programming for Contests
- Preparing For Programming Contests
- Programming Contests: Why Bother?
- Polymorphism in C++
- Overview of Virtual Functions
- Inheritance in C++
- Extending the Basic Streams in C++
- Using Stringstreams in C++
- Custom Stream Manipulation in C++
- General Stream Manipulation in C++
- Serialize Your Class into Streams in C++

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials