Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Many variables vs array
Message
From
14/11/2020 11:00:17
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01677141
Message ID:
01677144
Views:
69
It's always a matter of preference. Personally I prefer to use business objects, in this case meaning one customized object for each table. And these objects will inherit from one data handling base class which does most of the work. Only the specific details are taken care of by the business objects.

So I have one MSSQLTables base class for MSSQL data and one MySQLTables for MySQL tables. These to *SQLTables are again derived from a common DataHandling object. This means that both *SQLTables objects will have exactly the same PEMs, but with different values where that's necessary. These *SQLTables will also take care of the connection strings and so on.

If I later need to convert my application to use for instance Postgres, I will create a PostgressSQL subclass from the DataHandling class, and change the base class for all the business objects. Plus probably some changes in some of the business classes.

>The values are not really related. But they are designed to address the issue of different ODBC drivers that the application could possible use (I had a thread about that a few days ago). Here are a couple of examples:
>
>*-- The name of the property has a table name with columns of type VarChar(Max) 
>oApp.VarCharMaxTable1 = "cast(Field1 as Text) as Field1, cast(Field2 as Text) as Field2)"
>oApp.VarCharMaxTable2 = "cast(FieldA as Text) as FieldA"
>
>
>As you can see (above) that I can store all these strings into elements of an array or have a separate variable.
>Thank you.
>
>>Depends. If the values are related, like different days of a month, use an array. If not, use properties with proper names.
>>
>>What kind of data will go into these properties?
>>
>>>Hi,
>>>
>>>I need to add some properties (all of type string) to the application class/object. It will probably start with about 10 but may grow to about 70 variables (in time). I can create each as a separate string property or combine them all into an array property.

>>>Example:
>>>
>>>oApp.Property1 
>>>oApp.Property2
>>>*-- vs
>>>oApp.aProperty[1]
>>>oApp.aProperty[2]
>>>
>>>
>>>Which approach is a better practice, in terms of memory management at run-time?
>>>
>>>TIA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform