-
Notifications
You must be signed in to change notification settings - Fork 136
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
RFC: Implement a new Impact Function registry system #1196
Labels
Comments
mbernasocchi
changed the title
RFC Implement a new Impact Function registry system
RFC: Implement a new Impact Function registry system
Sep 24, 2014
Just to summarize the state of this RFC regarding the goals of this RFC:
|
InaSAFE 4.0 is here - death to old style IF's! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Status
Accepted, under implementation. The proposal to adopt the new IF system was agreed on at an InaSAFE workshop held in AIFDR/Jakarta, March 2014
Goals
OOP
OOP (Object Orientated Programming) strives to treat conceptual models in program code as if they were real world objects. Python supports OOP programming and
safe
Impact Functions are implemented as classes / object instances, but they don't behave in a very OOP like way. If we think of Impact Functions like objects, we should be able to create an IF object and then ask it to do things and ask it questions about itself:In contrast the current Impact Functions are rather simple: they simply take some input layers and return a dictionary containing an impact_summary and various other bits of into, plus write their product to the disk if they have on.
Adopting a more OOP approach would allow us to formalise the roles that an Impact Function must carry out while ensuring that we have good separation of concerns: Let the Impact Function and its base class parse its internal state and provide high level data back to its clients.
Statefulness
Statefulness is the ability to remember their current state within or beyond a current session. We should be able to 'freeze' the state of an impact function and then restore it. In particular this will give the ability to do things like
Impact Function Independence
Independence of impact functions means that they should have the smallest possible dependency on other parts of InaSAFE. We should be able to use impact functions in a wide range of contexts with few impediments. For example we should be able to use impact functions as simply as punching in a few lines like this into the QGIS python console:
Integration of Aggregation
Currently there is a lot of indirection that takes place in order to perform aggregation on an impact layer. I would like to propose that we include aggregation as a natural feature of impact functions - simply by calling
aggregate
on the impact function base class which will do a noop if no aggregation layer has been defined, otherwise it will carry out the aggregation in-situTracing the plugin loading process
There are many layers of indirection between the things that use an Impact Function and the Impact Function itself. e.g.
See also
Reference implementation here:
https://github.com/timlinux/impact_function_registry
The text was updated successfully, but these errors were encountered: