-
Notifications
You must be signed in to change notification settings - Fork 1
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
Underlying library architecture #1
Comments
@Suzie97 I transferred the issue to the library's repo |
I would like to share my approach for the base architecture. AbstractOperationEach operation will implement the class AbstractOperation. (Let's call a class implementing this class as Operation) This class will define the following-
Let's consider that the user wishes to perform the following operation in given order-
Internally, these will be chained together to form a chain as
By chaining, I mean that one object will be listening to the operation_complete signal of previous class. As soon as that signal is triggered, the listening class will trigger its own perform_operation signal. Client code will only trigger the perform_operation signal of first class. The rest will automatically happen. When the last class triggers its operation_complete signal we can get the result and do what we want with it. Implementing AbstractOperation also obeys the single responsibility principle as each new operation only has to worry about performing the operation and not the rest of the code. I have written code for reading and writing images. Working on creating tests as TDD approach seems to be more productive. TODO
|
This is an amazing start. Great work. I just have one question, can't we directly start implementing the tree format rather than a linear one? |
@Suzie97 We can chain as many operations to each other as we can. Its only a matter of connecting to the proper signals. The real challenge is to prevent cycles so our program doesn't get stuck in a infinite loop. To take care of that we need to create another class that creates and manages these classes, makes sure they obey certain rules (like no cycles). Thanks to @abdallah-moh for pointing this out. We don't need a variable to store our original image in every operation. Instead we can create a method that reverts the operation and only for reversible operations do we store the previous state. |
Right now, we are thinking of building our own library rather than using an existing one.
This is mainly so that we have a clear understanding of it works and also, to have full control over how things work so that we can adjust things according to our needs.
We need ideas right now, so feel free to share them.
The text was updated successfully, but these errors were encountered: