Comments (6)
It is not redundant, IMO. The abstract class ClassName : IInterface
is a very convenient pattern that gives you the flexibility to change your code with less pain. It also allows you to create your own INodeBehavior implementation directly without using the abstract class, if you want/need to.
from nbitcoin.
Even though I don't use it in my code, the main problem is that changing that now can break lots of code for not a lot of upside.
Looking back I would probably not have used an interface as it makes things more complicated to change in the future, but well... at least we can have any class be a behavior as lontivero said.
My decision back then to be an interface was that the contract was very simple: Attach and Detach.
from nbitcoin.
OK, we can maintain INodeBehavior if we want -it does not hinder-, but this question appeared for me thinking of 'NodeBehaviorsCollection'.
If NodeBehaviorsCollection is a collection of NodeBehaviors... I think it has nothing to do to do with INodeBehavior, which is for "another uses we want/need" as lontivero says.
So, in my humble opinion, a collection of NodeBehaviors must have exactly NodeBehaviors and must exactly inherits a ThreadSafeCollection of NodeBehavior, not a ThreadSafeCollection of INodeBehavior, which may have little -or somewhat stranges- relationships with NodeBehaviorsCollection in a future.
I suggest making at least this little change in NodeBehaviorsCollection. I think this will make the code more accurate.
from nbitcoin.
Peleando!!
El 1 may 2016, a las 7:09, Carlos J. Díez [email protected] escribió:
OK, we can maintain INodeBehavior if we want -it does not hinder-, but this question appeared for me thinking of 'NodeBehaviorsCollection'.
If NodeBehaviorsCollection is a collection of Nodes... I think it has nothing to do to do with INodeBehavior, which is for "another uses we want/need" as lontivero says.
So, in my humble opinion, a collection of Nodes must have exactly Nodes and must exactly inherits a ThreadSafeCollection of NodeBehavior, not a ThreadSafeCollection of INodeBehavior, which may have little -or somewhat stranges- relationships with NodeBehaviorsCollection in a future.
I suggest making at least this little change in NodeBehaviorsCollection. I think this will make the code more accurate.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
from nbitcoin.
We can't make a NodeBehaviorsCollection a collection of NodeBehavior without breaking lots of existing code for little upside. I don't think it is worth changing it for only easthetic reasons. Especially that users never deal directly deal with the interface and always ends up using Find<TBehavior>
.
I don't think changing to collection of NodeBehavior will make their life easier, and at worse may break some of their code.
from nbitcoin.
Thanks Nicolas. I understand and agree.
from nbitcoin.
Related Issues (20)
- calling GetAddress() with ScriptPubKeyType.TaprootBIP86 generates incorrect address? HOT 3
- Support for `wtxidrelay` message
- `Array size too big` after receiving block containing Ordinal NFT HOT 6
- Need some code example on how to use RPC client on Bitcoin Test net. HOT 10
- Why test code not working for using NbitcoinTest? HOT 3
- How to find the peers in BTC blockchain? HOT 2
- Add bitcoin as a topic to this repository
- No call to TransactionBuilder.Send has been done which can support the fees HOT 1
- Link on the github readme page to ebook is not working
- Non-segwit inputs are not serialized in PSBTs HOT 4
- VerifyMessage does not exist HOT 7
- Hello, is there any sample code for taproot? HOT 1
- How to generate taproot NOMS internal key?
- Unable to create or compile to get NBitcoin.dll
- "Unknown transaction optional data" error when calling GetBlock() HOT 1
- Sign a text message with NBitcoin HOT 6
- RobiniaDocs API Explorer
- Failing to P2WPKH HOT 4
- Getting Block, Block Height, Block Hash
- Invalid PSBTInput Unknown SigHash Type
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nbitcoin.