Click to See Complete Forum and Search --> : Advice on a Library of Functions


Dark Sean
August 8th, 2001, 08:50 AM
Hello,
I have found myself going back to code I have written to cut and paste functions or procedures in new projects, and I thought it's about time I start to make a Library of helpful functions for use in the future.

What I want to know is, if I was to say make a library of String Functions, should I put the functions in a Class Module(.cls) or just Module(.bas)?

And why should I choose one over the other?

Thanks,

Sean

dufus
August 8th, 2001, 09:55 AM
Howdy,
I'd say you're probably best with .bas files; certainly true while you're still coding changes in. They tend to be easier to maintain, which is handy when developing them, as you don't have any of the worries of object compatibility, (which is nice). I tend to use classes to encapsulate data/code units together. By this I mean if I had a custom data structure that required functionality that was only relevant to the data held within that structure I'd build a class, thus encapsulating the data, and the code which runs over that data into one logical unit, (I realise thats a bit wordy, but I'm a coder, not shakespeare!). Building a good system around classes tends to be a fairly precise affair, especially with VB, (as it's not *entirely* Object Oriented...), and I would recommend sitiing down and really reasoning out your design. Classes in VB can really come into their own when designing distributed n-tier systems, (along with transaction processing, MQ's, etc).

My advice, (and it is, like all the above, just advice, not ultimate truth!) - stay with .bas for now.

HTH.....?

Jim Patterson.
Developer.

Dark Sean
August 8th, 2001, 10:02 AM
Thanks for the input!