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

Alternative design pattern for handlePOST etc methods #52

Open
nohponex opened this issue Oct 30, 2016 · 2 comments
Open

Alternative design pattern for handlePOST etc methods #52

nohponex opened this issue Oct 30, 2016 · 2 comments

Comments

@nohponex
Copy link
Member

nohponex commented Oct 30, 2016

Further discussion needed

Current design pattern makes it very complicated when implementing complex handlePOST or PATCH methods.

Since in real life world additional checks, transformations have to be made before executing, custom logs, notifications should be processed after and flags and messages to be passed between these two.

Current validationCallbacks and viewCallback is no fit for the job, since passing message requires passing variables by reference so the modified value can be passed to viewCallback

Proposals:

  • a Perhaps a layered pattern like small middleware will be useful
  • b Use context for callables
    An alternative approach might be to create an object context and transform callables to closures, so set context for them.
@nohponex nohponex added this to the Release 3.x milestone Oct 30, 2016
@nohponex
Copy link
Member Author

#51

@nohponex
Copy link
Member Author

nohponex commented Nov 8, 2016

Since it seems that most of the checks are reusable, a middleware solution seems ideal
Of course a name conversion for compatibility should be used since a lot of attributes should be read and written in each layer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
3.x
definition
Development

No branches or pull requests

1 participant