A declarative form (routing) for the io reader concern #8
thorwhalen
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
See also:
Again the theme of "routing" when refactoring code towards reuse (declarative form, plugin architecture, framework).
In tabled.base I already set up declaratively for the "resolve to dataframe" concern, via the
ext_mapping, but the io object resolution is parametrized through aresolve_to_iofunction, with a default that is itself a function whose parameters haven't been factored out to be declarative.The current set up is already quite "frameworky", as you can see:
But when I'm at this point of my refactoring towards reuse (smaller functions, etc.) I'm tempted to go a step of "frameworking" or "plugin architecture" further and note that the default_io_resolver is really parametrized by a nested mapping of conditions and resulting returned functions.
I could enable to user to parametrize the io resolution in a "declarative" manner, that is, by editing the "configuration" that the nested mapping of conditions is, instead of having to write their own function.
For example, my
resolve_io(corresponding to the abovedefault_io_resolverfunction could be like this:But when I do that, I then wonder if I've pushed design too far again, prematurely.
The design is better, I have little doubt about that.
But even better design comes at a cost, not even counting the cost of actually designing the thing: Complexity and readability-to-the-novice.
Beta Was this translation helpful? Give feedback.
All reactions