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

Let Processes be used as subroutines #7

Open
abinashmeher999 opened this issue Jul 22, 2017 · 0 comments
Open

Let Processes be used as subroutines #7

abinashmeher999 opened this issue Jul 22, 2017 · 0 comments

Comments

@abinashmeher999
Copy link
Owner

We have created subclasses from Process and used them to implement well known algorithms(echo algorithm) for instance. I propose to use already written processes as reusable pieces of code that can be used as subroutines.

Expected Behavior

Users will add subroutines to a process and then specify when in the run method they are going to be called. Each instance of a subroutine (process) should operate in its own namespace while still having access to the global namespace(the scope of the Process which will act as a node in simulation). The access is necessary to allow different algorithms to be interoperable. But at the same time it shouldn't cause any unexpected behavior in the main Process(the node)

Current Behavior

There is no existing arrangement to allow this.

Possible Solution

Have an OrderedDict of processes(objects of type Process) with strings as keys. Users will add subroutines like:

self.add_subroutine("first echo", TerminatingEchoProcess())

this will create self.subroutine["first echo"] and assign it the instance while mapping all the channels with that of the instance.

self.state will be a dictionary which will be accessible to the inner instances by the variable parent_state. This data can persist across subroutines without exposing the complete outer instance inside the inner instances.

Context

There are many algorithms which are composed of using simple basic algorithms one after another. This will greatly increase code reusability and allow fast experimentation. This will also have the added advantage of increasing readability.

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

1 participant