how to make private class member private
psychoticRabbit
meagain at meagain.com
Tue Mar 13 12:47:06 UTC 2018
On Tuesday, 13 March 2018 at 12:10:07 UTC, rikki cattermole wrote:
> On 14/03/2018 1:02 AM, psychoticRabbit wrote:
>> On Tuesday, 13 March 2018 at 11:31:12 UTC, rikki cattermole
>> wrote:
>>>
>>> Ah yes.
>>> You're completely correct if you subscribe to Adam's and
>>> ketmar's file sizes expectation.
>>>
>>> A D module and package is one level of abstraction. If that
>>> level of abstraction starts to fill up and gets large, you
>>> split it up.
>>>
>>> My rule is soft 1k LOC and hard 2-3k (after that it needs a
>>> VERY good reason to stay together).
>>>
>>> This makes each file to be very right down to the point and
>>> do nothing else.
>>>
>>> You should be doing this no matter the language IMO. Just the
>>> difference is in Java only one class is publicly accessible
>>> per file. Nothing stops you from doing that here either.
>>
>> Fair enough.
>>
>> I doubt I'll use your 'lines of code' method as a means of
>> encapsulation though ;-)
>
> The number of lines of code is more of a code smell which
> suggests that the module is going out of scope in size and
> functionality.
>
>> I have to think more, about what a module is really trying to
>> encapsulate.
>>
>> I'm sure there is a good blog that could come out of this
>> conversation.
>> (not by me though)
>
> While it is new to some people, we would only be rehashing
> existing ideas that have existed in the literature for 40+
> years.
Mmm...I think more than just 'some people' will be suprised when
they come to D, and suddenly find that a private member may not
be private at all.
Particulary those C++/C#/Java programmers - who represent the
vast majority of programmers on the planet.
private string _Name;
(oh..in D, this might be private..or it might not be..depends on
what you mean by private)
More information about the Digitalmars-d-learn
mailing list