how to make private class member private

rikki cattermole rikki at cattermole.co.nz
Tue Mar 13 12:10:07 UTC 2018


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.


More information about the Digitalmars-d-learn mailing list