extensibility - I'm using "protected" instead of "private", because someday I could need to extend my classes, is that bad? -


i have noticed pattern in code. choose protected, rather private, default access label "hidden" methods , fields in classes. because hides details class functioning users of class, while still leaving space extension in future. there drawback in coding "policy"?

thank you
tunnuz

generally speaking never make because day might having implement or yadayada (it makes life complicated , miserable imho..). if have method should used within class, make private. if ever have extend inheritance reconsider functions might have accessed bellow. anyway abstract methods superclass anyway have thinking of needed when , where..

a reason why ignore said private methods, if want test internal functions i.e. in unit test. in c# can allow project see protected methods externally can write tests against them.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -