Introduction
Unless you have been living in a cave for all this long, you might have heard of the “DAO” design pattern in software development if you’re a software developer.
DAO is an acronym that stands for “Data Access Object”.
As the name implies, it is an ‘object’ that encapsulates data access operations. In object oriented programming; it is an object that allows or abstracts away the data access element from/to an external data system.
This data system can be any generic data source or can be a very specific kind of database. When this pattern arose; it was common (especially in the Java Development world) to use this as a pattern to abstract away all the database access. The database was commonly a RDBMS (Relation Database Management System) such as MySQL, Oracle RDBMS, PostgreSQL, DB2 etc. Nowadays, is it not surprising that the DAO pattern is used to abstract away database operations to any other database systems like the NoSQL category of databases such as MongoDB, Apache Cassandra, Redis, Neo4J etc.
This pattern has existed for a very long time and as such i am going to show you an example in Java which demonstrates abstraction over a relational database. For other object-oriented programming languages the code would be similar.