There are many documented code anti-patterns on the Internet, but I came upon one in a pull-request review that I couldn’t find any mention of. Let’s document it here!
Proletarian Executive is an anti-pattern where a low-level function or class makes high-level decisions in a manner that violates the separation of concerns. It contributes to spaghettiness of the code base.
It can start as a welcome trade-off, a hacky one-off solution, but as the development continues, similar problems might arise in the same area, which attracts similar solutions.
The correct way to remove Proletarian Executive depends on context.
Inversion of control might help in cases where high-level logic needs to be executed inside the proletarian.
In other cases, the high-level logic can be “simply” moved to the proper level.