Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Idelia Miller   on Jan 29 In MS Office Category.

  
Question Answered By: Julia Hughes   on Jan 29

My philosophy "always private, unless it needs to be public".

:-) Sounds silly, but it actually does mirror how I program.

Languages such as C++ and Java have more modes than just private  and public,
and part of what I consider good programming is to limit the visibility of
an item as much as possible. Therefore, I always start with private and
relax this as needed. So too with VBA. Make it private until you need to
access it from outside its module.

For variables (attributes, or whatever you like to call them) in modules,
consider always keeping them private and writing access functions  and subs
to get and set them if they need to be accessed from outside the module.

Note ,,, this is not a rule, it's a guideline. Feel free to ignore it when
circumstances suggest that public  variables would be a better way to go.

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Private versus Public Or get search suggestion and latest updates.


Tagged: