[AccessD] Where does WithEvents go?

Shamil Salakhetdinov shamil at smsconsulting.spb.ru
Sat Jun 7 13:28:30 CDT 2003


> I doubt seriously that I will go to the trouble
> of re-coding all of my programs...
I doubt you will not, John :) - well, I'm a kind of kidding, sorry - of
course this is your right and your choice to keep unchanged what you've done
already if it works well and if you follow the principle  "don't fix it to
not break it"...

...but knowing you I'd bet you'll change some of your code when you'll get
familiar with a new(?) programming paradigm, which is very popular now and
which uses a Service(read: Object Interface) not Object concept as a key
concept of the modern programming methods/technologies/industry...

...all that Web Services etc. - have you heard already this buzz around
you?...

...Service-Oriented Programming Paradigm (lets call it SOPP) is a kind of
OOP but it is far from being a classical OOP and it (SOPP) promises a lot in
scaling, reusability, easier installation(zero administration) etc.etc. -
and these are justified promises AFAIK...

...with SOPP you don't care(/you're just forbidden to care by this paradigm)
about creating external objects(/services) in YOUR program - so there is no
need in the New keyword to create/get services/objects from outside(even
from currently local code library if this library may well be endlessly
upscaled in the future)...

...armed with SOPP you just call for, get and use Object Services - and this
isn't your task to create them in your program....

...and SOPP is a modern extension/development of well-known (e.g. COM)
"Programming Against Interfaces Paradigm" (PAIP) - when one is programming
against interfaces they don't need public creatable classes - and
programming against interfaces is a very powerful paradigm with a lot of
consequences and applications...

...so IMO MS takes care about us MS Access VBA developers by not allowing to
have creatable custom classes in library databases by thus pushing/forcing
us to follow the best of the modern programming paradigms/methodologies and
to not waste our time on obsolete ones...

...of course one can just write class factory wrapper functions and don't
learn and don't follow SOPP and PAIP - they risk to rewrite some(/a lot?) of
their existing code in the future...

I hope this above doesn't look like an empty soap-boxing and hoaxing,
I just wanted to provoke you, John, to investigate in more details very
promising SOPP and PAIP,
Yours,
Shamil :)

----- Original Message -----
From: "John Colby" <jcolby at colbyconsulting.com>
To: <accessd at databaseadvisors.com>
Sent: Saturday, June 07, 2003 6:28 PM
Subject: RE: [AccessD] Where does WithEvents go?


