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

A guide for creating loosely coupled modules #20

Open
shawntabrizi opened this issue Jun 21, 2019 · 7 comments
Open

A guide for creating loosely coupled modules #20

shawntabrizi opened this issue Jun 21, 2019 · 7 comments
Assignees

Comments

@shawntabrizi
Copy link

Given a module A which has a dependency on module B, show how you can build module C which can be swapped with B.

Teaches:

  • How to use traits properly
  • Required Functions and Implemented Functions
  • Making a module have no direct dependency on another module
  • Building two modules which satisfy the conditions
  • Some live/practical example of swapping the two
@JoshOrndorff JoshOrndorff self-assigned this Jul 4, 2019
@JoshOrndorff
Copy link
Contributor

JoshOrndorff commented Jul 4, 2019

I'll take this. Here's my plan in case anyone has feedback

  • Marketplace module that is basically like craigslist except that it depends on a notion of "reputation system".
  • Reputation system is a Trait
  • SimpleFeedback module implements Reputation Trait
  • BetaFeedback module implements Reputation Trait
  • Marketplace can work with either notion of Reputation.

Two reputation systems I mentioned are taken from https://www-users.cs.umn.edu/~weiss039/papers/Trust-Grid2005.pdf

@shawntabrizi
Copy link
Author

Sounds a little too complicated to me?

Why not keep it really bare bones. I would think something like a number modifier module, where one module adds to the number, the other subtracts from the number or something.

Something like a beginner and advance reputation system could work here, but making a "marketplace" module should not be an involved part of this process.

@4meta5
Copy link

4meta5 commented Jul 11, 2019

I feel like this could work well with module instancing. I don't fully understand instancing yet, but it seems that srml/balances and srml/collective allow you to create multiple instances of the same module with different configurations. So, for example, if you wanted multiple councils with different voting members and different weighting algorithms. You choose council invocation among the multiple councils based on the nature of voting topics.

@JoshOrndorff
Copy link
Contributor

JoshOrndorff commented Jul 11, 2019

Here's a start I've been toying with. Learneding a lot along the way. https://github.com/joshorndorff/marketplace

@shawntabrizi
Copy link
Author

Do you want / Is it ready for for a code review? How best to give you feedback?

@JoshOrndorff
Copy link
Contributor

@shawntabrizi Feedback welcome at any time. You can comment on my commits or open PRs. It isn't "ready" in the done sense, but there's plenty there. I used your simpler idea as an exercise in substrate collaborative learning today and that code lives https://github.com/JoshOrndorff/state-changer

@shawntabrizi
Copy link
Author

I think the simpler one makes a strong foundation for a 1/2 page tutorial imo.

haven't reviewed either yet. will try to find time

@JoshOrndorff JoshOrndorff changed the title A guide for creating swappable modules A guide for creating loosely coupled modules Aug 28, 2019
@JoshOrndorff JoshOrndorff transferred this issue from polkadot-developers/substrate-developer-hub.github.io Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants