Hacker News new | ask | show | jobs
by ravenstine 1207 days ago
> random middlewares

The whole concept of "middleware" in Ruby server applications was a huge mistake. Your average Ruby developer has no idea how any of that shit works, and it's an unnecessary abstraction over taking request data and passing it through a function, something that should be simple for even a junior developer to figure out. Somehow it was decided that having a standard for the shape of data wasn't good enough; there had to be a demi-standard for modifying request data before it reaches the primary application code.

If you have to tell a middleware what order it's supposed to run in with relation to other known middlewares, chances are the middleware system itself is a poor design.

1 comments

> If you have to tell a middleware what order it's supposed to run in with relation to other known middlewares, chances are the middleware system itself is a poor design.

That's just the chain of responsibility pattern [1] and I've only seen middleware operate that way. Why wouldn't you want control over the order?

[1] https://refactoring.guru/design-patterns/chain-of-responsibi...