> OK, I understand what you are up to.  I suppose it is in fact easier to
use
> a class factory than to go through the agony of the export / import, since
> with the one property exposed inside Access, the process of instantiating
> the class is all that is left.  The exposed property allows the use of the
> Intellisense functionality.
>
> I doubt seriously that I will go to the trouble of re-coding all of my
> programs, but I may very well use this method in the future.  I must say
the
> argument of "breaking fences" and so forth don't mean much to me.  This
has
> been possible since A97 and continues through XP so it seems like MS is
> content to leave things the way they are.
>
> John W. Colby
> www.colbyconsulting.com
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Shamil
> Salakhetdinov
> Sent: Saturday, June 07, 2003 6:06 AM
> To: AccessD
> Subject: Re: [AccessD] Where does WithEvents go?
>
>
> <<<
> > None of the properties that are exposed when
> > the class is exported to a text
> > file is visible from within Access.
> >>>
> John,
>
> Please have a look here/dowload:
> http://smsconsulting.spb.ru/samples/exposed.jpg (137 244 bytes)
> I follow the principle that  "one good picture is better that thousand
> words" - and this good IMO picture referenced above shows that VB_Exposed
> property of MS Access 2000/XP/... VBA modules can be set from within MS
> Access...
>
> > why you wouldn't simply set both of
> > the properties I discussed to true
> This is not standard functionality and I can't recommend that because MS
can
> well close this "backdoor" in the future - then all your coding will have
to
> be changed.
> VB_Exposed is standard for MS Access 2000 and up - so it is safe to use
with
> wrapper class factory functions, subs, custom classes...
>
> In general I don't like to use New keyword with custom classes here and
> there because as I said this makes the coding unorganized - when you've a
> special class factory code then you can control custom classes' instances
> creation in the sense that you can concentrate all this code in one-two
> modules etc.
>
> There is also a technical reason of avoiding to use
>
> Dim obj as New MyClass
>
> This code above AFAIK uses 'just in time custom class instance creation
> (JITCCIC)' technique - and therefore it may generate a lot of additional
> support code on compilation...
>
> Dim obj as MyClass
> set obj=new MyClass
>
> shouldn't use JITCCIC but to avoid temptation of using shorter code
>
> Dim obj as New MyClass
>
> I don't use it too :) - speaking seriously:
>
> Dim obj as MyClass
> set obj = MyClassFactoryCreateObject("MyClass")
>
> IMO gives a developer much more freedom for future extensions and
safety...
> E.g. using this approach you can well make your class MyClass an Interface
> Definition Class in the future WITHOUT breaking any of your
functionality -
> etc...
>
> Well, all that are my preferences and of course they can be argued... -
this
> message isn't an invitation to such a discussion - I made my choice
several
> years ago :)
>
> > What does the wrapper buy you?  It seems like extra work, an extra layer
> > that things have to go through, as well as an extra layer that I have to
> > write (the helper function).  We don't do that with the libs that MS
> > publishes do we?
> Yes, some more work but without breaking "MS fences" - they didn't give us
> an opportunity to set VB_Creatable = True from within VBA editor - in the
> future they may well introduce this functionality as standard or drop it
> completely by closing "backdoor" of exporting/manually setting
> VB_Creatable=True/importing back custom class module. And I don't think
> they can drop standard (MS Access 2000, 2002,...) functionality of
> VB_Exposed=true - then they will break versions compatibility...
> Yes, MS allows to use New with their libraries but they use C++ or VB to
> write these libraries , where this is a STANDARD (COM-)functionality
> when these libraries expose their CREATABLE public objects...
>
> > > And yes, the ClassExposer add-in would be nice.
> I will try to make conversion in the near future - it wasn't
straightforward
> "convert to Acc2000" when I tried to make it first time in the past..
> And then I also found that MS Acces 2000 has setting  VB_Exposed as
> standard functionality...
>
> Shamil
>
> ----- Original Message -----
> From: "John Colby" <jcolby at colbyconsulting.com>
> To: <accessd at databaseadvisors.com>
> Sent: Saturday, June 07, 2003 3:14 AM
> Subject: RE: [AccessD] Where does WithEvents go?
>
>
> > Shamil,
> >
> > None of the properties that are exposed when the class is exported to a
> text
> > file is visible from within Access.  What I don't quite understand is
why
> > you wouldn't simply set both of the properties I discussed to true and
> > directly see the classes from any database referencing the library.
Doing
> > this allows seeing all of the class properties, functions etc, as well
as
> > directly dimensioning a class variable.
> >
> > What does the wrapper buy you?  It seems like extra work, an extra layer
> > that things have to go through, as well as an extra layer that I have to
> > write (the helper function).  We don't do that with the libs that MS
> > publishes do we?
> >
> > And yes, the ClassExposer add-in would be nice.  It appears that the
> object
> > on your site is compiled - I can't open or convert it in A2K.  I could
> > certainly write my own if I need to.
> >
> > John W. Colby
> > www.colbyconsulting.com
> >
> > -----Original Message-----
> > From: accessd-bounces at databaseadvisors.com
> > [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Shamil
> > Salakhetdinov
> > Sent: Friday, June 06, 2003 6:50 PM
> > To: AccessD
> > Subject: Re: [AccessD] Where does WithEvents go?
> >
> >
> > <<<
> > > If MyClass is in a lib, then this dim statement doesn't work since
> MyClass
> > > isn't exposed.
> > >>>
> > John,
> >
> > But you can dimension the class specifically as that class type if this
> > custom class's Instancing property is set to PublicNotCreatable. Then
you
> > create instance of this class using wrapper/helper function. And you can
> > sink an event of this class declared as public.
> >
> > Instancng is a standard property for custom class modules in MS Access
> 2000
> > and XP.
> >
> > Are we talking about different things?
> >
> > Shamil
> >
> > P.S. Unfortunately I don't see Instancing property for Forms' and
Reports'
> > modules (am I missing it?) - so maybe ClassExposer Add-In for MS
> > Access2000/XP to expose forms' and reports' modules isn't a totally
crazy
> > idea....
> >
> > ----- Original Message -----
> > From: "John Colby" <jcolby at colbyconsulting.com>
> > To: <accessd at databaseadvisors.com>
> > Sent: Saturday, June 07, 2003 12:10 AM
> > Subject: RE: [AccessD] Where does WithEvents go?
> >
> >
> > > Shamil,
> > >
> > > I don't understand how to sink an sourced from a class in a library
> > without
> > > being able to dimension the class specifically as that class type
> > >
> > > dim withevents SomeCls as MyClass
> > >
> > > If MyClass is in a lib, then this dim statement doesn't work since
> MyClass
> > > isn't exposed.
> > >
> > > John W. Colby
> > > www.colbyconsulting.com
> >
> >
> > _______________________________________________
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
>
>
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com



More information about the AccessD mailing list