Open dkent600 opened 4 years ago
I think there is a clear pattern, and i am not sure what "usual object-oriented design pattern averyone is used to" you mean that we can use here (but I am curious to learn, because I agree that there is something a bit awkward here)
explanation:
new Entity(id)
proposal.votes()
, proposal.stakes()
and proposal.state()
propsoal.vote()
etc.entity.state()
returns an (observalve of) a IEntityState
interface. This is just the "flat" state.ICompetitionSuggestion
to ICompetitionSuggestionState
, just to avoid confusion hereSo, with that terminlogy, what you are proposing (perhaps) is to have a pattern that looks like this:
class Entity implements IEntityState
public state(): Observable<Entity>
Is that what you hae in mind?
Would be nice if
ICompetitionSuggestion
contained the vote and votes methods. I guess this is an effect of how the client lib entities are architected in general, where entity's static and dynamic properties are stored in class fields rather than the class itself, whereas the entity methods are stored elsewhere in the class. This is awkward for the user to code and not intuitive as it does not follow the usual object-oriented design pattern everyone is used-to.