LooselyTyped

(map blog thoughts)

On Making a Better iPhone Home Screen

Considering the little computers that we carry around in our pockets (or purses) all day help us with our email, internet access, personal GPS recorder, social networking, (very) personal journals and once in a while also act as a phone, it makes sense for us to want to protect all that data. The easiest way to keep our phones from prying eyes is to switch on the passcode functionality.

Of course this presents itself as a Catch-22. On one hand we know if we were to forget our phone at a coffee shop or a public library (or even worse lose our phone), it would prevent someone from getting to know pretty much everything there is to know about us. On the other hand it also prevents a good Samaritan from returning the phone to us in the event they find it.

Furthermore, locking the phone also obstructs emergency services from getting a contact person in the event of an unfortunate accident.

So what does one do?

On Prototypal Inheritance - Part II

This is an article I wrote for NFJS, The Magazine’s April, 2012 issue. This is a 2-part series, this being the second one. You can find the first one here.

In the first installment of this series, we discussed objects and functions in JavaScript. In this second, and final, installment in this series, we will go a bit further and see how functions are used as “instance factories” or constructors to create objects. We will see how we can use these “constructors” to not only instantiate new instances, but also endow new objects with a predefined set of properties applicable to that “class” of objects (much like Java classes). Finally, we will put it all together to build our own hierarchy. We will also see some potential potholes and how to avoid them in your code.

On Prototypal Inheritance

This is an article I wrote for NFJS, The Magazine’s April, 2012 issue. This is a 2-part series, this being the first one – I will post the second one soon. Stay tuned!

Douglas Crockford refers to JavaScript as “Lisp in C’s Clothing” which gives us an inkling to it’s true power. Unfortunately JavaScript, a language that started with a rushed schedule to production and a specification that was buffeted with strong political winds at it’s inception, has often been “misunderstood”. Despite it’s unfortunate beginnings, amidst the stormy waters laden with many a pitfall like global variables, lie a few pearls of wisdom, of which one is prototypal inheritance. In this 2-series article we will take a deep dive into JavaScript’s prototypal nature – we will see how it works, and more importantly how we, as JavaScript developers can leverage it. We will take it a step further to see how we can develop our own hierarchies to model our code, allowing for better reuse.