No header files?

AJ aj at nospam.net
Thu Oct 22 02:08:03 PDT 2009


"Walter Bright" <newshound1 at digitalmars.com> wrote in message 
news:hbp309$1nb9$1 at digitalmars.com...
> AJ wrote:
>> "Walter Bright" <newshound1 at digitalmars.com> wrote in message 
>> news:hbo7fa$316k$2 at digitalmars.com...
>>> AJ wrote:
>>>> You lose the ability to use, say a class declaration, as the 
>>>> specification (at least without a sophisitcated, 
>>>> code-folding/code-formatting IDE).
>>> Just change "class" to "interface" and you're good to go.
>>
>> Seems "apples and oranges" to me. "class declaration" can have data 
>> members while "interface" can't.
>
> It's usually considered good style to keep your data members hidden from 
> users.

That's an incomplete thought. You are assuming a certain scenario perhaps. 
It would be seemingly (for lack of any agreement on the definition of 
"users" and the context) an extreme position to take otherwise. And no, I 
don't want to entertain or tangent to OO 101 dialog/discussion/debate either 
thank you.

> Interfaces do that nicely.

>
>
>> I mean, "my concept of it". I don't know what definitions D has of those 
>> things. In C++, I use interfaces where appropriate (say, where usage 
>> outside of a given library/subsystem is anticipated/desired), but for 
>> most purposes (say, within a given library/subsystem), I want a full 
>> class declaration (with data members etc). When I think "interface", I 
>> think "pure abstract base class" and is something strictly behavioral. 
>> When thinking "class" or "struct", I think first of the data members, 
>> something more nominal ("noun-ish").
>
> If you're exposing data members to all the users, then you might as well 
> expose the function bodies, too, because the benefits of hiding the 
> implementation are already mostly gone.

There's no sense in discussing it in such a general or dogmatic way. 





More information about the Digitalmars-d mailing list