Building a data access layer library

# Background The objective of this project is to develop a module that serves as an abstraction layer between applicationĀ and database access code. By decoupling the persistent storage implementation from the remainder of the application's code, we reduce redundancy and enable a more secure, versionable code base for persistence. Let us begin by considering this in a small diagram as shown below, which separates the business logic from the database, so that developers can spend more time working on the business code to deliver value rather than worrying about data accessibility.
graph TD; A("Business Layer") <--> B; B("Data Access Layer") <--> C("Data base");
# Terminology To begin the project we need to discuss some terminilogy, namely * ORM (Object-Relational Mapping) tool, * a Data Access Layer (DAL), and * a Data Access Object (DAO). [1.] **ORM (Object-Relational Mapping) Tool**: This is a software library that is used to manage the connection, data manipulation, and operations between an application and a database. It translates between how data is represented in the application (as objects) and how it's stored in the database (as rows in tables). It provides a high-level, object-oriented interface for interacting with the database. Examples include Hibernate (Java), Entity Framework (.NET), and Sequelize (Node.js). [2.] **Data Access Layer (DAL)**: This is a part of your application's architecture or codebase that is responsible for communicating with the data source (like a database). It uses the ORM tool to handle this communication, abstracting the specifics of the database and providing a simple and consistent interface for the rest of your application to use when it needs to work with data. It can contain multiple Data Access Objects, each tailored for a specific type of data operation. [3.] **Data Access Object (DAO)**: This is a design pattern used in object-oriented programming, where each DAO represents a table or a set of related tables in the database. It is part of the Data Access Layer and uses the ORM tool to interact with the database. A DAO provides methods for performing CRUD (Create, Read, Update, Delete) operations on its associated data. The relationship among these terms is as follows: - The ORM tool is the library or software that your application uses to interact with the database. - The Data Access Layer is a part of your application's code that uses the ORM tool to provide a simplified and consistent interface for working with data. - The Data Access Objects are part of the Data Access Layer. Each DAO represents a specific type of data or table and uses the ORM tool to provide methods for working with that data. In a sense, these three components work together in a chain: the DAO uses the ORM to interact with the database, and the DAL uses the DAOs to provide a simplified interface to the rest of the application. ## Practical resources **Resources** [Data Access Layer - Wikipedia](https://en.wikipedia.org/wiki/Data_access_layer) [Data Access Object - Wikipedia](https://en.wikipedia.org/wiki/Data_access_object) [What is an ORM? The Meaning of Object-Relational Mapping & Database Tools](https://www.freecodecamp.org/news/what-is-an-orm-the-meaning-of-object-relational-mapping-database-tools/) [Introduction to Relational Databases in Python - DataCamp](https://app.datacamp.com/learn/courses/introduction-to-relational-databases-in-python) [Data Access Object Design Pattern - Introduction - YouTube](https://www.youtube.com/watch?v=9fVQ_mvzV48)