You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "Sud0x67 (via GitHub)" <gi...@apache.org> on 2025/11/16 09:55:46 UTC
[I] [Improvement][Master] Introduced abstract state-action classes to consolidate shared code, enhancing conciseness. [dolphinscheduler]
Sud0x67 opened a new issue, #17686:
URL: https://github.com/apache/dolphinscheduler/issues/17686
### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Hi guys,
I noticed that there’s duplicated code shared among `WorkflowSerialWaitStateAction`, `WorkflowSubmittedStateAction`, `WorkflowFailoverStateAction`, `WorkflowSuccessStateAction`, and others.
To improve code conciseness and reduce redundancy, I plan to introduce two abstract base classes:
- `WorkflowTerminalStateAction`, which handles only WorkflowFinalizeLifecycleEvent, and
- `WorkflowPseudoStateAction`, which doesn’t receive any events and serves purely as a marker state.
This refactoring helps eliminates duplication across these action classes.
### Are you willing to submit a PR?
- [x] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Improvement][Master] Introduced abstract state-action classes to consolidate shared code, enhancing conciseness. [dolphinscheduler]
Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on issue #17686:
URL: https://github.com/apache/dolphinscheduler/issues/17686#issuecomment-3540982049
-1, We shouldn't increase the difficulty of understanding code just to reduce duplication. Initially, we did not introduce additional abstract classes. We wanted developers to clearly understand how many methods need to be handled if they add a new state event.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Improvement][Master] Introduced abstract state-action classes to consolidate shared code, enhancing conciseness. [dolphinscheduler]
Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on issue #17686:
URL: https://github.com/apache/dolphinscheduler/issues/17686#issuecomment-3544780708
-1, We shouldn't do this since `WorkflowPseudoStateAction` and `WorkflowTerminalStateAction` will increase the complexity of understanding.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Improvement][Master] Introduced abstract state-action classes to consolidate shared code, enhancing conciseness. [dolphinscheduler]
Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS closed issue #17686: [Improvement][Master] Introduced abstract state-action classes to consolidate shared code, enhancing conciseness.
URL: https://github.com/apache/dolphinscheduler/issues/17686
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Improvement][Master] Introduced abstract state-action classes to consolidate shared code, enhancing conciseness. [dolphinscheduler]
Posted by "Sud0x67 (via GitHub)" <gi...@apache.org>.
Sud0x67 commented on issue #17686:
URL: https://github.com/apache/dolphinscheduler/issues/17686#issuecomment-3542792510
Hi @ruanwenjun,
I really appreciate your concern about the cost of understanding the code—that’s an important consideration.
The goal of introducing `WorkflowTerminalStateAction` and `WorkflowPseudoStateAction` isn’t just to reduce duplication for its own sake, but to **embed clearer semantics directly into the class hierarchy**.
With these abstract base classes:
- Terminal states (e.g., success, failure) are explicitly required to handle `WorkflowFinalizeLifecycleEvent`—enforced by the base class.
- Pseudo-states (e.g., submitted, serial-wait) clearly signal that they handle no events at all—again, evident from their type.
This actually **reduces cognitive load**: instead of reading through eight nearly identical implementations to infer the pattern, developers can immediately grasp the expected behavior just by looking at the inheritance structure.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Improvement][Master] Introduced abstract state-action classes to consolidate shared code, enhancing conciseness. [dolphinscheduler]
Posted by "Sud0x67 (via GitHub)" <gi...@apache.org>.
Sud0x67 commented on issue #17686:
URL: https://github.com/apache/dolphinscheduler/issues/17686#issuecomment-3538943043
https://github.com/apache/dolphinscheduler/pull/17687/files
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Improvement][Master] Introduced abstract state-action classes to consolidate shared code, enhancing conciseness. [dolphinscheduler]
Posted by "Sud0x67 (via GitHub)" <gi...@apache.org>.
Sud0x67 commented on issue #17686:
URL: https://github.com/apache/dolphinscheduler/issues/17686#issuecomment-3547125429
OK, based on the discussion above, I've decided not to make these changes for now.
Thanks for your valuable input @SbloodyS @ruanwenjun
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org