seanmonstar

Nov 8 2011

var that = this

I used to think say you should use that in the question “What variable should I name this for closures?” This was because self is already a variable that points to window. However, I’ve since revised my opinion on what is a good variable name in this case.

I now find that and self to be too vague.

Instead, I think the variable should be named after the Class that you are currently coding in. As always, it’s easier to explain with code:

var PackageController = new Class({

    doSomething: function() {
        var controller = this;

        someEl.addEvent('click', function(e) {
            controller.react();
        });
    }

});

The reason is because once you start delving a couple nested functions deep1, I find myself sometimes wondering if I bound that to the value I wanted. This way leaves little to wonder about. And since you read code far more than you write it, best to write the most readable code you can.


  1. I know, some of that can be solved by moving the functions to named methods on other objects, but you’d be lying if you said you never happened to have a function for a .forEach loop, and then another inside for an .addEvent, or something similar. 


Aug 4 2011

Good Things Come to Those Who Ask

Maybe you’ve heard the saying “good things come to those who wait.” That’s all well and good, but I’d like to take some time point out that good things also come to those who look for them. I changed jobs at the beginning of this year, and several people I know were curious as to how I managed it. It’s because I asked. I sought. For months.1

In and Out

Most of my professional life has been like this. At my first job, I happened to work at In’N’Out. I thought I was going to be in the service industry for the rest of my life. It was my living, and every pay raise meant more of a living. It took me 4 months to get 3 promotions. The next promotion took longer only because the skill required was much tougher. There were some other employees around me that would complain and murmur. Most of them had been working there for much longer than I had, and yet I quickly passed them by. They had no idea why I had gotten promoted so quickly.

I asked for them.

In order to get promotions, you had to work on the next skill. You had to be good at it (which only really took hard work), and you had to have a manager write up a review. You needed 4 passing reviews to be eligible for the next promotion. So every day, at a less busy hour, I would ask my manager to put me on the next station, and I would ask for a review. They would often forget to pay attention enough to give me a review, but since I would ask so often, I rather quickly gained all my reviews for each level. The other employees? They just sat around, some working hard, some hardly working, thinking that the manager would one day put them on the next position. They thought they’d get their promotions eventually, by waiting.

Entering the Tech World

Eventually, I started to wonder if I could put my programming knowledge to use in a professional way. I scoured Craigslist, and eventually found a nice listing that didn’t require me to have a degree, instead only requiring that I pass some programming challenges. I showed up and passed all the challenges. However, the CEO was busy, and didn’t pay much attention to my application status. So, I called the executive assistant of the office, and asked to remind the CEO of my application. Every day. Finally, one of those days, the assistant replied back that my persistence paid off: the CEO had considered my application, and was preparing an offer letter.

‘Expect to be a slave’

Fast forward a little, and I was at my previous company. I loved it there. The guys rock, and my job was almost always interesting. Only a few things about it killed me. It tried to be a SaaS company, and I had done a lot of work on that application. I love application development. However, since the revenue from the subscriptions revenue was growing too slowly, the company had to revert to servicing clients to pay the bills. That meant my job had largely changed from application development to brochure website CSS development. I personally find that less interesting, and the clients tend to be frustrating. At the same, while we had put a lot of work into the software platform, very few people were using it, and hardly any were appreciating it.

I spoke to someone during the summer of last year about wanting to be in a different place professionally. I had hopes and dreams about how we as a company (myself included) could focus on areas that would make us better, and have more fun at the same time. I was advised that I’m young, and I’ve got several years to go before I should expect to be at a good place. I’m in the years of having to slave away. That isn’t the first time I’ve heard such a notion.

As I left school, and headed into the working class, my father mentioned that right now I should expect to be a slave to my work, so that I could eventually be in place where I don’t have to. Friends, roommates, and colleagues have tried to pound this idea into me ever since, and I’ve just been too stubborn to believe it.

Moving On

After a severe car accident, the combination of the higher bills, my boredom, and uncertainty of my job security got me looking for a different job. I researched companies that I would love to work at, sent out resumes, customized cover letters, and did plenty of phone interviews. After several months of looking, I started to wonder if I should just stay content with what I had, because it takes a lot of effort to continuously job search.

