Repository navigation
refactor: make all NodeImpl/ChainImpl/ExternalSignerImpl members public, rm temporaries, simplify - #25651
Conversation
|
Some notes:
|
|
Thanks for having a look, Marco. It seems some of those things could change in the future, so this change looks preferable to me. In addition to the motivations in the OP, having |
I don't think any of the things could change in the future, unless I am missing something or you have examples where it would change. So to me this mostly seems like a stylistic change, as I can't imagine a real-world example where this could make any difference. |
|
I guess I have a mild preference for making everything public, but this change seems fine. By design everything in ChainImpl NodeImpl WalletImpl has been public since the classes were written because the classes themselves are private. IMO it is only meaningful to distinguish between overridden and non-overridden members and private/public seems like noise in this context. Whatever style you land on though I do think would be good to consistently apply it to all the |
|
Thanks, I'm convinced. Nothing in |
02f5160 to
fd528bc
Compare
|
Updated per review feedback (thank you). |
fd528bc to
d742ebb
Compare
|
Added a second commit removing unnecessary and verbose temporaries in |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
ryanofsky
left a comment
There was a problem hiding this comment.
Code review ACK d742ebbc91e5ca40389a3923bffba3e24911cc6f. Suggested a change but is already an improvement as-is and the second commit does a nice job of modernizing some of this code
There was a problem hiding this comment.
In commit "refactor: make all NodeImpl and ChainImpl members public" (b9a715ea03506bc6aa647d3df1cd177221d30dd0)
Would encourage putting class member variables all together and not interspersing them with methods. If I'm trying to understand what a class does and what its role is in the application, knowing what data it contains is maybe the single most important piece of information I could have, and it's harder to see if the data fields aren't declared in a single place.
#21525 messed up the style a bit but the original style and style I'd recommend would be:
class NodeImpl : public Node
{
public:
// ... virtual methods first ...
// ... nonvirtual helper methods next ...
// ... data fields last ...
};There was a problem hiding this comment.
Done, and it's a smaller diff too. Thanks for clarifying!
There was a problem hiding this comment.
In commit "refactor: remove unneeded temporaries in node/interfaces, simplify code" (d742ebbc91e5ca40389a3923bffba3e24911cc6f)
Nice simplification!
as the classes themselves are private, and to be consistent within all the *Impl classes in src/node/interfaces.cpp and src/wallet/interfaces.cpp following this order: public: // ... virtual methods ... // ... nonvirtual helper methods ... // ... data members ... and add documentation in src/node/interfaces.cpp and src/wallet/interfaces.cpp to help future reviewers and contributors.
d742ebb to
e7ffe54
Compare
- make the code easier to read and understand - improve performance by avoiding unnecessary move operations - the cleaner, simpler, and easier to read the code is, the better chance the compiler has at implementing it well
e7ffe54 to
4bedfd7
Compare
|
Updated the first commit with @ryanofsky's suggestion (thanks!) and the second commit with a simplification.
|
Make all
NodeImpl,ChainImplandExternalSignerImplclass memberspublic(and document why), to be consistent in all the*Implclasses insrc/node/interfaces.cppandsrc/wallet/interfaces.cppand to help future reviewers and contributors.Remove unneeded temporaries in
NodeImplandChainImplmethods insrc/node/interfaces.cppand simplify, to make the code easier to read and understand and to improve performance by avoiding unnecessary move operations.