Skip to content

Enhance the readability of code setting observer. #15

@veblush

Description

@veblush

Current code that sets and passes observer to interfaced method is not good for readability.

Setting and Passing observer in Akka.Interfaced

var observerId = IssueObserverId();
var observer  = new UserObserver(Self, observerId);
AddObserver(observerId, this);
actor.Method(observer);

Setting and Passing observer in Unity-SlimClient

var observerId = G.Comm.IssueObserverId();
var observer = new ObserverChannel(ApplicationComponent.Instance, true, true);
G.Comm.AddObserver(observerId, observer);
userLogin.Login(id, password, observerId);

It's quite mouthful and not consistent with passing observer id or object itself.
Can we improve it like this ?

var observer = CreateObserver<UserObserver>();
actor.Method(observer);

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions