Hi, All!
Before, Ive always put my utility subs/functions in a module.
for example module "useless" contains one sub
Public Sub printHello()
MsgBox("Hello")
End Sub
But since the true classes & OOP are now coming in. I can just put the sub as a shared sub in Useless class.
for example class "Useless" contains one sub
Public Shared Sub printHello()
MsgBox("Hello")
End Sub
I know there are differences in calling them. One is "printHello()", the other is "Useless.printHello()"
But I feel in this particular issue, class is superior, because you can see the grouping (by class name) directly in the code. So something like "StringUtility.ConvertToNumeric("012")" and "DatabaseUtility.GetDatabaseName()" seems to be nicer to read, especially when youve got lots and lots of utility subs/functions.
So does it mean that modules are absolete? What are the advantages of using modules than classes in this particular issue (not as the whole, just this issue)?
Before, Ive always put my utility subs/functions in a module.
for example module "useless" contains one sub
Public Sub printHello()
MsgBox("Hello")
End Sub
But since the true classes & OOP are now coming in. I can just put the sub as a shared sub in Useless class.
for example class "Useless" contains one sub
Public Shared Sub printHello()
MsgBox("Hello")
End Sub
I know there are differences in calling them. One is "printHello()", the other is "Useless.printHello()"
But I feel in this particular issue, class is superior, because you can see the grouping (by class name) directly in the code. So something like "StringUtility.ConvertToNumeric("012")" and "DatabaseUtility.GetDatabaseName()" seems to be nicer to read, especially when youve got lots and lots of utility subs/functions.
So does it mean that modules are absolete? What are the advantages of using modules than classes in this particular issue (not as the whole, just this issue)?