OO Programming with Databases

OO Programming with Databases

I am getting into the object oriented features of VB4 and I am wondering where the back-end database (such as Access) comes in for small single user applications. You can seemingly just create lots of objects with lots of properties and not bother with the relational database unless you need a multi-user product. Agreed there are not many calls for single user systems today but in a small country such as Malta (my home), many businesses are single users.

You’ve asked one of the important questions of object-oriented programming– how do I put the objects into the database? There are a couple of waysto do this.

First of all, you may want to “teach” each object how to load itself fromthe database. I use this method in a few places in the current applicationI’m using. Each individual object knows how to fill itself from thedatabase, once it has been passed an object reference to the currentdatabase. Each object also knows how to save itself back to the database.In my case, I cause the object to save itself any time a property changesin the object. I also have an override that tells the object not to saveitself immediately. This lets me do things like creating an empty object,filling it, and then telling it to save.

Another way to load/save objects is to have the collection object know howto save all the objects in one fell swoop. This takes a bit more power andwill result in some unnecessary saving; however, individual actions aremuch faster since no database action is required when changes are made.All the changes are committed at the end.

For more information on object-oriented programming, I would highlyrecommend Deborah Kurata’s Doing Objects in Microsoft Visual Basic 5.0.(There is also a version for Visual Basic 4.0) She goes through all theseissues and many more and provides techniques for getting around thesefundamental problems.

Share the Post:
XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing

data dictionary

Tools You Need to Make a Data Dictionary

Data dictionaries are crucial for organizations of all sizes that deal with large amounts of data. they are centralized repositories of all the data in organizations, including metadata such as