Groups | Blog | Home
all groups > inetserver asp components > november 2003 >

inetserver asp components : COM Newbie Help


Damien Phillips
11/13/2003 5:36:13 PM
Posted this on microsoft.public.vb.com but its probably more appropriate in
here.

Hi and thanks in advance!

I want to move existing VBS code from asp web pages into an activex dll to
aid code reuse. The existing functions can be grouped into three broad
groups.

Content - functions present on all pages (or most of them) that generate
dynamic html code.
Email - creation of emails (web mail forms, subscription emails etc).
Database - interogation of mySQL db resulting in an array to be used by
content and email functions.
Misc - miscellaneous functions such as string formatting.

Do I;

a) stick everything in one dll with one class module and the functions set
as public and private according to use.
i.e. customdll.allfuncs

b) stick everything in one dll with multiple modules.
i.e customdll.contentfuncs, customdll.emailfuncs etc

c) split up the functions by category as above and put them in separate
dlls.
i.e. contentdll.funcs, emaildll.funcs

If c, I assume that you would call the functions in a similar way to that
used in ASP

i.e.
Set objemail = CreateObject("emaildll.funcs")
emailsent = objemail.sendemail(to, from, subject, body) 'returns boolean
true if email successfully sent
<email failure code>
Set objemail = Nothing

Pretty much all the tutorials I've seent to date cover creating a single
dll, but if I were to put everything in one dll in the default class module,
I can foresee it becoming more of a pain to edit.

Hope someone can clear this up for me.

Many thanks,

Damien



CST
11/14/2003 11:53:37 AM
If you are not too keen on using vb COM, have you looked
into puting your functions into include files? That
would do the same thing as the COM. My personal
preference is to put all your code into 1 COM object so
that you have 1 source to maintain. The only bad thing
is that if you need to make the changes, obviously this
will affect all of your functions and you will need where
as if you have multiple, you don't have to worry about
your changes "breaking" anything.

[quoted text, click to view]
Chris Barber
11/15/2003 2:13:32 AM
As long as the functionality can be explicitly separated as per your
groupings then use separate objects. These will all be quicker to load and
easier to use with a smaller footprint of methods and properties.
You should definitely group functions that will not change significantly
over time into a small library object so that it becomes a sort of 'de
facto' standard reference from within standard ASP and your other DLL's -
sort of like a hierarchy of top level and low level functionality.
For efficiency you should consider using MTS to host them but this does
impose the requirement that the function calls should *all* be stateless
(they don't have to be but you won't see any saleability benefits unless
they are [stateless]).
In a real world scenario then there is no benefit whatsoever to using a
single class containing all the functionality and it would be horrible to
maintain, separate out logical 'objects' and usage into separate classes
irrespective of the number of DLL's.
If the amount of code is sufficiently small then you probably could just use
one DLL but you'd still split into separate classes.

Of course in terms of binary compatibility then you would see a maintenance
benefit from a single DLL since you would have no reason to have to think
about the compatibility - you could recompile to your hearts content and not
break anything.

Since you asked the question about using single / multiple classes at all
then I have to assume that your level of experience with VB is not
particularly extensive so I'd suggest you get a book about VB and ActiveX /
COM and read it from cover to cover about 4-5 times! It will help enormously
in the decisions that you want to make.

I really liked "Dan Appleman's Developing ActiveX Components with Visual
Basic":
http://www.amazon.co.uk/exec/obidos/ASIN/1562765760/qid=1068862226/sr=1-3/ref=sr_1_2_3/202-8457373-3890220

Hope this helps.

Chris.

[quoted text, click to view]
Posted this on microsoft.public.vb.com but its probably more appropriate in
here.

Hi and thanks in advance!

I want to move existing VBS code from asp web pages into an activex dll to
aid code reuse. The existing functions can be grouped into three broad
groups.

Content - functions present on all pages (or most of them) that generate
dynamic html code.
Email - creation of emails (web mail forms, subscription emails etc).
Database - interogation of mySQL db resulting in an array to be used by
content and email functions.
Misc - miscellaneous functions such as string formatting.

Do I;

a) stick everything in one dll with one class module and the functions set
as public and private according to use.
i.e. customdll.allfuncs

b) stick everything in one dll with multiple modules.
i.e customdll.contentfuncs, customdll.emailfuncs etc

c) split up the functions by category as above and put them in separate
dlls.
i.e. contentdll.funcs, emaildll.funcs

If c, I assume that you would call the functions in a similar way to that
used in ASP

i.e.
Set objemail = CreateObject("emaildll.funcs")
emailsent = objemail.sendemail(to, from, subject, body) 'returns boolean
true if email successfully sent
<email failure code>
Set objemail = Nothing

Pretty much all the tutorials I've seent to date cover creating a single
dll, but if I were to put everything in one dll in the default class module,
I can foresee it becoming more of a pain to edit.

Hope someone can clear this up for me.

Many thanks,

Damien




AddThis Social Bookmark Button