Is defining get/set methods for every field overkill?


Sat Nov 19 04:44:32 UTC 2022


On Saturday, 19 November 2022 at 04:37:51 UTC, thebluepandabear 
wrote:
>
> Thankfully I only code in D as a hobby, so I don't need to use 
> getters/setters! Thanks.

well, in that case, you can throw out everything that programmers 
have learnt over many decades, and just to whatever you want in 
your code.

But if you ever want to have users of your TUI Library, or want 
to have other developers contribute to it, you will want to 
follow reasonable guidelines.

Here is an example of a reasonable guideline (For C#, but can 
easily apply to D):

https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/ms229042(v=vs.100)





More information about the Digitalmars-d-learn mailing list