Book Review: Beginning Visual Basic 6 Objects
Normally, at this point, we'd hit the paper and produce a full design of the application. This design would be from the point of view of the way things are done now (user requirements), the way they should be done in the new system (system requirements), and the way that it's all going to actually work (functional requirements).
My goal within this chapter, however, is to concentrate first and foremost on getting us through the technical aspects of OO development with Visual Basic. As we saw in Chapter 1, program design is a crucial part of object-oriented development, which is why I've devoted the whole of Chapter 9 to design techniques.
In this chapter, I'm going to speed us through the design phase so we can focus on the practical aspects of object-oriented development. If you're madly keen to learn about object-oriented program design, then take a peek at Chapter 9.
So the simple design I've prepared for us in this chapter looks like this:
We have a data source (the Biblio database), which is going to be accessed by two classes. As we saw in the last chapter, the beauty of classes is that we can hide the data source in a neat black box with a simple interface.
Remember, an interface in object-oriented terms is the collection of methods, properties and events that go towards unleashing the power of our objects in a way which is easy to get to grips with.
These classes are then used in two forms to provide the Title Browser and Author Maintenance functions that we'll require.
Our next step (and this is really where we swing back into the design process), is to come up with the interface for these objects: the properties and methods that will be used to provide access to the underlying data. In the interest of keeping things real simple for the moment, let's just take a look at the Titles class:
|MoveFirst||Moves to the first title in the data source|
|MoveNext||Moves to the next title in the data source|
|MovePrevious||Moves to the previous title in the data source|
|MoveLast||Moves to the last title in the data source|
Pretty clear I think: we're going to provide some very similar functionality to something we might find in a recordset object itself, albeit without the ability to update the underlying data. Ah, the data... we're going to need some properties in there to get at that underlying data:
|BOF||Boolean to indicate if we're at the beginning of the Titles table|
|EOF||Boolean to indicate if we're the end of the Titles table.|
|Title||The Title field from the Titles table|
|Year_Published||The Year Published field from the Titles table|
|ISBN||The ISBN field - Titles table|
|PubID||The PubID field - Titles table|
|Description||The Description field - Titles table|
|Notes||The Notes field - Titles table|
|Subject||The Subject field - Titles table|
|Comments||The Comments field - Titles table|
So there we have it. A simple interface that exposes the underlying data as well as the functionality to manipulate that data.
Page 4 of 9