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

Lazy-load registered providers #18

Closed
0xPaul opened this issue Dec 14, 2016 · 1 comment
Closed

Lazy-load registered providers #18

0xPaul opened this issue Dec 14, 2016 · 1 comment

Comments

@0xPaul
Copy link
Member

0xPaul commented Dec 14, 2016

A typical Porter factory might load many providers to support all use cases of an application, even though only a smaller subset may actually be used during one execution life-cycle. Therefore we would like a mechanism to lazy-load registered providers only when they are required.

One such mechanism may be a factory interface that looks similar to the following.

interface PorterProviderFactory
{
    public function getProviderClassName() : string;

    public function createProvider() : Provider;
}
@Bilge
Copy link
Member

Bilge commented Dec 15, 2016

I think we should not do this because it is trying to solve a problem inside Porter that exists outside of Porter.

Instead of creating one Porter factory that registers all providers, consider creating many Porter instances that load different sets of providers. If all instances of Porter must still be configured the same way, implement the prototype pattern.

@Bilge Bilge added the won't do label Dec 16, 2016
@Bilge Bilge closed this as completed Dec 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants