####Week 2: Just keep swimming.. swimming.. swimming.......
Last week we were introduced to the Document Object Model. Even though it took a few days to understand, I get it now. The DOM is the model of the HTML inside the document and where the document lives. This week, we removed the JavaScript from the Blueprint files, making them inactive. Our task was to inspect each element and add the JavaScript back into the files so becomes interactive again for the user. This practices the idea of encapsulation.
Encapsulation is the principle of information hiding. It is one of the most important principles of object oriented programming. The implementation, or the internal workings of an object is hidden from the rest of the program. An example of encapsulation is driving a car. We don't need to know every aspect of that car- how the engine and alternator work, but we do need to know how to use it.
We used the idea of encapsulation this past week by working in the DOM. We encapsulated the projects and gave the user an interface as they interacted with the browswer. We added Javascript back into the Blueprint files through the DOM. The scripts were rendered on the page individually. We targeted an object, retrieved that data, and applied methods to it. This practices the idea of encapsulation because we are communicating through the server only, and the user is hidden from what is going on behind the interface. Yes, the user is able to interact with the interface, but they don't know how it works internally.
Overall, I have a much better understanding of the DOM and working in it to resolve a problem. I've discovered that using NodeLists help us code in way less steps. Something I need to work on is understanding bubbling and capturing event order flow. I feel like I may be doing it? But I have no idea I am. I also really need to work on translating what I'm doing in my code to English. I am horrible at that. Last week was tough- but with every week that goes by, I get the hang of things easier than the last.