-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
How to handle un/happy paths #205
Comments
A similar example has already been described. It may be worth giving a more detailed example of the Return early pattern. |
Hello Peter! This issue is about putting unhappy path in a conditional, and writing happy path as normal flow.
❌ This uses Return early pattern but makes you feel that the unhappy path is the desired one. |
I like Szymon's article ❤️ |
The Return early is not only about Fail fast. It's normal to prioritize processing successful conditions over failing ones. But in practice, there are more cases in which it is more convenient to process an erroneous case first. |
So what do you suggest? |
I see the most optimal solution to rewrite the description of Avoid nesting too deeply and return early (part 2) rule and rename it to Return early pattern. In the comments, you can mention the Fail fast pattern for linking these patterns and alternative search. |
Happy path should not be in a conditional.
Would you welcome a PR?
The text was updated successfully, but these errors were encountered: