Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring PhaseMachine #4

Open
6 tasks
dsriseah opened this issue May 18, 2024 · 0 comments
Open
6 tasks

Refactoring PhaseMachine #4

dsriseah opened this issue May 18, 2024 · 0 comments

Comments

@dsriseah
Copy link
Owner

dsriseah commented May 18, 2024

The PhaseMachine is quite old, and could benefit from cleanup. In porting it from GEMSTEP into TypeScript, I noticed some problems with it.

  • nomenclature between "phases", "phase groups", and "phase operations" is unclear in how they related to the PHASEMAP structure.
  • the way that execute() assumes either a group name or a named phase (operation?) inside the group is not very obvious.
  • executePhase() is really "execute phase group"
  • executePhase() also does not return a Promise. It instead uses an obscure combination of reduce() with Promises to execute the block that works, but not as expected. You have to put an await PM.executePhase('PHASE_NAME') inside an async block, but Typescript doesn't think it's necessary because it doesn't understand what's going on.
  • The semantics for PhaseMachine are a bit different than that for GEMSTEP's version of URSYS, so I'd like to resolve that.
  • The way of accessing specific PhaseMachine instances through the static methods is unclear, and not addressed in calls like execute() and hook() (maybe they should)?

I'd like to add some formal transition event logic to PhaseMachine too, having it control a small global state object that can be used to set flags. However, there is no current need for it with current projects, so it's not a priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant