Skip to content

Questions about encapsulation #73

Description

@jswigart

Sorry if there is a better place for support/questions.

Question is regarding encapsulation, compartmentalization type concerns.

The example seems to suggest that the data for your states all basically needs to live outside the states and state machine. In the case of the example the GuardAI class is basically a grab bag of disparate properties that ultimately belong to specific substrates.

Is there any alternative to this?

Am I correct that you’d need to subclass one of the state types to encapsulate data within it?

Also, is there any payload functionality available to events? I’m not seeing a lot of ways to inject data into the system, and events often have contextual payloads with them that is often important to the event. A damage event without an instigator or damage type, or amount, or anything else is of marginal usefulness to making decisions about how to react to it, and if you have to externalize the code for that to fire discrete events for transitions, we’re in a paradigm opposed to normally beneficial design principles like encapsulation, single responsibility, etc.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions