I can’t believe that tomorrow is the end of my second week of Fullstack. This week has especially flown by, partly because we have been busy working on stuff and partly because of the holiday on Monday. I have really enjoyed everything I have done so far and feel like I’ve learned a ton.
Last Friday, we worked in pairs to write a CSS selector called Selector.js- basically a version of the CSS selectors that JQuery uses (Sizzle). Our code allowed a user to submit a CSS selector such as “.hidden” and then the code would return all of the elements with the class “hidden” on the website the script was running on. We got this to work for IDs, tags, classes, multiple tags (a tag inside of a tag i.e. descendants), or tags with clases. I had not really used DOM functions such as element.getTagName before so it was pretty cool to be able to access and return elements from a web page. Chrome Dev Tools was super helpful because it allowed us to test our code and debug issues that came up. The most challenging part of the assignment was figuring out how to traverse the DOM- that is how to go through the webpage and access and return every element on it. We did this recursively using depth first search and it forced us to make sure we were actually visiting every node on the page and considering all possible scenarios.
Finally yesterday and today, we went through an Intro to Node and in particular discussed asynchronous functions and how they differ from synchronous functions. We used several different node modules, including Socket.IO to read content from a file to a server and then automatically update the web page each time any of the files in the folder changed and display the new text. It was pretty exciting to run the program from one computer and access the server from another computer and see the file text displayed. If one computer modified the files, the other computer’s user saw those changes display almost instantly in their browser. It was exciting to see how something like this could power things like chat applications and one page apps like Gmail.
Super long post, but I guess I had a lot to say. I can’t wait to continue to see where this experience takes me and build bigger and more interesting projects.