Summary

In this chapter, you learned how to create a class diagram to model the classes and their relationships. Class diagrams provide a roadmap of your code structure. Ideally, class diagrams should be separated into a presentation layer, business logic layer, and data access layer. The presentation layer can map to your Use Case diagrams. The business logic layer is the heart of your class diagram and contains the class modules that are the heart of your application. The business logic layer calls the data access layer for any activities that need communication with the database.

You then looked at several examples of how to create properties, methods, and events for custom objects. Custom properties can be created using public variable declarations in a class module. A preferred way of creating custom properties is to write public Property Get and Property Let procedures in the class module. Property Get procedures determine what happens when the property value is retrieved, and Property Let procedures determine what happens when the property is assigned. After you write the code for a custom object, the object can be used from other class modules or procedures by declaring the object and instantiating the object. The properties, methods, and events can be accessed in the custom object from the Visual Basic Editor code window just like existing objects. You create custom methods by adding public procedures or functions to the class module. You can also add additional properties and methods to existing objects in the same way you create your own properties and methods for objects. The only difference is that you place the code in the class module for the existing object, such as a form.

Now that you have learned how to work with existing objects and how to create your own objects, it's time to learn how ActiveX Data Objects (ADO) can be used in your applications to interact with data in your database.

0 0

Post a comment