[comp.lang.c++] pros and cons of .cc -> .h automatic generation

throopw@sheol.UUCP (Wayne Throop) (02/16/91)

> euamts@eua.ericsson.se (Mats Henricson)
>> horstman@mathcs.sjsu.edu (Cay Horstmann) 
>> [...] HEADER FILES SHOULD BE AUTOMATICALLY GENERATED.
> [...] I think this is a bad idea.  The most important thing with a C++
> class is its interface [..so..] design the header file first, and then
> the .cc-file.  [...] also [...] .cc-file stubs should be generated from
> .h-files [...]

Mats' idea is only profitable if the interface never changes after
it is created.  Otherwise, the stub generator is faced with the
prospect of trying to insert stubs into a file which is partly
generated and partly human created when new parts of an interface
are added.

That's why I prefer the reverse.  I agree that one should design the
interface first, but I don't agree that this means one must write the .h
file first.  I'd druther write the interface in a .cc file and simply
omit the implementations at first, adding implementations as time goes
on, and automatically generating the corresponding .h file.  This method
seems to me to work better over the longer term, because there is only
one place to change if the interface changes.
--
Wayne Throop <backbone>!mcnc!rti!sheol!throopw or sheol!throopw@rti.rti.org