# pimpl management good practice

**URL:** <https://discourse.vtk.org/t/pimpl-management-good-practice/7582>\
**Category:** Development\
**Created:** [January 6, 2022, 7:54pm UTC](https://discourse.vtk.org/t/pimpl-management-good-practice/7582 "2022-01-06T19:54:51Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![alexy.pellegrini](https://discourse.vtk.org/user_avatar/discourse.vtk.org/alexy.pellegrini/32/5887_2.png) [@alexy.pellegrini](https://discourse.vtk.org/u/alexy.pellegrini)\
**Post date:** [June 5, 2025, 1:32pm UTC](https://discourse.vtk.org/t/pimpl-management-good-practice/7582/21 "2025-06-05T13:32:03Z")

</div>

I think having a private class with its own header and source file makes sense if you want a private API that is big and/or complex.  
But for a lot of classes the `vtkInternals` will only contains a few `vtkNew`s or smart pointers, maybe some ints, floats and strings etc, it will be overkill imho.  
Both have their use cases:

- Private API (XXXPrivate.h + XXXPrivate.cxx) for complex cases with a full private API
- Nested `vtkInternals` for storing some members or for simple PIMPLs

---

<div class="post-metadata">

**Author:** ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)\
**Post date:** [June 5, 2025, 1:55pm UTC](https://discourse.vtk.org/t/pimpl-management-good-practice/7582/22 "2025-06-05T13:55:56Z")

</div>

I think both are ok.

[Previous page](https://discourse.vtk.org/t/pimpl-management-good-practice/7582.md?page=1)
