Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: Differentia...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 9 of 9 Topic 9505 of 9775
Post > Topic >>

Re: Differentiating pimpl idiom classes in c++

by marlow.andrew@[EMAIL PROTECTED] Apr 21, 2008 at 08:28 PM

On 18 Apr, 02:35, Carl Barron <cbarron...@[EMAIL PROTECTED]
> wrote:
> > We are working with an embedded device where only one implementation
> > of the driver needs to be in memory at any moment in time.  The
> > implementation may vary due to variations in the hardware (this must
> > be a common issue).  The pimpl idiom seemed to fit the bill.

>   Pimple is to hide implementation details so they can be modifed
> without recompiling client code.   Here you want a to select one of
> k implementaions of a classes Driver and change them some how.

Indeed. Pimpl is all about reducing physical dependencies
by making it so that the class header file does not contain
any implementation details. Changing such details if they were
in the header would mean the header would change, which causes
any dependency-mgd build to recompile many files. This is a problem
for large projects.

>
> None of the classical OOP Patterns are done at link time, they are done
> at runtime.  If you use templates those used must be visiable at
> compile time,  and they solve a similiar problem at compile time.

The design pattern is 'strategy'. In the early days this was
done using virtual functions but people seem to prefer a
template based strategy these days. It does eliminate the
overhead of a virtual dispatch and this seems to be the quoted
reason for the preference.

Regards,

Andrew Marlow

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 9 Posts in Topic:
Differentiating pimpl idiom classes in c++
Fejimush <grahamreitz@  2008-04-16 11:36:38 
Re: Differentiating pimpl idiom classes in c++
Tony Delroy <tony_in_d  2008-04-17 03:55:28 
Re: Differentiating pimpl idiom classes in c++
Carl Barron <cbarron41  2008-04-17 04:13:14 
Re: Differentiating pimpl idiom classes in c++
Fejimush <grahamreitz@  2008-04-17 12:03:38 
Re: Differentiating pimpl idiom classes in c++
Carl Barron <cbarron41  2008-04-17 19:35:32 
Re: Differentiating pimpl idiom classes in c++
Tony Delroy <tony_in_d  2008-04-18 06:13:17 
Re: Differentiating pimpl idiom classes in c++
Fejimush <grahamreitz@  2008-04-19 02:01:53 
Re: Differentiating pimpl idiom classes in c++
Tony Delroy <tony_in_d  2008-04-20 21:04:20 
Re: Differentiating pimpl idiom classes in c++
marlow.andrew@[EMAIL PROT  2008-04-21 20:28:04 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Jul 8 23:34:35 CDT 2008.