You’re welcome!
Object is easy to understand as a complete immutable entity, and an OODB is comparable to a data warehouse containing various objects. Each object, much like a person, is identified by an unique name assigned to it. In relational databases (RDBs), this object name corresponds to the primary key (unique). The problems with RDBs begin with the fact that data can be accessed using many alternative keys. This exacerbates the situation.
A data warehouse contains objects of varying sizes, which can also include big data (such as audio or GIF/Video data). Therefore, an OODB is not so abstract as to be confusing or difficult to understand when viewed as a data warehouse.
For example, VinGroup is the OODB (data warehouse) that contains VinFast, VinHome, VinPearl, and so on. Each object—for example, VinFast—is a frame for different object instances such as VF3, VF6, VF8, and so forth. So, when you say VF3, you’re referring to the small, Jeep-like VinFast car. VF3 is an unique name. If a VF3 object needs to be repaired, only VF3 components are used, not those of other models. The object frame and the object instance ensure data consistency and correctness. By this, I mean “independent entities and unaffected by external influences such as faulty updates or data loss due to partial deletions, etc.”
An object instance is a stack of serializable data that can be easily created in C#, Python, Java, or even C++. Here’s an example in Java (POJO, Plain Old Java Object):
// The object
public class Tutorial implements java.io.Serializable {
public int id;
public String name;
}
// The application
import java.io.*;
public class JavaExample {
public static void main(String[] args) throws Exception {
// Creating and initializing
Tutorial obj = new Tutorial();
obj.id = 1;
obj.name = "java";
// Save to C:\example.txt
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("Example.txt", false));
oos.writeObject(obj);
oos.close();
// Read from C:\example.txt
ObjectInputStream ois = new ObjectInputStream(new FileInputStream("Example.txt"));
Tutorial does = (Tutorial) ois.readObject();
ois.close();
System.out.println("ID:" + tut.id + "Name:" + tut.name);
}
}
or in PYTHON
import pickle
tutorial={"id:":1, "name:":"Python"}
f=open("examplePython.txt","wb")
pickle.dump(tutorial,f)
f.close()
f=open("examplePython.txt","rb")
d=pickle.load(f)
print (d)
f.close()
The data is stored in a RandomAccessFile, which contains two sections:
- Object names and attributes (name length, data size, and pointers to the data in the data area)
- Serialized data
