Comments (7)
I always say conditionals should be forced. Code merge situations can easily change if statements without braces. The braces usually make code not compile on mismerges.
C# 7 features are too good not to use.
from protoactor-dotnet.
I mean "force braces on any nested structure" including loops, etc.
from protoactor-dotnet.
What about API surface.
Return arrays or IReadonlyList<T>
?
e.g.
public string[] GetNodes()
//vs..
public IReadonlyList<string> GetNodes()
And how far should we push it on in params?
Allow IEnumerable<T>
on args of more than one elements rather than arrays?
Internally, we could know that we only use arrays and avoid allocations in favor for a more restricted API.
On the other hand, having a generalized codebase could be nice in the long run.
Thoughts?
from protoactor-dotnet.
To be really "correct" I guess readonly lists but i hate coding with them. If people modify the array then they're really killing themselves. How much rope do we give people to hang themselves?
I prefer enumerables as parameters. Let the receiver rebuffer the data if they have to. The receiver should be doing that anyway to guarantee their own copy.
Of course that is subject to perf.
It almost feels like there is a low level and high level set of APIs. Like what is there is low level with arrays. What I'm attempting with DI and a MediatR approach is high level. Maybe think of the API and guidance in that way?
from protoactor-dotnet.
I agree about the style preferences above :)
Regarding collection types, we should actually avoid arrays because creating them is more expensive than lists. Internally I don't see any problem with having Lists as return types, although for public members we should probably strive for IReadOnlyCollection.
from protoactor-dotnet.
Arrays are more expensive than lists? Lists use arrays. I must be missing something in your point.
I'm thinking more of the "danger" of giving the user a mutable collection.
from protoactor-dotnet.
A correction: populating arrays is more expensive than lists (because of bounds-checking). OTOH, a List will have a few more allocations. So I guess we'd need to profile it to see which is more important.
Yes the user shouldn't be given mutable collections, but that can be solved by only having the readonly interfaces on public signatures.
from protoactor-dotnet.
Related Issues (20)
- Bug? Same message is received over and over HOT 15
- Performance doesn't scale with more cores HOT 12
- Request order guarantee? HOT 6
- Who to create Data Flow DIagram HOT 2
- Don't log GossipTimeout if target node left the cluster HOT 1
- Log member information for gossip timeout HOT 1
- Kubernetes provider throws nullref, but recovers
- Gossip + Memberlist sync HOT 1
- Proto.Remote can go out of sync with Proto.Cluster HOT 1
- Two node seednode cluster: "Consensus not reached, Initiating rebalance" HOT 2
- Don't list blocked nodes unknown to self HOT 1
- Large cluster stability notes: HOT 2
- Gossip actor jam HOT 1
- Introduce IsStopping flag
- What is the difference between EventStream and pub-sub? HOT 2
- Remote blocking and Cluster MemberList HOT 2
- At-most-once guarantee is broken HOT 2
- Debugging documentation HOT 3
- Mocking grain client and testability HOT 2
- Is it possible for PubSub to lose messages without subscriber knowing?
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 protoactor-dotnet.