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

refactor OodApp and BatchConnect::App #4170

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

johrstrom
Copy link
Contributor

refactor OodApp and BatchConnect::App to simplify their relationship. Confusingly, these 2 objects referenced each other. An OodApp had a BatchConnect::App object and vice versa, making it very difficult to (a) reason about and (b) cache/serialize.

So this simplifies the relationship by simply having OodApp the parent class which BatchConnect::App inherets and can reference through super.

I'll comment through these changes on specific areas that I'm trying to fix.

refactor OodApp and BatchConnect::App to simplify their relationship.
Confusingly, these 2 objects referenced each other. An OodApp had a
BatchConnect::App object and vice versa, making it very difficult to
(a) reason about and (b) cache/serialize.

So this simplifies the relationship by simply having OodApp the parent
class which BatchConnect::App inherets and can reference through super.
Comment on lines -187 to -189
def batch_connect
@batch_connect ||= BatchConnect::App.new(router: router)
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you can see OodApp (what is now the parent) having a reference to a BatchConnect::App, what is now it's child.

Comment on lines -460 to -463
# The OOD app object describing this app
def ood_app
@ood_app ||= OodApp.new(router)
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then confusingly, the child BatchConnect::App has a reference back to the parent OodApp and indeed uses this object for defaults for titles or categories and so on.

@@ -106,31 +104,33 @@ def description
# Default description for the batch connect app
# @return [String] default description of app
def default_description
ood_app.manifest.description
OodApp.instance_method(:manifest).bind(self).call.description
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There may be a better way to do this. Calling super calls the method of the same name - i.e., default_description. Only default_description doesn't exist on the parent, so we have to do some fancy footwork here.

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

Successfully merging this pull request may close these issues.

2 participants