Non-ugly ways to implement a 'static' class or namespace?

ProtectAndHide ProtectAndHide at gmail.com
Sat Jan 28 23:19:35 UTC 2023


On Wednesday, 25 January 2023 at 15:43:46 UTC, ryuukk_ wrote:
>
> using static class and static function is not "OOP way" of 
> doing things, it's a hack to mimic procedural style because 
> Java doesn't have proper modules / scoping
>
> mimicking the shortcomings of Java is a bad idea imo
>
> D empowers you to write simple yet effective code, you should 
> give it a try and embrace it

Classes (and this includes static classes) are 'one' means of 
encapsulation.

Encapsulation is related to, but independent of, object-oriented 
programming.

That is, you can do OOP without classes, and you can use classes 
and not do OOP.

So classes also 'empower' programmers ;-)

and btw. OOP also empowers programmers ;-)

There is no convincing argument that I have heard, ever, as to 
'the one correct way' to go about dividing a program into 
independent parts.


More information about the Digitalmars-d-learn mailing list