-
Notifications
You must be signed in to change notification settings - Fork 67
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
Remove Cross Component References #53
Conversation
1. Does initializing and setup of components 2. Holds all component pieces and references
Sorry for the delay on this one @thebigspoon, was busy this past weekend! I'm in favor of this layout - though I was in favor of the last one as well so I think my opinion shouldn't hold too much weight here. Just to keep my head straight, let me present a hypothetical scenario. If I want to add a "fileparsed" publication to a notification system that would subscribe to such events, would I add another line to the _addEventHandlers: function(){
this.dropzone.fileReader.on( "fileparsed", this._createNotification.bind( this ) );
// ... more handlers ...
} , and then add a new private handler function to deal with the notification information/type // new notification handler that passes options into a create() function
_createNotification: function( e ) {
this.notifications.create( stuff, anotherThing, etc );
} , ?? |
@svmatthews -- yep, that's exactly right |
Excellent. I think this is exactly what I was thinking about in my head but wasn't sure how to phrase it all. When we were talking about the pub/sub piece it seemed like there was something missing that ALL publications were sent to and all subscriptions listened to. This seems to properly handle that disconnect. 👍 from me |
…tests for them easier
** that feels like it should be avoided. | ||
** it is the only reference left and it cannot | ||
** be factored out until we potentially | ||
** revisit how MenBar, Menu and Operation work together |
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.
While we don't have to solve it all right now, can you give some hints in regards to what you're thinking about a refactor between the MenuBar, Menu, and Operation?
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.
I haven't looked at the relationship in depth enough to guess what needs to change now. But in particular it feels like the L.DNC.MenuBar
and it's inlaws own the selection relationship more than L.DNC.LayerList
does.
So a quick win in terms of this reference might be to have L.DNC.LayerList
fire events for add and remove here and L.DNC.MenuBar
and inlaws listen for those and hold the selection internally.
That's a quick guess shooting from the hip, so not sure if that would work.
Yeah, most/all of these were my bad. The interlinking of dependencies felt wrong, I was pretty much shooting from the hip. 👍 regarding these changes. To further understand, in the scenario described by @svmatthews, the |
Let's merge this! I think my head is tied a little tighter with this PR and will be able to cruise on some functionality after it is merged. |
@thebigspoon is this going to be you next week? You ocean man, you. |
Pulling the trigger on this one! 💥 🔫 |
Remove Cross Component References
I would appreciate some feedback about the ideas I mention below and some of the solutions the commits tied to this ticket propose.
The App/Controller Idea
Originally the
MapView
class was called something likeDncApp
and it's general purpose was to glue and setup things:FileReader
handlersWhen we decided that
MapView
felt like it was it's own component, things got shuffled around and some glue stuff didn't make sense to have in that class anymore.I've noticed that some of the glue logic was moved out into
L.DNC
where it currently lives. My guess is that we can expect thatglue
to grow in the future.L.DNC
really feels like a simple namespace object for things to hang off, but not it's own class. Maybe that's just me.More importantly, another side effect of the refactor was the propagation of some patterns that I feel like we should avoid:
FileReader
now reaches outside of it's scope globally to access other components here.TurfOperation
also reaches outside of it's scope to add layers here.FileReader
component fires an event that it itself listens to here.Proposal
It feels like we need a thing that does the glueing and setup again. This thing, lets call it a controller, would also hold component references so we don't force components that shouldn't know about each other to tightly reference each other.
What's Changed?
AppController
. See the class here.