W5D4: Feet

You made a new friend named Michael. Michael has a bad habit of grabbing is crotch every ~15 minutes. You don't judge, so you try to ignore whenever Michael reaches down for the goodies. But  it gets embarrassing when Michael does his weird behavior in public. You're not sure if he realizes what he's doing because you've never brought up the topic before. What would you do?

Well, there's this guy in my cohort and he has a problem: his feet smell dank -- and I don't mean dank like they smells good, but dank as in they smell really, really bad. To make his matters worse, he wears the same sandals every single day so that the stank can resonate to full effect, and get worse by the day.

He was my second pair programming partner and I noticed it immediately. As I saw him raise his foot to rest on his lap this was my reaction:


We're almost halfway through the program and I still see him wearing those god-awful sandals. Every time I walked by him or pair-programmed near his vicinity that familiar odor of feet wafted into my nose. I wondered if he knew his feet smelled and why nobody has told him yet, considering how strong the smell was-- I'm sure many cohortmates have noticed.

I felt bad for the guy. The guy always ate meals and hung out alone. We would talk about video games from time to time. He's a pretty nice guy -- just very awkward. I thought it was time someone stepped up to do the dirty work.

After contemplating for hours planning out what to say, I asked him if he wanted to have a talk privately, to which he agreed. We stepped out to the patio, I took a big breath and turned to him.

"Hey [name], what I'm about to tell you is very personal, and for your personal and professional development I would suggest you take care of your personal hygiene more"
With a blank face he gaped and it took him a while to respond

Him: "Oh..... uhh,.. hm, what -- which part specifically?"
I was so relieved that he said this as I grabbed the opportunity to get to the point:
"It's your feet, dude, they smell really bad. Maybe you could wear some shoes?"



An awkward silence fell before us but he was quick to recover. He told me he didn't know about the smell and would take care of it. I told him how I started to feel bad that noone told him yet, and he expressed his thanks to me for being so honest.

It felt good, knowing that I helped someone out. While the embarrassment was short-lived, the benefit of this exchange will (hopefully) help him in the long-run. I like to believe that what needs to happen, has to happen... eventually-- and since nobody was addressing the problem, I sacrificed myself for the good of everyone's olfactory senses.


What we did today:

1. Toy Problem


Async Map

asyncMap has two parameters, an array of asynchronous functions (tasks) and a callback.
Each of the tasks takes a separate callback and invokes that callback when complete.
The callback passed to asyncMap is then performed on the results of the callbacks of the tasks.
The order of these results should be the same as the order of the tasks.
It is important to note that this is not the order in which the tasks return,
but the order in which they are passed to asyncMap.
Once all the callbacks of the tasks are returned, asyncMap should invoke the callback
on the results array.
Example:
asyncMap([
  function(cb){
    setTimeout(function(){
      cb('one');
    }, 200);
  },
  function(cb){
    setTimeout(function(){
      cb('two');
    }, 100);
  }
 ],
  function(results){
    // the results array will equal ['one','two'] even though
    // the second function had a shorter timeout.
    console.log(results); // ['one', 'two']
 });

2. Townhall

3. Pair Programming on Angular
This is one of the few sprints in which my pair and I were not on the same page, but in this one in particular, we were on two completely different books. I didn't understand any of the ideas he was suggesting, nor did I agree with any of the changes he was making to the code. It's times like these when I really want to flip the desk and just do the sprint myself.


Here are some important concepts of Angular that I took away:
--Controllers = Where we store logic for the views
var app = angular.module('myApp', []);app.controller('myCtrl', function($scope) {    $scope.firstName = "John";    $scope.lastName = "Doe";});
--Factories = Provides properties/methods for the controller to use

var app = angular.module('myApp', []);
 
app.factory('testFactory', function(){
    return {
        sayHello: function(text){
            return "Factory says \"Hello " + text + "\"";
        },
        sayGoodbye: function(text){
            return "Factory says \"Goodbye " + text + "\"";
        }
    }            
});
--Scope = A special javscript object that joins the model with the views. Denoted by the $scope variable

--Directives =  extended HTML attributes with the prefix -ng. Has many roles, such as:
  • define a bunch of HTML (i.e., a template) to replace the directive
  • bind events to this element (or its children)
  • add/remove a class
  • change the text() value
  • watch for changes to attributes defined in the same element (actually it is the attributes' values that are watched -- these are scope properties, hence the directive watches the "model" for changes)
  • etc.



No comments:

Post a Comment