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

Create "factory" pattern for LVM mixins #596

Open
jkonecny12 opened this issue May 22, 2017 · 2 comments
Open

Create "factory" pattern for LVM mixins #596

jkonecny12 opened this issue May 22, 2017 · 2 comments
Assignees

Comments

@jkonecny12
Copy link
Contributor

Right now you need to know what should be passed to LVMLogicalVolumeDevice to get your desire LVM device. It would be great to have factory pattern in addition to this big __init__() method.

For example:
Now:
dev = LVMLogicalVolumeDevice("name", parents=[parent], seg_type="thin")
After:
dev = LVMLogicalVolumeDevice.create_thin_snapshot("name", parents=[parent])

It is immediately clear what will be created and it is much easier to create this.

@vpodzime
Copy link
Contributor

For example:
Now:
dev = LVMLogicalVolumeDevice("name", parents=[parent], seg_type="thin")
After:
dev = LVMLogicalVolumeDevice.create_thin_snapshot("name", parents=[parent])

I don't think those should be class methods. I know a "factory" is a design pattern, but this is not Java, we can afford the luxury of having functions.

@vpodzime vpodzime self-assigned this May 29, 2017
@jkonecny12
Copy link
Contributor Author

No problem with that.
I just want to see this without much digging in the code. It is creating LVMLogincalVolumeDevice instance so it give sense to me to call it from this class instead of standalone function. I guess that I would probably miss that standalone functions.

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