auto: Provide a better `EngineEvent` object model and callback design (visitor pattern?)
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 85
- Forks
- 26
- Avg merge
- 11h 49m
- Merged PRs (30d)
- 22
Description
Currently, the way engine events are exposed are very similar to how the other languages expose it. The design looks more like the JSON wire protocol than a well design object model.
public class EngineEvent {
public int getSequence() {
return sequence;
}
public int getTimestamp() {
return timestamp;
}
@Nullable
public CancelEvent getCancelEvent() {
return cancelEvent;
}
@Nullable
public StandardOutputEvent getStandardOutputEvent() {
return stdoutEvent;
}
@Nullable
public DiagnosticEvent getDiagnosticEvent() {
return diagnosticEvent;
}
@Nullable
public PreludeEvent getPreludeEvent() {
return preludeEvent;
}
// ...
}
public class CancelEvent {
}
public class StandardOutputEvent {
// ...
}
// ...
There's no common base type for individual events.
When you receive an EngineEvent from the callback, you have to check which getter doesn't return null to know which actual event it is.
We can do better. We can have a better class hierarchy and could consider an improved callback design, like using the visitor pattern.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the current Java EngineEvent callback and its getter-based event classes, including CancelEvent, StandardOutputEvent, DiagnosticEvent, and PreludeEvent. Compare the existing object model with the issue's proposed common event hierarchy and visitor-style callback; done requires an agreed design for both the event types and callback behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100