Toggle Theme Editor
Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Charcoal

O O D B Design And Implementation - Part 1 -

Discussion in 'Java Update' started by Joe, 6/1/20.

  1. Joe

    Joe Thành viên VIP


    Introduction & History
    Everyone who's in touch with IT knows what a Database is.
    Everyone who starts to learn coding will sooner or later have to work with a Database.
    Everyone who gains more IT experience would start one day to ask himself how a Database works.
    Everyone who believes to be an IT developer would get tired of the age-old SQL and will try one day to design and to implement a Database that would suit his using requirements.

    Finally, everyone who works day in and day out with an OOPL would ponder one day over the true meaning of OO and why OO Databases weren't so widespread or, at least, as popular as the SQL Databases.

    OO or Object Oriented. What's that, this OO? And what is an OODB? If you are a "real" developer you won't raise such a question, but start to analyze the question: how can I design an OODB that covers my specific requirements and how can I implement it in my most favored OO Programming Language? It's a real challenge, isn't it?

    JAVA or PYTHON or C# or even the age-old C++ is very "qualified" as the OOPL for such an OODB approach. However, most of the approaches begin with the wrong start: a generic OODB. Why that? Computer languages are like human languages. None of the languages prevails over the others. English, the most spoken language on this planet Earth, cannot render the soul of any other native language. Native Idioms and proverbs reflect their deepest meaning and emotional feeling that even the most adept English scholar has to capitulate. Similar to that JAVA objects are differently "structured" than C# objects, and vice versa.

    You may argue that all RDBs are generic because one can access to any RDB (Relational DB) in C or JAVA or whatever OOPL. No, not really. C or JAVA or C# or PYTHON has to ride on the SQL wagon which is more or less standardized (an invention in the 70s by IBM researchers Raymond Boyce and Donald Chamberlin and at that time IBM was a power that every IT man and woman had to bow). Without SQL neither C, nor JAVA can access the data of any RDB.

    In our time, when IBM is just another big yahoo, neither C, nor JAVA, nor C# of Bill Gates could dictate the world like IBM did in the 70s with its SQL. NO standardized OO-Query Language (OOQL) = NO generic OODB. So, when we design and implement a specific OODB we could only hope that it would be so excellent that the others accepted it and made it to a "pseudo-standard" like Linux or Android in the OS-Scene. And if it was so, you hit the "jackpot" and became rich and famous.

    OODB Design and Implementation Overview
    First of all: Keep it simple as the most famous Russian inventor Kalashnikov used to say.
    Different to RDB data where the data are ACID (Atomicity, Consistency, Isolation, Durability) before stored OODB data cannot be isolated and this point breaks the RDB rules. OO data are parts of an object. It's the soul, if you so will, of an object. An Object consists of two parts:

    - the soul or the functionality (the methods)
    - the body or the architectural structure (the class)

    Let scrutinize an object with an example. The People in JAVA. To describe "the people" you have to work with two distinctive aspects. The physical (body) and the mental (soul). Both represent in name, age, profession, etc. and then the appearance, hobby, etc. And that requires you to (pattern) design and to implement some methods that render the "mental" and the "physical". Let do it as simple as possible (Kalashnikov)
    import java.awt.*;
    import javax.swing.*;
    // Joe Nartca (c)
    public class People implements {
      private static final 
    long serialVersionUID 1234L;
    People(String nameint ageString address,
    String professiondouble incomeString url) {
    this.age age;
    this.url url;
    this.income income;
    this.address address;
    this.profession profession;
    int age;
    double income;
    String nameurladdressprofession;
    String toString() {
    "Name: "+name+", Age: "+age+", Addr.: "+address+", Income: "+income+
    ", Profession: "+profession;
    void print() {
    void picture(JFrame jf) {
    Picture extends JDialog {
    Picture(JFrame jf) {
    JButton but;
            try {
    ImageIcon img;
              if (
    url.indexOf("://") > 0img = new ImageIcon(new URL(url));
    img = new ImageIcon(url);
    but = new JButton(img);
    setSize(img.getIconWidth(), img.getIconHeight());
            } catch (
    Exception e) {
    but = new JButton("No Image");
    As you see, "the People class" (the body) does have some similarity with RDB data (name, age, address, etc.) that could be easily "ACIDed". But the appearance (here: picture with the subclass Picture) and the activities (here: toString and print) cannot be parts of RDB data, but they are parts of the OO data.

    If an object People, say "Trump", the person Trump is IN the object. In RDB you have to work around to display and to describe the person Trump. In OODB (here in JAVA) the person Trump is serialized and stored as he is. No Atomization, Nothing! Just an access (read) like this:
    People Trump = (People)"people""Trump");
    and you get instantly this "person" Trump.
    (Next: OODB Structural Design)
    Last edited: 7/1/20
    Thanhpv likes this.
  2. Thanhpv

    Thanhpv New Member

    Really like to read this way. Feel like it is from a novel writer but actually an IT wiser.
    Joe likes this.
  3. Thanhpv

    Thanhpv New Member

    That image again again again...I am actually 'effected'! :D
    update: I think you should think about writing a book, something like "Java - How to create"
    Last edited: 7/1/20
  4. Joe

    Joe Thành viên VIP

    Thanks a lot for the suggestion...but I've "already swum" in money and don't need more b-) Btw, a book would reveal my anonymity and that hurts #:-s
  5. Thanhpv

    Thanhpv New Member

    Come on! I was not thinking about money. Books out there are mostly about "How to use" not "How to create". This is much more inspirational. BTW, that kind of hurts would be enjoyable :cool:
  6. Joe

    Joe Thành viên VIP

    It's the question of penchant and roughneckism. Example: POTUS (President Of The US) Trump is a very rich man. Theoretically he doesn't need the title POTUS, nor the meager salary of ~400,000 US$ / year. But he's tried and becomes the 45th POTUS. What he gets is a lot of headaches and bashing. Is that enjoyable?
  7. Thanhpv

    Thanhpv New Member

    Right! headaches, nightmares, feeling of kills, praises, hates, insults, risks to be jailed, loves, living shorter... I do not know nor feel all. But I would like to say "YES".

    Jurnalist: What is your true hurt?

    John: Get shots on fields.
    Jane: Get blamed and hated.
    Some: Have done nothing.
    A hero: Living too safe the whole life, not protecting anyone.
    A pesidential nominee: Do not have chances to serve the country at top notch scale.
    Jack Sparrow: Sailing without strange tides!

    Up to your perspectives of view.
    Last edited: 10/1/20

Chia sẻ trang này