March 07, 2020

REST middleware is the future of databases

The common database application in the 1990s was based on the backend frontend philosophy. The SQL server from Microsoft was used as a backend and the MS-access database is realizing the frontend. The disadvantage is, that most of the logic is located in the frontend. The answer to the problem is to introduce a new layer called middleware.

Microsoft has invented the .net C# platform which is directed towards this goal. But the term middleware can be realized with other programming languages as well. A famous one is Javascript which can be used for creating RESTful middleware api. To understand how this is realized in reality, we have to take a look at outdated MS-Access applications.

The idea is, that the user is pressing graphical buttons and this activates tasks in the software. THe better alternative is to provide a textual interface. Bascially spoken, the programmer has the obligation to convert an existing MS-access application into a text-only interface. This text-only interface is the REST API. Programming a graphical interface on top of an existing REST API is very easy.

The REST specification has become popular in web-oriented development. But is Javascript needed for classical desktop databases? Suppose the tables are stored in a sqlite database. The SQLlite database can't be called a middleware, but it's equal to the backend. Also the SQL language is located on the backend. What is needed an additional layer ontop of SQLlite. This middleware layer can be realized with python. The python software doesn't display the GUI interface for the user, but it connects an existing GUI with the SQLlite database.

sqlite -> python middleware -> python GUI

In the context of REST, the term business logic layer describes the middleware. Let us investigate how REST is working internally. REST means, that the methods of a Javascript class are mapped to external function calls. It has much in common with a programming library API which is realized with the HTTP interface. Suppose the idea is to program a desktop database but not a web-database. What is needed here is a Python library.

The python library contains of 100 lines of code, which has one class and can be imported from another python program. The python middlelayer connects two layers:

sqlite -> python middleware -> python frontend

The communication between python program1 and program2 is realized with the normal function calls. In the python frontend the functions of the middleware are called with:

import middleware

middleware.updatedate()

No comments:

Post a Comment