Showing posts with label skill. Show all posts
Showing posts with label skill. Show all posts

Dec 10, 2013

JavaScript typeof vs instanceof

Reading is good

And I assume almost no one reading this post would disagree that reading is good. And once you agree with that, then it follows that good books are valuable. Good books alter our thinking. Good books can be life-changing.

I have been reading Professional JavaScript for Web Developers (3rd ed). It find many little details of the JavaScript language that I almost never comes across when simply learning to code or following a tutorial or a newsletter.

Theory and Practice in the world

I suppose this is the dichotomy between theory and practice that many professionals experience, whatever their profession might be. For example, a good trader may be familiar with modern portfolio theory, and be able to outline the efficient frontier. Then, on the trading floor, find that day-to-day, she never really applies that theory or knowledge. However, there maybe a longer-term project, or a strategic shift in investment for which that knowledge may make the difference between success and failure. Likewise, when scaffolding a JavaScript app using a tool like Yeoman or Meteor, many programmers may never think about memory management or garbage collection.  Do you know how it's done in JavaScript? And how will you apply them in your application, even if you were familiar with those concepts?

We live in a world of changing contexts, between clean theoretical Platonic concepts, and a messy practical application where little details could matter, or may be totally immaterial.

It looks quirky for now - typeof and instanceof

For now, the details look very quirky to me. I'm sure it will change over time as I see other contexts, and find cases of the theory applied in practice. With that statement of faith in mind, it's time to play on the console (Using a Chrome browser, F12 key on a PC brings up the developer tool, which includes a console).

According  to the book, typeof is used to determine if a variable is a primitive type, whereas instanceof operator is used to determine the type of an Object. Here are some examples - play with other variations in your console.

typeof "anything"  // "string"
typeof 3           // "number"
typeof null        // "object"
typeof [1,2,"3"]   // "object"
typeof {}          // "object"

So, lots of things are object. Let's move on. Keep in mind that primitives are not objects.

var array = [1,2,3]
array instanceof Array    // true
array instanceof Object   // true
Array instanceof Object   // true
Array instanceof Array    // false

So, an array is an object, not an instance of another Array.

Check out other technical things I am learning on http://pleaserefactor.com/.

Jul 15, 2012

4 Kinds of people (the hacker matrix)

To win in a game, in a tournament, in life, what kind of person must you be?

I saw four kinds of people this weekend at a hackathon, this one organized by the groovy AT&T Developer Program, and sponsored by the good folks at Stackmob, Tiggzi (cloud-based mobile app builder), and Amazon AWS.  I know, I just couldn't resist the free food and the vibrant energy of the crowd that gathers at these events.

And while most of us dug into our screens to play with APIs, slap together mock-ups, and code away, I saw many other kinds of people at the event.  Let me summarize in picture:

Four Kinds of People at a Hackathon
The two axes by which I categorize people are Skill and Drive.  Note that you could use other axes, but I choose these two.

  • Lo-skill, lo-effort - You are a bystander. You came to enjoy the scene and be inspired. This is okay.  But, you walk away with an empty handed. 
  • Lo-skill, hi-effort - You are a hustler.  It is an uphill battle.  Don't give up.  (I fall into this category.)  Dreamers have to recruit additional talent (recruit = beg for help from developers).
  • Hi-skill, lo-effort - You are qualified.  Yet, without blood & sweat, you will not be in a winning team.  Have you been part of a team of smart people that never quite achieved something of significance?
  • Hi-skill, hi-effort - Winners!  As in, these people won the day and made out like bandits with real prizes!  They had the talent; they put in the hours.
No mind-blowing insight here.  But, perhaps a sobering reminder to those not in the top-right quadrant, and want to be.  So, ask yourselves these questions today:
  1. Do I have the right skills?  Enough skills?  If not, what can I do to gain those skills? 
  2. Do I have sufficient drive or am I putting in enough effort?  If not, why not?  Am I in the wrong profession?  What can I do to figure out my passion?  
Note that I used the term "Hacker," rather than winner.  I read a great article about what is a hacker?  I aspire to be more like a hacker, in my case as an example to push myself and to gain new skills that I find exhilarating and fun.

We must all find our own paths to happiness and success.  In that walk, are you a bystander?  A dreamer?  Or will you take risks and put in the effort to realize your dreams? 


Whatever the case maybe, smile and enjoy the journey!


Smiling faces of friends remind me not to take myself too seriously

// ==========
News from the event - a team of two dashing fellows presented Voicegram, a service that allows users to send voice greetings to friends and family. It's a very nice idea to keep in touch with friends.  Check them out on Twitter to stay tuned.

If you enjoyed this post, follow me on twitter @findinbay.