6 ms·
"actors are called ‘grains’," If you can write a sentence "X are called Y", and X is more well-known, drop Y. "You can then send messages to the grain by crea
by refulgentis 10y ago
"actors are called ‘grains’,"
If you can write a sentence "X are called Y", and X is more well-known, drop Y.
"You can then send messages to the grain by creating a proxy object, and calling the methods:
var grain = GrainClient.GrainFactory.GetGrain<IMyGrain>("grain1"); await grain.SayHello("World");"
var brain = BrainClient.BrainFactory.GetBrain<IMyBrain>("brain1"); await brain.Say("WTF");
- KirinDave 10y agoI suspect the F# interface will not only be more to your liking, and probably be trivial to tie in with MBrace which is a pretty damn great library. All C#/Java style static typing code not only looks like that, but often calls it "best practice." Worth noting that "await" use is quite elegant in what it does here.
- itaysk 10y agoI think that because its a virtual actor with different characteristics that regular well known actors it might be a good idea to call or differently to avoid confusion.
- theprotocol 10y agoI share your sentiment. I'd been away from .NET/C# for a few years and came back to find that they dialed the abstraction level to 11. I adore C# as a language but I find myself increasingly alienated by its generally accepted coding style. I find that Microsoft's products have extremely unintuitive naming schemes at both a low level (language, standard libraries) and a high level (.NET product word salad naming schemes, Office 365 referring to a diverse and inconsistent range of products...). The skeptic in me thinks that this may be an attempt at educational lock-in. The lines between marketing and technology have definitely been blurred.
- m_mueller 10y agoSeems to me all big software houses are affected of this in their long standing products. You start a new thing and come up with a good name. 15 years with 17 product cycles down the line and you have a whole forest of names that have some relation to this thing. See also: iTunes (OSX), iTunes (iOS), "Music" (iOS), Apple Music, iTunes Match, Genius and the iCloud Music tab. Podcasts and videos are also all in there somewhere, know what dear user, you figure it out k?
- rdtsc 10y agoThey brought in very highly paid, smart engineers. Which have periodic performance reviews. If they don't we "we designed and implemnted X, Y, Z awesome new abstractions / features" everyone in the room bosses, employees, higher ups, marking it going to feel let down. So, we have ever more features. "Say, Steve, what have you been doing last year?" - "Welp, just making sure things work, fixed some bugs, documentation, took customer calls. The product essentially works, people love it". "Wait, so we haven't shipped any new features, hmm, ok...". vs the response of "We implemented fizz, bar, quux features. We tore down old zig and added zag instead. It is really the same as old zig, but now look green and re-written with latest framework we saw in HN headlines". "Oh great, you get a promotion and a raise". I am being a bit silly, but it is only half-joking, it is how software industry often works.
- bunderbunder 10y agoIt's not just Microsoft, though I agree they are really bad at naming. There are plenty of examples of similarly obtuse naming in open source. Storm, with its spouts and bolts, comes to mind.
- edgyswingset 10y agoTry using F# if you don't like the verbosity and over-OO-abstraction. It's fantastic.
- theprotocol 10y agoI'll be sure to give that a shot, thanks for the tip. You've made me realize I've somehow been subconsciously avoiding F# for whatever reason.
- platz 10y agoAgreed. Subconscious reasoning is the worst.
- zamalek 10y ago> abstraction level to 11. Let's break the problem down. You have a language that doesn't natively support actors or message passing. You can solve this by having the developer stub each method (`this.DispatchActorMessage(...)`) or you can implement the interface on behalf of the developer (`Factory.CreateProxy<T>()`). Microsoft doesn't always use the runtime emit approach and, as someone who has used both approaches[1][2], runtime emit is far preferable. This means that something in your code has a responsibility to create actor proxies. That's the first concept: the responsibility to create actor proxies. Not only that, but so far as Reliable Actors go the proxy needs to do quite a bit of work: actors can be rescheduled to another machine and the proxy needs to continue representing that single durable instance. You also have context: "which cluster controls this actor?" Depending on your scenario you might be able to assume that there is no context. Microsoft cannot make these assumptions because federation is quite important in the enterprise. In fact, the ability for Reliable Actors to have context [will] allow our customers to extend our product without us worrying about noisy neighbors (they are in charge of their own actor cluster, we simply federate to it). Additionally, there are scenarios where the consumption of an actor occurs outside of the context. For example: calling an actor from a GUI app. In order to create the actor, you're going to have to use the object with that responsibility (unless you fancy doing the emit yourself): `ActorFactory.Create<IBrainActor>()`. You then need to pass in the context. Orleans uses a `Client` instance (which should make sense to .Net developers), while Reliable Actors pass the context into the `Create` method. So either: `Context.Factory.Create()` or `Factory.Create(Context)`. Nothing more than a stylistic choice necessitated by the requirements that Orleans and Reliable Actors don't share. The goal here is not to replicate Erlang. It is to make a framework where developers can write distributed systems with a low amount of ceremony. Actors so happen to be the best candidate as a primitive but are most certainly not the be-all and end-all of Reliable Actors (which were inspired by Orleans, so I assume the goal is the same for Orleans). In that way, it makes some things far simpler than Erlang[3] but there's always a cost to that. If distributed systems is the primary goal, then you're going to have overhead if you are not creating a distributed system. If you're talking about terrible naming, that outright I can agree with. Orleans, however, is no more and no less abstracted than it needs to be. [1]: https://msdn.microsoft.com/en-us/library/system.diagnostics.tracing.eventsource.aspx https://msdn.microsoft.com/en-us/library/system.diagnostics.... [2]: https://azure.microsoft.com/en-us/documentation/articles/service-fabric-reliable-actors-introduction/ https://azure.microsoft.com/en-us/documentation/articles/ser... [3]: http://erlang.org/doc/reference_manual/distributed.html http://erlang.org/doc/reference_manual/distributed.html
- manigandham 10y agoThat's just bading coding style, most C# code is not that verbose and crazy.
- rubber_duck 10y agoMany people like C# because compared to Java it's about half the verbosity - C# is still a very limited language with plenty of verbosity and tedium built in, something like F# just blows it away in comparison (even more than C# does Java). Not to mention that the standard OO cult of unit test / mock everything and make everything "reusable" leads to such shitty designs that almost fall out naturally from the language/paradigm. Oh and the one class per file with 3 method interfaces and 10 ceremony lines with namespaces and import definitions/braces. I prefer C# over Java, and in some cases even over F# (it's slightly lover level and therefore it's simpler to control for things like heap allocation) but it usually is that verbose and crazy in the real world from my experience.
- edgyswingset 10y ago> Not to mention that the standard OO cult of unit test / mock everything and make everything "reusable" leads to such shitty designs that almost fall out naturally from the language/paradigm. Not sure I'd call it a cult. From an F# perspective I do it this way: * REPL-driven work to get it up and running * Unit tests to protect what needs to be correct against change * Mock the service boundaries * Expose object-oriented layer to C#/VB consumers Unit tests, mocking, and reusability are good things. Overuse (e.g., mocking to make sure that X calls Y in some business logic engine) is just what it is - overuse. Users of functional languages have their own problems, like suffering from code golf and over-using partial application. I wouldn't call one any worse than the other, it's just the functional crowd is smaller so you see it less.
- rubber_duck 10y agoThere are a bunch of "preachers" who advocate "best practices" which are rarely presented as "we had A and B problems and X worked out better than Y", instead it's "X gives you 1/2/3/4 over Y and therefore X is better", and the community follows along - cult like. Limited nature of language helps promote these "patterns" and "best practices" because it's often hard to find a better solution and much simpler to just apply them indiscriminately, and you end up with verbose and crazy code that the C# ecosystem is full of. I agree that both have their own issues but I do think one is better than the other, F# is more succinct (without turning in to code golf) and (actually) being multi paradigm avoids cases where OO just doesn't fit well. With micro services, actors, distributed computing, etc. those cases are expanding.
- _pmf_ 10y agoRule number one of the distributed systems academic circus it to introduce at least one new term in an effort to create a new buzzword (because as we all now, a lack of buzzword is holding back breakthrough of concepts). Preferably, all established terms should be replaced by buzzword candidates.
- nimish 10y agoThey are not traditional scores. They are virtual and the terminology changes to reflect that
- beagle3 10y agoIn the same vein, I have not yet found anyone who knows why after 30 years or so of use, Microsoft decided to rename "locale" as "culture".
- blackoil 10y ago'X are called Y' normally means X is mostly like Y, but differs in some key fundamental ways. Anyone who doesn't know about X doesn't care of X/Y. But if you call it X, anyone who knows about X, will have to regularly have WTF moments, because even though it is called X, it is not behaving like one. e.g. javascript classes/inheritance/OOPs in general.
- rdtsc 10y ago> "You can then send messages to the grain by creating a proxy object, and calling the methods: var grain = GrainClient.GrainFactory. GetGrain<IMyGrain("grain1") await grain.SayHello("World"); var brain = BrainClient.BrainFactory. GetBrain<IMyBrain>("brain1"); await brain.Say("WTF"); Heh, Erlang: GrainPid ! "HelloWorld" BrainPid ! "WTF"
- platz 10y agoYou left out the code that gets the Pids, which is what the c# version is doing. Otherwise it's just await grain.SayHello("World");
- rdtsc 10y agoAh good point! It is even simpler then ;-) grain1 ! "HelloWorld" brain1 ! "WTF"
- aprooks 10y agodo! GrainPid <! "HelloWorld" via Orleankka F# https://github.com/OrleansContrib/Orleankka/blob/master/Source/FSharp.Demo.HelloWorld/Program.fs https://github.com/OrleansContrib/Orleankka/blob/master/Sour... stilll a bit more verbose than erlang though
- reubenbond 10y agoOrleans calls them grains to differentiate them from actors in the Akka/Erlang sense - because they are Virtual Actors, rather than traditional actors.