jmrozanec / jmrozanec/cron-utils

Improve validation and simplify API usage using Chain of Responsibility and Facade patterns

Open
#714 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.2k
Forks
272
PR merge metrics
No merged PRs in 30d

Description

During the analysis of cron-utils, I identified two design improvement opportunities. First, the validation process of cron expressions could benefit from the Chain of Responsibility pattern by separating the different validation rules (syntax, field validation, range verification, special characters, and field combinations) into independent handlers, making the validation process more modular, extensible, and easier to maintain.
Additionally, the library API could be simplified by introducing a Facade pattern that encapsulates the interaction between classes such as CronDefinitionBuilder, CronParser, ExecutionTime, and CronDescriptor. This would reduce the amount of code required by clients to perform common operations while keeping the existing functionality unchanged.
Attached are UML diagrams illustrating the current design and the proposed redesign for both improvements, together with a brief explanation of the suggested architecture. I hope these proposals can be useful for future enhancements of the project.

[DESIGN PATTERNS.pdf](https://github.com/user-attachments/files/30153413/DESIGN.PATTERNS.pdf)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the attached DESIGN.PATTERNS.pdf and inspect how CronDefinitionBuilder, CronParser, ExecutionTime, and CronDescriptor currently interact. Compare the proposed validation handlers and facade with the existing functionality; done means the design is implemented without changing existing behavior and the validation responsibilities are separated as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.