w6d1 - A Space Oddysey

    Space, the final frontier, where no one can hear you scream. Not even when you’re hurtling at 10 px per second and repeatedly slamming into asteroids, that, for some reason, are perfectly round. And all the same size… And green! But none of that matters, because today we built a fairly full functioned Asteroids game! For a few hours of work, we were definitely excited to have built something that we could actually play with in a browser. We utilized an HTML element called ‘canvas’, which allows you to draw shapes and paths on a virtual canvas. It was a simple tool, but surprisingly flexible. It wasn’t quite able to simulate motion (at least not in any way that we could see), but it was fast and powerful enough that we were able to calc the next move of all objects on the screen and redraw them hundreds of times per second, causing it to render with surprising fluidity. The Chrome debugger came in handy today, and we even spent some time using the breakpoints and step in/out abilities to get access to some of the inner workings of some things we were having trouble with.

    We also got another taste of CSS today, with Jonathan delivering another lightning lecture at the end of the day. This one was focused on how to use ‘float’ to create clean layouts. This also included a tidbit about injecting a blank string at the end of your content. If you neglect to do that, the container holding your floats will actually not recognize the fact that the floats are there and essentially ignore them. By injecting this empty content, it forces the container to resize and fit the floated content perfectly. Tomorrow we will be getting into more CSS, in depth this time, so let’s see if any of these points have stuck in my brain!

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!

w5d4 - Ruby, my one true love

    Oh Ruby, how I miss thee! Your simple methods… your casual nature… your descriptive variables and liberal underscores… the way you verbosely yell at me when I do something wrong… I took you for granted, and now you’re gone! The only left to fill the void is javaScript…

    Sigh… The official first day of javaScript was a little rough. I thought I was ready after all of the CodeAcademy prep, but I’m still trying to get used to this fickle mistress of a computer language. It’s jarringly littered with braces and semicolons, and I think the thing that bugs me the most, is how permissive it is. Unless you do something blatantly wrong, javaScript just sort of lets things happen and you’re left to figure out where you went wrong. My favorite example is that javaScript has a value called NaN, which stands for “Not a Number”. When it comes across some weird calculation, like 7/”chair”, it doesn’t throw any kind of error, it just assigns it the value NaN and continues on it’s merry way. This might sound great, except for the fact that this will screw up any other calculations that may have depended on that value, turning EVERYTHING into NaN. Since there was no actual error, it can be difficult to backtrack through your code to see where things went awry. In the coming days, we’ll be exposed to better debugging tools, which should prove to be immensely useful for seeing what is going on at any point of your JS program.

    Of course, it makes sense that JS is so lenient. The internet is basically built on JavaScript and it HAS to be very flexible to work so widely, so we will just have to deal with the quirks of JS as we go along, and hopefully get used to them. It does have some cool things that Ruby didn’t (I hope Ruby isn’t listening right now…), such as callbacks and asynchronous functions. Callbacks are basically functions that you can set up, specifically to be called later. It seems that these are typically used alongside Closures, which are functions defined within other functions, and they handle the local variables of the original function… or something like that, I’m still trying to nail down the concept. Asynchronous functions are pretty cool, and I’m looking forward to dealing with those more in depth. Things that are asynchronous don’t hold up the rest of your program while they run. You can trigger one and continue running the rest of the program while the async function does it’s own thing. The tricky thing is grabbing any useful information back, and I think that’s where callbacks come in handy, but I’m not entirely sure. It will take some practice before I get used to these new concepts.

    Despite the rocky start, I’m still excited to go deeper into javaScript. The things that I mentioned above are of particular interest to me, and I see how they might be powerful tools in the arsenal of any developer.

w5d3 - Going off the Rails

    Rails, done! At least for now… I have a sneaking suspicion it will be back. I spent the first part of the day finishing up the Rails Lite project that we started yesterday. I was done pretty early, but I spent some time going back over older sections and trying to understand them a little better. I feel more comfortable now with all of the hocus pocus that Rails does for you, and I think once we get into more complex application development, it will be a huge help to have spent the last 2 days dissecting Rails the way we did. But, that’s behind us for now, it time to move on the some JavaScript!

    It feels weird to just completely shift gears and deRail the Ruby train, but it makes sense. It’s time to add on to that knowledge base with some good old fashioned, tried and true JavaScript. The first part of our prep was to do a tutorial from , CodeAcademy. I’ve used the site in the past, and in fact I used it to help me learn Ruby prior to starting App Academy, and I’m a big fan, but going through the beginner JavaScript material was pretty dull, almost torturous. I think that’s partly a testament to how well I already know Ruby. There are a lot of shared concepts between the languages, and I’m sure I picked up on things a lot faster, solely because they were already very familiar concepts. Still, I know it won’t be easy to just start writing JavaScript. There are certainly enough nuances to keep me on my toes. I even got stuck a few times doing the tutorials today because I kept trying to do “joe = Person.new(…)” (a la Ruby) instead of “joe = new Person(…)”. It’s the small things that are probably going to be the hardest to adjust to, but even so, I’m excited to see what new functionality JavaScript brings us.

w5d2 - All of the Lites

    Today we started tying up the Rails section of the curriculum with an assessment, aimed at testing our knowledge of putting together a basic web app. It mostly revolved around user authentication, and using sessions to handle logged in users. By now, I feel pretty comfortable with all of that, and the assessment went down without a fight. Once we were all done, we moved on to the last piece of the curriculum.

    The Rails curriculum started last week with learning SQL and then constructing a lite version of ActiveRecord, which gave us a glimpse at how Rails handles Models behind the scenes. It’s only fitting that we end with trying to put together the rest of Rails, with Rails Lite. This entails trying to reconstruct the way that Views and Controllers function. Everything seems to be driven by the server, which sends down an HTTP Request and expects an HTTP Response. Rails takes that response, parses it in a way that make it useful to developers (we’ve mostly used the “params” method, which returns a hash of specific parameters that were included in the request), decides what process to hand it off to, and then sends back the final response. To me, this is probably the most magical part of Rails, and that makes it a bit harder to understand. There is a LOT going on under the hood, and it can get confusing pretty quickly, but I think by the end of the day tomorrow, I should have a pretty good handle on some of the black magic that Rails likes to practice.