Now that all three modules are created, Kyle wants to simplify the functionality of each module. This involves refactoring the code so the carousel module handles all click events and the details module is passed the ID of the object to show.
(electronic music)…- Let's look at step three.…I want you to observer something.…Again, we're kind of trying to take a higher level view…of what's happening here in this code.…Okay?…So don't get too much focused on the syntax…and let's think more about conceptuals.…What does the details JS, what does the details module…signify to you?…What is its job?…- [Man] To display details.…
- Display details, but really more…just to manage the details pane, right?…What is the carousel modules job?…- [Man] To manage the carousel.…- To manage the carousel, right?…So would you consider it to be…kind of a weird code organization…if the carousel module…had details-specific code inside of it?…- [Man] Yes.…- That would look weird to have,…if we're going through all the trouble…to have separate modules,…we want them to be independent, right?…Same question if I had carousel-specific code…inside of my details module.…
That would equally seem not appropriate.…Would seem like too much mixture of the two, right?…If we're properly structuring our modules,…
Note: This course was created on 03/29/2016 by Frontend Masters. We are pleased to host this content in our library.
- Carousels, panes, and modules
- Middle-end architecture
- Secure phrase generator
- Routing functions
- Calling the API
- Rendering on the page
- Shared data validation
Skill Level Intermediate
2. Organizing Code
5. Adding a Shared Module
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.