Skip to content
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

Think about removing happyAttempt #12

Open
theangrydev opened this issue Nov 18, 2016 · 3 comments
Open

Think about removing happyAttempt #12

theangrydev opened this issue Nov 18, 2016 · 3 comments

Comments

@theangrydev
Copy link
Owner

Remembering that this library is supposed to be about two tracks flows, it doesn't really make sense to have a happyAttempt method at all, because at that point there is only one track. The happyPathAttempt method does make sense.

@theangrydev
Copy link
Owner Author

theangrydev added a commit that referenced this issue Nov 19, 2016
…t<Happy> parameter (closes #12)"

This reverts commit 3857666.
theangrydev added a commit that referenced this issue Nov 19, 2016
…er has been revived (closes #12). There is now a special NoSad type that is package private and used as the sad type for a happyAttempt where the sad type is not possible, to make it clear that it is not yet possible to be in a sad path.
@theangrydev
Copy link
Owner Author

The changes implemented in 9.0.0 and 9.1.0 overlooked something that I forgot about, which is that the sad type cannot be changed in the HappyPath.then method, which means that the NoSad type could never be changed.

There are a few possibilities:

  • Write the "Try" (i.e. happy or technical failure) as a completely separate class hierarchy that ties into the usual BusinessFlow hierarchy when e.g. then is called. Problem here is there will be lots of very similar methods to the existing classes, but with the sad type omitted, which smells because I don't want to have to keep them in sync etc
  • Go back to having to specify the sad type up front in HappyPath.happyAttempt. This also smells because you need to know up front what sad type you will be using later on in the flow
  • Extend the BusinessFlow hierarchy and throw unsupported exceptions for methods that don't make sense for a "Try" and add on methods that do make sense. This smells even more :)

@theangrydev theangrydev reopened this Nov 20, 2016
@theangrydev
Copy link
Owner Author

For now, I reverted the entire version 9 changes and released version 10 that picks up where 8.3.0 left off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant