In my opinion, names such as Binary, List, Text are too generic and prone to naming collisions. It might not be much of a problem within this project, as a low level library, it isn't unreasonable high level applications might already be using List, Text, etc. Two main problems arise frequently when there are two Text types such as Bencodex.Types.Text and some App.Text:
- It isn't immediately apparent which
Text type is being used at a glance. Yes, in most cases, it can be derived from context and IDEs help, but this still is unnecessarily confusing.
- Again, it is also often likely to happen both
Text types are needed in a single source file since the whole point of Bencodex.Types.Text is to encode string or App.Text, in which case either unnecessary aliasing or fully qualified names are needed.
Honestly, I think it'd be better to name such types as BList, BText, etc. like here. There are pros and cons but I'd say overall the benefits outweigh the costs. As we have no control over the naming scheme in end-user's codebase, we should do as much as possible to avoid name collisions happening in the first place.
In my opinion, names such as
Binary,List,Textare too generic and prone to naming collisions. It might not be much of a problem within this project, as a low level library, it isn't unreasonable high level applications might already be usingList,Text, etc. Two main problems arise frequently when there are twoTexttypes such asBencodex.Types.Textand someApp.Text:Texttype is being used at a glance. Yes, in most cases, it can be derived from context and IDEs help, but this still is unnecessarily confusing.Texttypes are needed in a single source file since the whole point ofBencodex.Types.Textis to encodestringorApp.Text, in which case either unnecessary aliasing or fully qualified names are needed.Honestly, I think it'd be better to name such types as
BList,BText, etc. like here. There are pros and cons but I'd say overall the benefits outweigh the costs. As we have no control over the naming scheme in end-user's codebase, we should do as much as possible to avoid name collisions happening in the first place.