-
Notifications
You must be signed in to change notification settings - Fork 53
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
Refactor towards three-layer architecture #122
Conversation
cc @gip -- config is now passed down from top layer |
797ea87
to
dceb9c1
Compare
app: app, | ||
listen: listen, | ||
app: connector.koaApp, | ||
listen: connector.listen, | ||
addLedger: ledgers.addLedger.bind(ledgers), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this doable with with _.partial
, as in app.js
(for consistency)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just grepped for addLedger
and it's not used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't used internally, which is why it is exported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is it used? (Curious)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m pondering the DI structure. One thing I've noticed is that refactoring things like this can be quicker if you use keyword arguments because for example if you want to delete one of them, you can just delete it where it is used and where it is passed in and you don’t have to change all the intermediate functions that were just passing it through. So we might want to consider using a "context" object to hold all the dependency injection objects. It also gives you a logical separation between the DI parameters and non-DI parameters. |
I'm not sure if we're getting much advantage to passing the |
@clark800 I think maybe I can followup with a later commit to avoid needing to pass some things down. The config specifies a backend type, which is then |
Could you provide more context for the purpose of this refactoring? Is there a specific issue that motivated it or is it just to comply with the 3-layer architecture design? |
Also, we could even eliminate a lot of the config parameters by passing it at the module level like this
|
@clark800 I like that approach. |
@emschwartz my understanding was that this was partly motivated by the desire to unit test different quoter backends. With this refactor, we can pass the config as a param into the instantiation of the app, allowing us to switch quoter backends. See here. Is this correct @LumberJ? |
Sounds like a use case for https://github.com/justmoon/reduct On Wed, Mar 23, 2016 at 3:15 PM, Matthew Phinney [email protected]
Evan Schwartz | Software Architect | Ripple |
@MatthewPhinney Yes, that's one of a few things |
Create app container Pass services down into lower layers (lower layers don't require singletons from src/services) TODO: - Move common utils (e.g., services/log) to `common` - BalanceCache not used by default (i.e., caching is behind feature flag) and not a singleton.
dceb9c1
to
643c14c
Compare
Maybe a cleaner way of doing it:
|
caee522
to
eebeef2
Compare
0789628
to
37cce92
Compare
Blocked by interledger-deprecated/five-bells-notary#44 |
LGTM |
Create app container
Pass services down into lower layers (lower layers don't require singletons from src/services)
TODO:
common