5

Does "middleware" have two different meanings and therefor is unnecessarily overloaded?

  • Horizontal: I saw some use middleware to mean something like proxy or gateway sitting between two entities at the same level. For example, https://docs.microsoft.com/en-us/aspnet/core/fundamentals/middleware/?view=aspnetcore-3.1

    Middleware is software that's assembled into an app pipeline to handle requests and responses. Each component:

    Chooses whether to pass the request to the next component in the pipeline.

    Can perform work before and after the next component in the pipeline.

  • Vertical: I also saw some use the word to mean a level of abstraction, to hide the lower level from upper level that consumes the services provided by the middleware. For example, in Distributed Systems by Tanenbaum or by Coulouris, middleware is used to hide the heterogeneity between the individual computers with different platforms in distributed systems, and to provide a uniform programming interface to distributed application developers. There doesn't seem to be something sitting between the computers.

Or does the word have just one meaning or two very coherent meanings and I overestimate the differences?

Thanks.

0

2 Answers 2

9

I'd say that the meaning is coherent, even though the "exact" reference may differ. A middleware is basically a component that sits between other components and has the job of connecting the two through their own standard I/O mechanisms by knowing which kind of input they expect.

Use cases may differ, i.e:

  • There are many separate entities that we want to group together. In order to avoid the overhead of having to restructure each one to get a more coherent system, we can write a middleware which does the remapping of the messages sent by each instance to an another instance and perhaps some additional "heavier" work.
  • There are multiple exposed API endpoints (in a single service) and we want to perhaps add authorization to all of them. Instead of refactoring each endpoints' controller, we can write a "catch-all" middleware that's executed for all endpoints and which just either passes the request onwards/through to endpoints or responds with an error message. This can, instead of auth middleware, for example, be a caching layer or any other sorts of goodies which all requests go through.

There's more use cases of course but these are the most common ones and all others are similar, so I'd say the meaning is pretty coherent and the overall resemblance between the two is there as stated in the 1st paragraph.

0

Primarily Vertical

According to Wikipedia (2020-08-09)

Middleware makes it easier for software developers to implement communication and input/output, so they can focus on the specific purpose of their application

This is quite a poor article, but it does match my own experience.

enter image description here

If you read the Multi-tier Architecture Wikipedia article (particularly in the simplified Three Tier section) is much more enlightening. It's better to describe middleware as the domain of software that is between the "Presentation" and "Database" layers. This is sometimes also called the "Logic" layer, the "Business" layer, "Application tier", or "Middle tier". This Middleware middleware layer is therefore fundamentally about "vertical" abstraction.

Within this Middleware layer there are many different ideas and implementations that themselves can be thought of as horizontal.

Pipeline: A horizontal implementation within the Middleware Conceptual Vertical Layer

Your "Microsoft ASP.Net Core Middleware" reference is quite specific. Node.Js ExpressJS has a similar architecture and ASP.Net Core is likely inspired by ExpressJS. Here, "Middleware" is used within the context of a server-side software and each step in the HTTP Request/Response pipeline is called "Middleware". It's sort of valid, but awkward. It's quite likely that the marketing department had a hand in that. "Middleware" is usually considered in the context of a "whole software system" as a vertical abstraction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.