Link to home
Start Free TrialLog in
Avatar of Inglorious
Inglorious

asked on

Function/sub naming conventions

Hey guys,

I come from a java background and I'm wondering about naming conventions used in subs/functions in .Net suite, mainly VB.Net

For the mutators i'm used to: setSomething() {}

Accessors: getSomeData() {}

Booleans: isSomethingSetToTrue() {}

This doesn't quite work in VB.Net, mostly because I never really worked with .Net controls.

ASKER CERTIFIED SOLUTION
Avatar of Tapan Pattanaik
Tapan Pattanaik
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
There is no naming conventions at all for "mutators" and "accessors". This are known as "properties" in the .net world (any .net language).
For vb, you can define a property with "getters" and "setters" the following way:

Tutorial: http://www.vbdotnetheaven.com/Uploadfile/rajeshvs/PropertiesInVbDotNet04192005060237AM/PropertiesInVbDotNet.aspx
Public Property X() As Integer
   Get
     Return x
   End Get
   Set(ByVal Value As Integer)
     x = value
   End Set
End Property

Open in new window

Personally I like the first set of conventions listed - they work in both VB & C# and I find the code very readable sticking to those - but as always with naming conventions - its mostly personal preference and the discussions usually get a little heated :)

The conventions your used to should work in VB.net you just have to remember that unlike java & c# vb.net isn't case sensitive.