w5d5 - var Wars: A New Scope

    Week 5 done! javaScript is getting a little easier to understand, this is becoming clearer everyday, and the scope of our understanding continues to get deeper, forming a closure on all the knowledge we’ve gained prior to this point, binding this to that. We ended this week by revisiting a couple of old favorites, Tic Tac Toe, and (for the 3rd time) Tower of Annoi (I mean Hanoi). This time, we built javaScript versions. Neither project took us too long to implement, as all of the logic was still the same, but it was interesting to see how differently Ruby and javaScript handled the user input. With Ruby, everything was a bit more straightforward, since the entire program pauses and waits for user input. With javaScript, you have to utilize callback functions to handle the user input, because the function that asks for input is asynchronous, and does not actually wait for the answer, it just continues on with the next set of instructions. This is where callbacks come in. You carefully set them up to be called back only when you need them, which in this case was after the user provides their input. Callbacks make it possible to do multiple things at once, which is extremely important when dealing with web applications.

    We also got our first real taste of debugging a web app, using the developer tools available in Chrome. It looks like it’ll be a very powerful tool that can make debugging and finding issues a lot less painful. The console that comes with it gives you full access to any functions and variables that are in your running app, and you can even set up break points in your code to inspect your code at specific points. You can even directly edit and save your files, and see how those changes affect the live version of you application, so I’m sure we will be getting a ton of use out of that.

    Lastly, we got an official introduction to CSS at the end of class. I have a tiny bit of experience with HTML and CSS, from just playing around with them a few years ago. I have to admit that I was not a big fan of CSS back then, but since we’ve starting building actual apps in class, I’ve been looking forward to getting into the CSS portion of the curriculum. We will finally be able to add a little bit of color and style to the applications that we’ve been building, which is very exciting! Week 6, here we come!