-
Notifications
You must be signed in to change notification settings - Fork 117
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
base: master
Are you sure you want to change the base?
Conversation
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.
def batch_connect | ||
@batch_connect ||= BatchConnect::App.new(router: router) | ||
end |
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.
Here you can see OodApp (what is now the parent) having a reference to a BatchConnect::App
, what is now it's child.
# The OOD app object describing this app | ||
def ood_app | ||
@ood_app ||= OodApp.new(router) | ||
end |
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.
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 |
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.
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.
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.