Blogs


The web app architecture: Databases and storage

 July 28, 2021, 04:35 PM

 6 min read

web
application
architecture
database
storage
solutions
mysql
postgress
nosql
oracle
mongodb

In my previous blog, I wrote about the backend and some of the things an aspiring backend developer should know about. This is the third addition to my three-part series of The web app architecture where I will write about one of the crucial aspects of backend development that is concerned with data storage and solutions.


Database

A database is an organized collection of data stored and accessed electronically from a computer system. (wikipedia). Think of your days in middle school, when you had a bunch of homework papers and assignments wrapped up in different files. You would store all your physics homework in a physics folder, computer science homework in a separate folder, and so on and so forth. What you are essentially doing is storing information or data. You would have all your records of folder on a book shelf, which we can call a place for storing information or database. Likewise, in the computing world, the software application which stores and manages data or series of information efficiently is called a database.


Is database usage specifically limited to web development?

Absolutely not! Databases are way more common than you think. Almost every software application that retains some sort of data to provide a dynamic and fluid service most definitely utilizes an internal database. Apps like the calendar might store important dates you provided so that it can act as a reminder. It is used by all sorts of software applications which may include but not limited to Enterprise solutions, web applications, embedded systems, artificial intelligence, machine learning, banking system, blockchain technology and so on and so forth.


There are a plethora of types of database systems currently used in the industry but I will discuss about the three most common types of databases: relational databases, NoSQL and object oriented databases.

  • Relational database

    This is one of the most common type used in the industry. In relational database, every piece of information is tabulated. A database will have multiple tables which might be connected to one another, or in a relation. Pieces of information are kept as records which are identified with their own unique primary keys. The keys of these records in one table might be related to records in another table. In django, this is achieved through the use of something called a ForeignKey.

As mentioned this is by far the most popular type of database used in the industry, and for good reasons. Because of the way it is structured and stored, records are easily retrieved and do not consume a lot of time. Hence why it is easy to traverse and also easy to scale to larger datasets.

  • NoSQL database

    A NoSQL database provides a mechanism for storage and retrieval of data that is modeled in means other than the tabular relations used in relational databases. (wikipedia). Essentially, any database which does not follow the paradigm of SQL or relational database can be classified as a NoSQL database. Instead of tabular format, which stores data in tables, records, rows and columns, NoSQL stores data in a more flexible format, often in the form of documents, which are similar to JSON objects. One of the biggest advantages of NoSQL databases is horizontal scaling. Unlike relational databases or SQL where data are connected and "in a relation" with other data or records, NoSQL records are more "isolated", so to speak. Basically, this means that increased traffic can be managed by simply added more servers.

  • Object Oriented database

    Object oriented database models are database management systems in which information is represented in the form of objects as used in object-oriented programming. Object databases are different from relational databases which are table-oriented. Object relational databases are a hybrid of both approaches. (wikipedia). They follow some of the paradigms from object oriented programming like polymorphism, inheritance and encapsulation.


Commonly used databases

Some of the most of commonly used databases are MySQL, PostgreSQL, Oracle, MongoDB, sqlite3, Microsoft SQL server, Redis etc. Personally, I use sqlite3 in my personal development systems because of how easy it is to set up and use because of the lack of need of a server. For production, I prefer MySQL because of its maturity and how reliable it is. As a matter of fact, the backend for this website works with a MySQL database.


It should be noted that even though databases are one of the crucial aspect of web development, or software development in general, I recommend not to worry about it if you are a beginner. If you want to build a dynamic app, try storing data using variables, dictionaries, objects, hash tables, etc instead of diving into the world of database system. Once you are somewhat comfortable with data structures and data flow or even if you are somewhat confident about it, you can dive right into working with databases. Either way, I hope this blog delivers a general idea of databases to you and I hope you it can help you on your journey to being an outstanding programmer. Goodluck!


Arafat

Mohammad Arafat Zaman

"Technophile"


Go back

Mohammad Arafat Zaman © 2024


All rights reserved