by Petr Škoda.
Hello, thanks for the feedback.
1. One event is not supposed to be triggered in different locations, the events are not general. Defining one class per event is the way to go. It is a bit more work for developers, but it helps to enforce new rules and it resolves many potential problems.
2. The triggering details are encapsulated inside the event because it helps with keeping everything under control - it is extremely important to prevent developers from interfering with event processing both in event classes and observers. Your proposal would require opening of public API which would lead to many potential problems (modification of event data after triggering, repeated triggering, etc.) .
3. Listening to all events is an important features. Any other group filtering would require more processing power. Observers are not intended for extending of any classes. This is a notification framework only - one way communication, observers must not modify the event data.
4. I agree we need to keep the base class as small as possible, we must make sure it performs well. Extra validation should be done in developer mode only.
1. One event is not supposed to be triggered in different locations, the events are not general. Defining one class per event is the way to go. It is a bit more work for developers, but it helps to enforce new rules and it resolves many potential problems.
2. The triggering details are encapsulated inside the event because it helps with keeping everything under control - it is extremely important to prevent developers from interfering with event processing both in event classes and observers. Your proposal would require opening of public API which would lead to many potential problems (modification of event data after triggering, repeated triggering, etc.) .
3. Listening to all events is an important features. Any other group filtering would require more processing power. Observers are not intended for extending of any classes. This is a notification framework only - one way communication, observers must not modify the event data.
4. I agree we need to keep the base class as small as possible, we must make sure it performs well. Extra validation should be done in developer mode only.