Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have Registerable provide as unregister() #2

Open
schlessera opened this issue Feb 17, 2016 · 2 comments
Open

Have Registerable provide as unregister() #2

schlessera opened this issue Feb 17, 2016 · 2 comments

Comments

@schlessera
Copy link
Member

@GaryJones suggested that an Registerable object should be able to be unregister()ed as well.

@schlessera
Copy link
Member Author

I prefer to not provide an unregister() because of the following reasons:

  1. In most instances, registering something to hook it up to the system is much simpler than unhooking it again after the system has been run and is in an unknown state. If the interface needs an unregister(), it forces all components to think about all the possible ways an unregister() could go wrong.
  2. If the unregister() is needed to be able to turn an individual component on or off depending on context, this has more to do with the state of that component, as it has with whether the component is "known" in the system.
  3. As we're dealing with PHP, it can be assumed that the entire system is always discarded after each request. So unregister()ing because of memory considerations is of little use, especially as this still does not free the memory, but marks it as available to the garbage collector.

cc @GaryJones

@GaryJones
Copy link

Then, would you consider an Unregisterable interface, so some consuming objects can both implement register and unregister?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants