Naming conventions

xPaul

Registered User.
Local time
Today, 01:12
Joined
Jan 27, 2013
Messages
65
Hi all,

I just wanted to ask what your naming conventions are for Procedures and modules. Currently, I name:

Modules - bas<Name> (basFEExit for example)
Procedures - <module shortened prefix><Name of procedure> (bfeeExit)

I understand that as long as I'm consistent with naming conventions there isn't really an issue, however I want to ask:

  • Is there difference between:
    Code:
    Private Function
    Code:
    Public Function
    vs
    Code:
    Function
    (the same applies to Subs) within modules and if so, what?
  • Would you prefix your Functions within a module as what you are declaring it as? For example:
    Code:
    Function blnIsValueTrue() as Boolean

I really think I'm over complicating this and causing myself confusion, but thought I'd get an independent opinion.
 
you need to declare a function as public if you want to use it outside of the module. If the function is in a form module, the form also needs to be open. Not declaring either defaults to private.

regards naming conventions, entirely up to you, main thing is to be consistent.
 
with regards 'as Boolean' etc - this types the value returned. not declaring it will return a variant datatype which can be useful or a problem depending on what the function is being used for
 
I think a sub/function is public unless specifically declared private.

variables are public or dim (private)

I tend to try and have meaningful function/sub names, and certainly don't prefix them with anything, but it's whatever works for you.

I actually tend to put variables in type containers to get intellisense.
 
I declare variables with a prefix of the type.
For functions or subs i generally use a name that actually explains what the function do.
In your case,
Code:
Function IsValueTrue() as Boolean
would be enough for me.

About that private/public opinion, I use always private. If i need to call a private function from an other form, i make a public function that call the private one.
 

Users who are viewing this thread

Back
Top Bottom