Thankfully, I kept looking and asking, and found a new rockin’ place to work at Mozilla. I started contracting in January 2011, and hired full-time in April. I work on Add-on Builder, so my desire of making an application that many people use is satisfied. I work with very awesome people, and for a company who wants its products to be the awesomest they can be.

Don’t be afraid to ask

I don’t say all of this to brag, or say “look at me”. I want to give an example of how it is possible to get what you want. People who get what they want, get it because they aren’t quiet about wanting it. Don’t be afraid to ask about what you need to do to get to the position you want. Ask your manager what you could improve on to get a promotion. Or ask that company you’ve been eyeing to hire you. You have to assume you are a good fit for the job, and then ask for it2.


  1. What follows is a bit of life story, including only the bits where I asked and asked for something better. 

  2. It should go without saying, but I must say it anyways: you must also be hard working and decent at what you do. 


Mar 23 2011

Contextless Twitter Search

Marco outlines what’s so terrible about the Quick Bar in the Twitter for iPhone app, but it sounds more like a fair assessment of Twitter’s trending topics feature in general. The trending topics are simply words that Twitter has noticed are having an increased appearance in a short time period. Once in a good long while, when control of my wandering eyes is slacking, I see something that catches my attention in the trending topics. I click on it, curious about what all the ruckus is about. Since this ships me off to a global twitter search of the topic, I immediately scold myself and my wandering eyes. You failed me!

Twitter Search

The issue with Twitter search is that it is currently a real-time global shotgun of tweets; something I have never found useful. Most tweets are useless garbage, even tweets that I allow into my timeline. The reason I read them is for their context: I have similar interests to the people I follow, and so their short 140-character jabs make sense and sometimes even connect with me, my being. I have educated myself on many of these people, and therefore have come to enjoy seeing their tweets. When I search on Twitter, I never know any of the people whose tweets I’m barraged with, at a real time pace that no human could possibly keep up with.

Twitter search would be useful if it searched using the context of who I follow1. Only search the tweets of those “trusted” sources, and perhaps the tweets that they’ve retweeted, replied to, or maybe even favorited. These are tweets that I would care about, because if it’s information I’m after, I trust those sources to have spoken about the topic in the context of my interests. If it’s an opinion I’m after, I only want opinions of people whom I understand and can appreciate.

Google’s first attempt at using the social network’s data was with a super up-to-date widget of tweets that contained the same keywords as what you had searched Google for. Needless to say, they were a net negative, since all it served to do was frustrate and take up space in Google’s SERPs.

Google has recently started inserting web pages into the search results if that page has been tweeted by someone I follow. That is putting the context of people I vaguely know and trust, into my search results. That is something I can’t praise enough. @twitter: see @google.

Trending topics

In order for trending topics to mean anything to me, they would need to be given context, just like search should. Trending topics could be formed around all the activity of people I follow, plus the people they follow, just to get a bit more data for trending topics. For instance, log in to Twitter in the morning, and oh!, look-y there. In trending topics is how Amazon shot Lendle in the face. I would find value in that.

As it is, Twitter assumes I care what the the rest of Twitter has to say. I don’t. If I did, I would follow them.


  1. Twitter can keep its global search functionality under its Advanced search. I can see some uses, like when companies want to keep tabs on what anyone on Twitter is saying about them. It shouldn’t be the default, though. 


Feb 25 2011

Apple Wants 30% of Your Hosting Cost

Many people seem to feel like this:

I am tired of hearing non-developers whine about this move. The bottom line is that this is the best possible move consumers of iOS devices could have hoped for. […] Yes, this gives developers the shaft.

This coming from a non-developer. I think those people in favor of the new model only care that it’s easier for them to subscribe in-app. Considering that the reason people like the iOS platform is because of all the 3rd party apps, “giving the developers the shaft” is not exactly intelligent.

As Kyle Baxter puts it:

Gruber’s position is that Apple shouldn’t care, because they don’t “need” Readability. But they most assuredly do, in the aggregate; Apple needs Readability, and Pandora, and Netflix, and Instpaper, and Rdio, and all other businesses put in a precarious position by Apple’s new rules.

What many of those in favor of the policy aren’t keeping in mind is that the subscription is to pay for the entire service. For many software-as-a-service companies, the iPhone app is just a small part in their overall offering. I’m not talking about iOS-only apps. I mean applications that are merely a native client to viewing a larger web app. It costs a lot to offer all the programming, design, customer support, and hosting that they provide. Taking 30 percent for the lifetime of the customer is just greed. It’s not like it’s free to develop an iOS application, anyways. There’s already an Apple tax just to begin. You have to own an Apple computer, an iOS device to test on, and pay a yearly $100 just to be a developer.

What this policy ends up meaning to small independent developers, such as for my own project: Much of the cost is in my development time, and then the server hosting. And my application doesn’t even provide my own content, its a way to view others’ content. It’s biggest use case (in my mind) is the website. I would only consider offering an iPhone application as a nicety to iPhone owners. Since my pricing would be fair, I can’t imagine offering the services of my application for only 70% the price. In return, all Apple will have given me is a credit card processed.

With that kind of one-sided deal, I’m left with simply providing an optimized mobile site. As will many other developers. Then, iOS no longer has a bunch of exclusive content apps; they have a bunch of apps that are equally available on all modern mobile devices. What’s more, the experience will likely be better on Android and Windows Phone 7, since we can still provide native clients without being robbed.

No, I don’t need Apple. Apple needs all the developers like me.


Dec 21 2010

Oct 26 2010

Choice vs Suck It Up

On Apple’s fourth quarter earnings call, Steve Jobs took 5 minutes to try to argue against Android’s claim of being open.

We think the open versus closed argument is just a smokescreen to try and hide the real issue, which is, “What’s best for the customer – fragmented versus integrated?” […] We think this a huge strength of our approach compared to Google’s: when selling the users who want their devices to just work, we believe that integrated will trump fragmented every time.

I agree that integration is a desirable thing to have in a product I buy. And certainly, Android is having fragmentation by some having various versions, different hardware, and the like. However, to a customer, that actually doesn’t mean much. What non-geek actually cares that their Android phone has a processor from a different hardware manufacturer than their friend? None. In fact, many of the hardware companies adopting Android are bothering with their own integrated solutions. In the end, it doesn’t really matter if an Incredible has Sense UI and the new Droid X has MotoBLUR. People don’t swap phones around.

What does matter, is that since Android is open1, and these manufacturers are integrating with it, is that customers can have a choice. Apple doesn’t like choice. OK, maybe they do. They like choice that involves “Do I get the iPod Touch or the iPhone?” They absolutely hate competition. Anyone that doesn’t see that is busy oggling Jobs’ black sweater collection whenever Apple does anything to fight or remove competition.

The choice is important. Not because all customers want to sit and compare and fret over what is better. It’s important because if one of the choices starts making decisions that conflict with how the user wants to use his own gadget, he has the ability to pick another. The choice and competition, in turn, help keep companies in check with becoming too strict and overlording of their junk.


  1. Granted, it’s not as open (transparent) as some projects. But it’s open in that you can download the source yourself and roll your own version if you so choose. For free. 


Jul 30 2010

How I Name Boolean Variables

Naming variables is important stuff. Besides the classic “classes should be nouns, methods should be verbs” stuff, I find another very common naming convention I use is in naming my Booleans.

Particulary, I like to name them so they are a question. You can read the name of the variable, and feel you were asking a question about some object. And the question must be a yes/no question for it to work. No howAreYou variables. I make sure that it truly does sound like a question. I don’t like using single word adjectives or adverbs, like running or recommends. I’ll add is or has to make it sound like a question.

Some examples:

server.isRunning
book.isRecommended
dog.canBark
table.shouldReplace

It’s much easier to tell by looking at them that they are boolean values. Whereas, something like item.likes could actually be a number, of how many people liked the item. item.isLiked tells me that something liked the item. It’s going to be a yes or no answer to my boolean question.


Jun 24 2010

Page 1 of 3