The general understanding is this. Nothing stops you from doing this. But the Observer standard is a mechanism and not a business rule as you used it. If I showed you a code, I could do a better job.
In fact the Observer standard implements precisely events, but not this type of event you are talking about, not social events but computer events.
The way you created it, who are the subscribers? Real people that you don’t have any control over? That doesn’t seem to me to be the Observer standard. In this pattern subscribers are usually other parts of the application that need to be notified. Generally speaking it is a design pattern created for object-oriented use.
Examples:
- A file has been modified in the file system
- A price property has been modified in a product class
- A click has been given on button
- Received an information from the network
- A visual object of the game met another object (hit the target)
- A database update occurred
If we can transport the Observer concept from the computer out of it I don’t know. What you are doing is something similar to the defined pattern but it seems to me a variant that does not match the formal definition of the pattern. Sounds more like a Observer-like.
You can use whatever logic you want to achieve your goal. What I can tell you is that if you’re worried about whether you’re implementing a design standard or not, you have the wrong concern.
Design patterns depend on implementation, you can achieve your goal in other ways (probably worse) where a design pattern would fit.
Source: Wikipedia
In this diagram who are yours notify()
? The attendees' emails as you called them? It seems strange to me. I think the pattern was not created for this.
Deep down, what does it matter if you’re using the standard or not? Your implementation is doing everything it should do correctly and efficiently?
You have the code you created?
– Maniero