Vedika, a fresh CS graduate, decided to build a Digital Music Store. She chose to store Music Artists and Album details in CSV files. She was happy with how quickly she could implement the solution. But she was in for a surprise.
She soon realised this was not a maintainable solution. She had to update her code whenever she needed to create, read, edit, or delete a record. With the data becoming too large and complex, she realised the solution was insufficient.
Her solution had Data Integrity Problems:
-How do we ensure the artist is the same for each album entry?
-What if somebody overwrites the album year with an invalid string?
-How do we treat multiple artists on one album?
-What happens when we delete an artist with an album?
There were Implementation Problems:
-How do we find a particular record?
-What if we want to create a new app in a different language using the same database?
-What if two threads try to write to the same file simultaneously?
There were Durability Problems:
-What if the machine crashes while our program is updating a record?
-What if we want to replicate the database on multiple machines for high availability?
She came across a mentor who introduced her to concepts of:
Database - an organised collection of inter-related data designed to represent different aspects of the real world around us
DBMS - a software that enables quick and accurate retrieval of data
A general-purpose DBMS is designed to solve these problems and allow developers to reliably create, find, update, and delete records following some Data Model.
A Data Model is a collection of concepts for describing the data in the database.
A Data Model entails two layers to enable interaction with the data:
-A Logical Layer describes entities and attributes the database has.
-A Physical Layer describes how those entities and attributes are stored on a disk.
-In 1960s, there was a tight coupling between them.
Ted Codd, a mathematician at IBM Research, noticed that a simple Schema change led to changes in disk storage (physical layer), forcing them to rewrite DBMS every time (logical layer). So in 1970, he proposed the Relational Model to avoid this.
The Relational Model defines a Database abstraction based on relations to avoid maintenance overhead. It has three key points:
-Store database in simple data structures
-Access data through a high-level language
-Physical storage is left up to the DBMS implementation
These revelations left Vedika in complete awe of DBMS. As a curious developer, she decided to dive headfirst into the rabbit hole and thoroughly learn about databases.
Thanks for reading this.
To follow along her journey, follow me.
If you have an idea and want to build your product around it, schedule a call with me.
If you want to connect, reach out to me on Twitter and LinkedIn.
Top comments (0)