zingolabs / zcashrpc

An async zcashd RPC client rust crate.
MIT License
2 stars 1 forks source link

DRY make client #30

Closed zancas closed 3 years ago

zancas commented 3 years ago

In order to avoid code repetition I am factoring logic out of zcash-rcli and into zcashrpc.

I am just starting a new app quizface, and this is a good moment to notice when the functionality in the existing app zcash-rcli is what I need.

This pattern of noticing two concrete examples of the same thing, and then abstracting out a single procedure to define it I am going to invoke this logic "make_client" from my sister abscissa app quizface.

I factored it into zcashrpc, and referenced it from there in zcash-rcli.

When I implement quizface I will also refer to make_client in zcashrpc, of course this implies that the zcashrpc crate is a dependency of both app crates (quizface and zcash-rcli), but this was already the case, as can be seen by inspecting each crate's manifest file. You won't find any dependency in the crate that's not on the manifest... so read the manifest!

quizface will not rely on zcash-rcli because it quizface is being used to build zcash-rcli.

An interesting (and immediate) question is, how do the two tools separate concerns? Which tool do you use for which task?

Those questions should be fleshed out while construction of the tool is ongoing. The answers are clearer once more of the tool exists, but the question should be asked now... before the tool implementation is started, and the question should be asked aloud. Note tool implementation is not the start of tool creation!

By expressing the intention now, and letting my team-mates know about it, I am helping them adapt their designs to mine, which empowers me to adapt my designs theirs. Clearer more understood designs are mutually empowering.

There's another really key technique here... copying! @AloeareV did the more difficult exploratory work of the initial implementation of an abscissa app. In addition to correctly using the abscissa framework, she also discovered another useful tool json_typegen, and has already offered some improvements to it!

https://github.com/evestera/json_typegen/pull/19

Anyway hopping back to zcash-rcli, I am copying as much as I can from @AloeareV .

dannasessha commented 3 years ago

cargo test passes when run in both /zcashrpc/ and in /zcashrpc/zcash-rcli.

Thank you for your contributions, comments, and reviews @AloeareV and @zancas!