[V4RB] static binary link declaration

Erik Mueller-Harder valentina-list at vermontsoftworks.com
Wed Nov 3 09:54:12 CST 2004


Hi, Ivan --

On Nov 2, 2004, at 17:20, Ivan Smahin wrote:

> What is the problem  with "static" way?
> As for me it's almost the same as "dynamic". The difference is only in 
> db.Create
> code-place.
> Unfortunately I'm not fluent in RB so it would be great if you clarify
> the situation more detailed.

Before the database can be created with db.Create, the db object must 
be instantiated:

	    db = new dbClass

dbClass, in this case, is a subclass of VDatabase with properties 
pre-defined by V4RB (name, schemaVersion, etc.) and with properties 
defined by the developer (tables, mostly).

If the developer is truly taking an object-oriented approach, each 
table property of the database is defined in the database's 
constructor:

	tblPerson = new personTbl
	tblPhone = new phoneTbl

and each table is itself defined as a subclass of VTable with 
properties pre-defined by V4RB (name, locale, etc.) and with properties 
defined by the developer (fields, mostly).

Generally, I stop there and set up each field thus:

	accessible = new VBoolean("accessible")

But a whole-hearted OOP approach might actually involve defining each 
field as a subclass of VField (or of their respective VField 
subclasses, such as VVarChar).


The problem, then, is currently with the new "link" and "indexStyle" 
properties of VDatabase.  If I define them within the constructor 
method of the database, my application crashes -- I think because 
db.Create hasn't yet been called.

Why should I not just define the links and indexStyles after I call 
db.Create?  Well, in the case of indexStyles, I need to create the 
style and assign it to the field before the field is created -- but the 
field is automatically created when I call db.Create.  But (even if 
that weren't a problem), it seems very inelegant and un-OOP-like to 
create links and indexStyles after the fact and, worst -- I'm unable 
without a lot of extra work to define them as properties of my database 
and table subclasses.

Does this answer your question, or have I just muddied the waters?

Thanks for your help,

-- Erik



More information about the Valentina-beta mailing list