TLDR
Refactoring the design of the Finite State Machine to remove Glides and StateBase. “Free Transitions” can be simply represented by an updated Transition class that can leverage ActionEnum.NOOP.
Notes and brainstorming of new design structure.

Defining the ActionEnum with delegator / strategy pattern.
public enum ActionEnum {
CREATE_GAME(new CreateGameAction()),
JOIN_GAME(new JoinLobbyAction()),
SKIP(new SkipAction()),
ROLL(new RollAction()),
PLACE_SETTLEMENT(new PlaceSettlementAction()),
PLACE_ROAD(new PlaceRoadAction()),
BARTER_OFFER(new BarterOfferAction()),
BARTER_ANSWER(new BarterAnswerAction()),
PLACE_ROBBER(new PlaceRobberAction()),
PLAY_DEV_CARD(new PlayDevCardAction()),
NOOP(new NoopAction());
private final IAction actionStrategy;
ActionEnum(IAction actionStrategy) {
this.actionStrategy = actionStrategy;
}
.
.
.
}
Main work
- Design / brainstorming / revising object structures and relationships for
Action,State,Transition, andGlide. - Updating
ActionEnumto use “strategy” pattern, which allows for single object instances of all action implementations. - Re-testing functionality via automated scripts (with manual verifications of board state)
Challenges
- We are somewhat shoe-horning purely functional logic into objects / classes / instances since Java is so heavily OOP.
Learnings
- Refresher on generics vs polymorphism and when
List<? extends MyAbstractClass>is relevant.- This syntax puts an upperbound on the abstract class that each list object must extend. The list can only have it’s elements defined during initialization; you cannot dynamically add elements to lists declare with this type definition.