-
Notifications
You must be signed in to change notification settings - Fork 41
update scopes + DBOSExecutor singleton #36
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
Conversation
kraftp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First thought--this is extremely messy. It's not at all obvious what methods are on the object and what are on the global. If you're going to expose the singleton, the "principled" thing to do is to put all methods on it, but that's syntactically a disaster (you'll have to push the singleton around through everything). Much cleaner to have all methods on the global, but then don't expose the singleton at all. We had this exact same debate in Python and decided on putting everything on the global.
I'm fine with this, the only benefit of exposing the singleton is to allow users to mock it in their program. But we can provide a similar benefit by allowing injection of the real thing that needs mocking: the system database. |
Sure, let's try that and see if we can make it robust + usable, it's sounds good in theory but not obvious at all where the mocks would come from. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change to the interface for Initialize/Launch looks good. If there are other significant changes, I can't find them through all the refactoring.
Those two things:
|
Builder pattern for the DBOS singleton:
Manipulating the singleton object
If a user needs to pass the DBOS singleton around and mock it, they can create a mock interface and write mocks manually or generate them with something like mockery.
What is public