Persistence and Serialization

Persistence and Serialization

Question:
What is the best source, print or online, for learning how to implement persistence in C++? I want to save my objects to disk and restore them, and I want to learn how to do this from scratch, not by purchasing someone’s library.

Answer:
I don’t know which compiler you are using. If you are using Visual C++ and MFC, then you are pretty much be forced into using their model of object persistence. Al Stevens had a book, C++ Database Development, that covered this to some degree, but that’s an older book. I don’t know of any book that focuses just on this topic but I’m sure you could find a discussion in any good C++ book.

The basic concept is pretty straightforward: The object knows best what needs to be saved to disk. So you can write a Serialize method for your classes. Then, you can basically tell an object to save itself. Perhaps the hardest part is determining which object must be created and told to load itself when reading a file. For this, you need to also save information about that object to the file.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

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