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

Extensions Architecture #543

Closed
virkt25 opened this issue Aug 29, 2017 · 7 comments
Closed

Extensions Architecture #543

virkt25 opened this issue Aug 29, 2017 · 7 comments

Comments

@virkt25
Copy link
Contributor

virkt25 commented Aug 29, 2017

Description/Steps to reproduce

The current approach to a mixin extension may require implemented methods to be overridden by an extension developer. This can prove to be an issue if an extension developer doesn't call super.method() (unless it's intentional).

The ticket is to discuss and explore the idea of having extension points in our application to make it easy for extension developers to create extensions. From my understand an example would be to automatically look for a function to handle a given extension point. For Ex: What functions / extensions can handle repositories. Call the appropriate registered extensions. What can handle controllers?


Original Meeting Notes

  • Explore idea of extension point and have a component loader to lookup and delegate extensions instead of extension overriding the method (EX: component() by repository.)

Related
#541 (comment)
#541 (comment)

@bajtos
Copy link
Member

bajtos commented Aug 29, 2017

I personally prefer the explicit approach where mixins override app.components method and call super.component(). IMO, this is the idiomatic way that should be familiar to any JavaScript/TypeScript developer, it's less code in loopback core for us to maintain and it avoids the situation where our "automagic" implementation does not support a specific use case and therefore we need to keep adding more and more code to this part of loopback core.

@raymondfeng
Copy link
Contributor

To add some context, here is the description of extension points/extensions idea I borrow from Eclipse as a proven successful platform and ecosystem with many extensions. Visual studio code also uses a similar mechanism.

https://wiki.eclipse.org/FAQ_What_are_extensions_and_extension_points%3F
https://code.visualstudio.com/docs/extensionAPI/patterns-and-principles

LoopBack Next components are roughly equivalent to Eclipse plugins.

With mixins, extension implementations need to have a dependency on the extension point. Extension developers are required to write code to stitch extension behaviors into the extension point logic by adding new methods or overriding existing ones. And that's repetitive for each extensions too. Individual extensions might not have enough knowledge to fully control how they fit into the extension point as extension point is not in charge of the coordination any more.

@raymondfeng
Copy link
Contributor

In summary, we need to come up a consistent way to support the following pattern using rest servers as an example:

  1. Rest component (extension point) manages multiple rest servers (extension).
  2. Each rest server has a name and corresponding configuration (or options).
  3. Rest component should be able to get a list of rest servers or look up one by name
  4. Rest server should be able to receive injection of the configuration

@bajtos bajtos added the non-MVP label Nov 2, 2017
@stale
Copy link

stale bot commented May 1, 2018

This issue has been marked stale because it has not seen activity within six months. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository. This issue will be closed within 30 days of being stale.

@bajtos
Copy link
Member

bajtos commented Aug 27, 2018

Labelling as post-ga. For 4.0 GA, we are starting with a different set of spikes - see #1034

@stale
Copy link

stale bot commented Sep 17, 2019

This issue has been marked stale because it has not seen activity within six months. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository. This issue will be closed within 30 days of being stale.

@stale stale bot added the stale label Sep 17, 2019
@stale
Copy link

stale bot commented Oct 17, 2019

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

@stale stale bot closed this as completed Oct 17, 2019
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

5 participants