Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Internal or Public - Best Practice??? 2

Status
Not open for further replies.

golcarlad

Programmer
Nov 23, 2004
232
0
0
GB
When auto generating a method in a class, Visual Studio always makes the accessor of the method Internal - not public, thing is Im used to, out of habit by using Public, but I guess if you dont want other assemblies to see your methods then Internal is the best thing to use.

Do you guys use Internal when writing your methods if you want other classed in your assembly to use it or do you still plump for Public.

Interested in your thoughts, and a bit of discussion...
 
JurkMonkey is right here. You should work on the principle of least privilege - the fewer knobs and levers you expose to the outside world the better, as it stops other programmers from abusing your code. It also means that you only have to worry about your published interfaces, giving you the freedom to refactor your code (or even gut it and do a complete rewrite) without unnecessary pain.

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top