On May 3, 2013, at 10:30 AM, Stephan Aßmus <superstippi@xxxxxx> wrote: > Hi, > > Am 03.05.2013 um 16:19 schrieb John Scipione <jscipione@xxxxxxxxx>: >> On May 3, 2013, at 10:11 AM, Stephan Aßmus <superstippi@xxxxxx> wrote: >>> Am 03.05.2013 um 16:09 schrieb John Scipione <jscipione@xxxxxxxxx> >>>> On May 3, 2013, at 10:01 AM, Rene Gollent <anevilyak@xxxxxxxxx> wrote: >>>>> On Fri, May 3, 2013 at 10:00 AM, John Scipione <jscipione@xxxxxxxxx> >>>>> wrote: >>>>>> It compiled fine but only because ListView.h happened to include all >>>>>> those classes that you need below but it's not a great idea to depend on >>>>>> that. If you explicitly declare the classes you need, which adds almost >>>>>> no compile time, then you allow the possibility of eliminating redundant >>>>>> header includes greatly decreasing compile times. >>>>> >>>>> Except that's not going to happen here since BOutlineListView >>>>> subclasses BListView, and as such that header's not going away. >>>> >>>> Right, but a declaration in a header included by BListView might go away. >>> >>> Which would be the point in time to add the declaration where it's needed. >> >> Perhaps I'm off my rocker here but that would make something that should be >> a local change, eliminating a superfluous header into a global change, also >> tracking down all the places that header declaration was depended on by >> headers that include your header. > > Each header should be self-contained. But you should not repeat declarations > of headers that you include. What's the point of including headers, if you > do? For example, should the BOutlineListView header repeat the declaration of > BListView, just in case the BListView header goes away entirely? I know, I am > being silly, but it hopefully emphasizes my point. Hi Stippi :) Yes, from a code maintainability standpoint you should repeat the declarations in OutlineListView.h from ListView.h because the declarations in ListView.h might go away. Basically what I'm saying is that you should declare the classes you use and you become atomic. If you don't then you make the code depend on side effects, side effects that become a burden for those who come after you, even if those people are you 6 months from now. The cost of doing this is almost none, in terms of code readability and compile time, but the benefits are that you make the code more maintainable, more nimble and easier to change.