Wed Oct 17 - Avoiding Code Smells by Walter Bright
    Nicholas Wilson 
    iamthewilsonator at hotmail.com
       
    Wed Oct 31 05:42:26 UTC 2018
    
    
  
On Wednesday, 31 October 2018 at 05:00:12 UTC, myCodeDontSmell 
wrote:
> I did find it confusing however, that you discuss leaky 
> abstractions, and putting your public interface at the 
> beginning of your code (and all the other crap below it)... but 
> then, in D, once your write your abstraction, say a class, with 
> it's public interface, all the code below it can do whatever it 
> likes to that class, making it a leaky abstraction.
>
> That's sure sound like code smell to me.
>
> i.e. A class (perhaps one of the most important abstractions in 
> programming) within a module, is *always* a leaky abstraction 
> (within the module), because of the way the code further down 
> can just ignore the interface. In fact, there is no way at all 
> to ensure code below the class uses that interface.
>
> So I can't help but see contradictions everywhere, in D.
That is by design, because in D the unit of abstraction is the 
module, not the class.
Running into such problems is a sign that your module is too 
large, and should become a package.
    
    
More information about the Digitalmars-d-announce
mailing list