Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / September 2008



Tip: Looking for answers? Try searching our database.

probably OT, architecture question OO references

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MP - 15 Sep 2008 17:08 GMT
Please redirect me if there's a better location for general architectural
issues re: object oriented design

vb6 and ado (or sqlite)
I have a couple vb6 objects
one that collects some data cBlockData.cls
one that wraps database functionality IDBController.cls (either ado or
sqlite implementations)

some apps that would want to use cBlockData also need to put that info in a
database for further processing so they would reference IDBController
some apps would not need database

some apps that use the database object would also need the cblockData obj
but some would not

currently it seems i have two options for passing info from one to other
If i give the cBlockData object the responsibility to "Push info into " a
database, I pass a db object into the blockData object
in cBlockData
Sub ToDatabase(oDbController as IDBController)
....
but if i give the responsibility to the dbController to "Pull info from " a
source object I pass the cBlockData obj to the cDB obj
in cDbController.cls
Sub ProcessBlockData(oBD as cBlockData)
....

either way I couple two objects that sometimes belong together and sometimes
don't have to both live in a given project.

I suppose I could generalize cBlockData to IDataSource
so db projects that don't need cBlockData wouldn't have to reference
cBlockData(and it's long chain of other references that it depends on)
the project would just have to contain a IDataSource object (even if it
wasn't used)
   so there'd only be one unused reference instead of a long chain of
unused references...
then in cDbController.cls
Sub ProcessBlockData(oBD as cBlockData) would become instead...
Sub ProcessDataSource(oDS as IDataSource) ...
....

either that or I create near duplicate objects that do and do not contain
reference to the other kind of object (datasource or database wrapper)
cBlockData-versionA ... with db
cBlockData-versionB ...no db
cDB-versionA    ...uses blockData
cDB-versionB  ...uses some other source of info

that seems like bad redundancy problem...

it's monday and i havent finished my first pot of coffee yet so maybe all
this is mudddled fuzzy thinking (as usual for me)???
thanks for any pointers
mark
Ralph - 15 Sep 2008 19:52 GMT
> Please redirect me if there's a better location for general architectural
> issues re: object oriented design

"comp.object" probably comes as close as any in posting questions concerning
"general architectural issues", but it is low traffic, and if you suggest
using VB you will get no response or a lecture on the requirements for a
language to be considered an OOPL. Other Forums are academic and you better
know GOF, Fowler, Meyer, etc., forward and backwards, else again you will
either be ignored, lectured, or told to get a good book. (Corollary to being
told to RTFM. <g>)

So give comp.object a shot, but leave VB out of your post.

Most newsgroups (the useful ones anyway) are all dedicated to a specific
language, platform, or design tool. AFAIK there isn't a highly populated one
for classic VB.

-ralph
MP - 15 Sep 2008 21:26 GMT
>> Please redirect me if there's a better location for general architectural
>> issues re: object oriented design
[quoted text clipped - 4 lines]
> using VB you will get no response or a lecture on the requirements for a
> language to be considered an OOPL.

Yes, well, of course my inclusion of vb6 was merely a sleazy attempt to make
it look slightly on topic so you would respond <g> with your usual OO
wisdom...
guess it was too transparent <g>
mark
Ralph - 15 Sep 2008 21:01 GMT
> Please redirect me if there's a better location for general architectural
> issues re: object oriented design
[quoted text clipped - 4 lines]
> one that wraps database functionality IDBController.cls (either ado or
> sqlite implementations)

IMHO - This is where is all goes wrong.

When doing OOA/OOD I suggest you drop the terms "...Data" or "...Database"
from your vocabulary. "Object-Oriented" analysis and design is the opposite
from "Data-Centric" analysis and design. Those terms are filled with
subjective connotation which can taint your solution.

I suspect that is what has happened here. Objects that need to be stored
likely need the services of IDBController. It is also easy to visualize why
IDBController needs to be versioned (Specialization). But it is not clear
why any object would need the services of a "Block of Data". Objects are
methods(rules) AND data.

I think you will find that cBlockData is an unnecessary abstraction, not a
first-class object, and is not useful within your domain.

But then I don't really know squat about your domain.

-ralph
Steve Gerrard - 16 Sep 2008 02:25 GMT
> currently it seems i have two options for passing info from one to
> other If i give the cBlockData object the responsibility to "Push info into
> " a database, I pass a db object into the blockData object
> in cBlockData
> Sub ToDatabase(oDbController as IDBController)

The good choice...

> ....
> but if i give the responsibility to the dbController to "Pull info
> from " a source object I pass the cBlockData obj to the cDB obj
> in cDbController.cls
> Sub ProcessBlockData(oBD as cBlockData)
> ....

The bad choice.

Asking all implementations of IDBController to know all about how to store any
objects that might be passed to them is nutty. The place for code that knows how
to store a particular kind of object is in the class definition of that object.

> either way I couple two objects that sometimes belong together and
> sometimes don't have to both live in a given project.

Oh, my, that would be ... perfectly normal. Do all your VB apps use all the
classes defined in VB?

Particularly since the name IDBController implies it is an interface, and would
carry virtually no baggage for an app that was only using cBlockData. Even if
you only had the actual class, and it added 200K of unneeded code, well so what.
MP - 16 Sep 2008 03:12 GMT
>> currently it seems i have two options for passing info from one to
>> other If i give the cBlockData object the responsibility to "Push info
[quoted text clipped - 24 lines]
> Oh, my, that would be ... perfectly normal. Do all your VB apps use all
> the classes defined in VB?

:-) good point...
sometimes i just overthink things <g>

> Particularly since the name IDBController implies it is an interface, and
> would carry virtually no baggage for an app that was only using
> cBlockData. Even if you only had the actual class, and it added 200K of
> unneeded code, well so what.

Thanks for the input.  By sheer dumb luck that was the choice I had made and
how it's structured.
I just wasnt' sure if I was going in the right direction.

...the reason I had considered the other way around is I realized my current
design has
cBlockData.ToDatabase(oDbController) writing a record for each object in a
collection....
where i have some hundreds of objects each writing a single record it makes
more sense to collect them all and write once
so I just need to resturcture my "supply side"
'instead of the current version...
'................................................................
in Documents.ToDatabase (oDbController)
For Each oDoc in oDocs
   oDoc.ToDatabase (oDbController)
Next
...and...
in Document.ToDatabase (oDbController)
  For Each oBlkData in oDoc
       oBlkData.ToDatabase(oDbController)
  Next
'................................................................

I should do something like
oDocuments.ToDatabase (oDbController)
   'gather all data from all docs and send once to db
   AllDataFromAllDocuments.ToDatabase(oDbController)

Thanks
mark
Steve Gerrard - 16 Sep 2008 03:32 GMT
> ...the reason I had considered the other way around is I realized my
> current design has
[quoted text clipped - 3 lines]
> makes more sense to collect them all and write once
> so I just need to resturcture my "supply side"

I think that should be the job of the DBController. It is quite common for the
DB object to gather up the various records, then set about actually saving them
in whatever way is suitable for the actual database. I would probably just have
some method on the DBController called SaveChanges, which would indicate that I
was done writing things, and now would be a good time to actually commit them to
the database. Depends what DBController is actually doing, of course.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.