Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 20th, 2006, 05:24 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Woody, could you elaborate on “ . . . and very powerful from an object oriented point of view.”? Thx.

Though it is true that .NET has a great deal of facility in processing XML, that's not the case with VB6.
I do use .INI files for my VB6 web app suite though. I wanted to be able to make modifications to configuration at the drop of a hat, and without having to stop anything that was running. So I read the .INI info at the beginning of every Request.
 
Old November 20th, 2006, 06:23 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by BrianWren
 Woody, could you elaborate on “ . . . and very powerful from an object oriented point of view.”? Thx.

Though it is true that .NET has a great deal of facility in processing XML, that's not the case with VB6.
I do use .INI files for my VB6 web app suite though. I wanted to be able to make modifications to configuration at the drop of a hat, and without having to stop anything that was running. So I read the .INI info at the beginning of every Request.
First of all, the VB6 xml capabilities are very strong, in my opinion. All the functionality you need is available in the MSXML components. I've used it for years and its worked well for me.

In many ways there is nothing wrong with INI files, and in some ways they are similar in purpose and use to XML files. However, typically you cannot easily represent a deeply nested model with INI files - they provide a grouping mechanism, and a key:value mechanism, and that is about it.

So... I see XML configuration as being able to contain an object graph that can be nested as deeply as you like, and makes it easy to relate attributes as well as values at any level. From an object oriented point of view you can traverse the tree of the XML and reconstruct or "rehydrate" just about any set of objects you have need for. In .NET there are mechanisms provided by the framework for dealing with this - but there is nothing complex or magical about them, and the same pattern can easily be followed in VB6.

In a way, this type of configuration can be thought of as a mini-language that can drive an object factory. This sort of thing allows for you to configure an application so as it begins work on something it can flesh out the configured objects via an abstract factory pattern. This is great for things like strategy pattern where you create and use the objects that are configured for some purpose, and never have to use conditional logic to determine what the configuration is.

Anyway - that is just a quick start on the idea of how powerful this sort of configuration can be. Obviously, you could create a similar model using traditional INI files, with KEYs in higher groups will have groups of their own with additional information, and so on, but this becomes very laborious and hard for humans to view, whereas XML was invented for this sort of thing. The registry can also store hierarchical data, but again - its not nearly as easy to work with as XML.

Additionally, this sort of data can also be stored in a database, and sometimes that is a much better place to put it (as opposed to as files somewhere). In this scenario the data could be stored in the same manner as other application related configuration. On the other hand, the data could be stored as XML with the db merely providing a place for the storage rather than the stucture. To me, this is also a very powerful model. The advantage of XML over the traditional Relational db model is that the XML is easily changed and extended on the fly with no change to the database tables. There are a number of considerations, but as far as I am concerned this works well if you work out all the details.

At the same time, XML can provide very simple configuration information in a much more readable and flexible form than the INI or registry models. You can read the XML into a document, and then search it and work with it in a more or less natural manner.

I hope that helps.

Woody Z http://www.learntoprogramnow.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
02 IN 01 Desktop App (App+Wind Handler) pk_ocp .NET Framework 2.0 0 February 26th, 2008 02:58 PM
Changing Settings.settings when assembly is in GAC evandro.paula .NET Framework 2.0 0 September 25th, 2007 09:54 AM
Convert a VB.Net app to a web app? furjaw VB.NET 3 September 24th, 2007 12:27 PM
How to load a file into your own app? Apocolypse2005 Beginning VB 6 2 October 25th, 2006 03:59 PM
Error on local load of downloaded app Gjerstad BOOK: ASP.NET Website Programming Problem-Design-Solution 4 June 21st, 2003 10:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.