I spent the weekend accomplishing almost all of what I set out to, though there wasn't enough time to study for the Assessment. Instead, I finished my portion of the Thunder Talk on Serve Initiated Communication and finished decoupling my Stack OverFlow clone in order to present it today. I'm planning to have a code review on Tuesday night with a few people, so that should be sufficient preparation for the Assessment.

Today started with presentations, and I wanted to be the first to go. I was really proud of the work I'd done to decouple the app, but I'd also styled the app a bit and put in a few funny animations for my team's entertainment. Here they are for you as well.

Stack GopherFlow Home Page:


Stack GopherFlow Edit Page:


Did I mention that our Cohort team name is the Pocket Gophers? I'm sure I did at some point.

Our lecture this morning brought us into some advanced JavaScript, mainly IIFEs, Closures, and Modules. Here's a quick rundown of each:

Immediately Invoked Function Expressions, or IIFEs ("iffys"), look just like any other JavaScript function, except that they have a '()'' at the end so as to immediately call them as soon as they are defined, like so:

function example() {
console.log("I'm being called immediately!")
}();

This is different from the normal pattern, where you'd create the function and then call it at a later point:

function example() {
console.log("I'm only called by my function name!")
};
example();


A Closure in JavaScript is basically a function within another function. The inner function has access to the variables and parameters of the outer function, and calling the outer function returns the product of the inner function's actions on the outer function's data. Here's what it looks like:

function outer (parameter) {
var outerIntro = "I'm in the outer function! ";
function inner() {
var innerIntro = "Now I'm in the inner function!";
return outerIntro + innerIntro + parameter;
};
return inner();
};
outer(parameter);


Finally, using a Module in JavaScript allows you to define functions and keep their variables from being accessed outside the function.

var modular = (function() {
var sum = 0;
return {
add:function() {
sum = sum + 1;
return sum;
},
reset:function() {
return sum = 0;
}
}
}());
console.log(modular.add());
console.log(modular.add());
console.log(modular.reset());


Our challenge for the day was to rebuild jQuery with several parts of its functionality. I was very intimidated at first until we looked into what each call was doing. We figured out how to hide items, display them, and change their class so as to add other attributes. We even added definitions for clicking, so an action could happen based on how we interacted with the object.

After lunch, we had our first round of Thunder Talks. These were all pretty interesting, but not much applicable use to me right now. I'm definitely interested in learning more about background processes like auto mailing, since that seems to be a nice Rails tool to get into, but it's still a bit down the road for now.

The afternoon lecture was on JavaScript promises, and I'm still trying to wrap my head around how they work. From what I understand, a promise allows you to to define a value that isn't available yet, but may be in the future. When it is, the promise can be fulfilled and the function run. If the value never becomes available, the function never runs. There are other outcomes, such as the value being rejected, or an error, but when done correctly, the function simply waits for the value until it's available. Promises will be a huge part of JavaScript 6, so this is definitely something I want to get more comfortable with.

In the afternoon, we went back to working on the jQuery challenge. After that, I worked with my Thunder Talk team to rehearse a bit before tomorrow's presentation. We divvied up what each person would talk about in addition to our own technology, so the whole thing should go very smoothly.

Until then, I'm Edwin Unger and I'm a web developer in training.