Using the same observer class multiple times

Logically I don't see any benefit of creating multiple classes for same functionality. Moreover having same class it will help in code redundancy, upgrading and also debugging.

In case of Plugin you should have different class defined even if the functionality is same . But in case of observer it would be better if you use the same class in my opinion.


As per your requirement, you have mentioned that the functionality of the observer has nothing to do with the observer argument and is independent.

In this case, according to me, the best solution is to create and call a single observer file and function.

The main benefit of it is that if in future there are some changes, change needs to be in one single file rather then changing in multiple files.

Also using abstract class will not have any advantage as the primary functionality of observer is independent, so if you create an abstract class and individual child classes for multiple events, there is no usage of child classes.

Overall, i cannot see any disadvantage of using single observer class, so it is recommended by me.