Thursday, October 13, 2011

New Pandora

Any time a product is changed in a big way, there will be a certain percentage of loud users who don't like the change, but the product designers--usually--rightfully follow the same instincts that lead them to redesign in the first place, and the nay-sayers are (politely) ignored.  I'm finally one of the nay-sayers!

I've been a happy and paying Pandora customer for years.  I've discovered new bands, gone to unexpected concerts, and made unexpected friends at those concerts.  It has affected my life consistently, positively, and non-trivially.

I'm just frustrated with "#NewPandora".  There are basic requests and complaints that I have made and heard from other users year after year: What if we could make instrumental-only stations?  Or vocal-only stations?  What if we could add upvotes & downvotes to any song at any time, without having to wait for it to play?  Stations tend to play 4-song blocks of similar music.  What if we could see those blocks and skip over them if we don't like the aspects which chose them?  What if we could pick and choose which Music Genome Project traits went into a station, allowing fine-tuned customization?  What if we could scrobble our plays?

I'm not saying that any of these features necessarily should exist.  Pandora is an admirably simple product.  Obviously, if they implemented all (or even half) of the ideas in the above paragraph, it's likely that it would be a mess.  Part of Pandora's beauty is that there aren't half a million things you can do.  The "verbs" available have an attractive economy to them: you create stations.  You upvote, you downvote.  Sometimes you skip or snooze a song.  That's it.

So what's the problem?

Over the past few years, I have seen Pandora roll out new projects with great fanfare.  Pandora One.  The desktop player.  Mobile apps.  And now "New Pandora".  What bugs me is that they make huge deals out of inevitably expected changes, and then they don't iterate!  The desktop player and mobile apps are still subject to almost the exact same flaws I experienced when I first started using them.  Every time I pause the desktop player at the end of the day and come back tomorrow to resume, the track cuts off and I get a "Pandora is having trouble connecting to the internet, please click 'Retry' to try again" message.  It's like clockwork.  Why does it do that?  Every time I want to move a song to a different station on the mobile app, I can't.  It's not a feature of the Android app.  Why can't I do that?

Instead we get New Pandora.  Look, this is just a crotchety rant from an over-entitled user.  Pandora doesn't owe me anything, and I know that.  And New Pandora is great.  You can click around the site without having to open new windows or wait for a flash loader to finish.  But I still have to scramble to hit "Pause" when I open it while the desktop player is already going.  And apparently now I can't bookmark stuff.  They changed the meaning of the features: "Thumbs Up" doesn't just mean "this song is good for this station" anymore.  It also (apparently) means "bookmark".  That's not what I used bookmarks for.  I used bookmarks when I heard a song that really resonated with me, that I wanted to check out later.  Hell, sometimes I downvoted a song and then bookmarked it, because I liked it but it wasn't appropriate for the station!  (On the mobile app, that's the closest you can get to "move to another station".)  It wasn't broken--why did they try to fix it?

There are so many cool things Pandora could be doing with their product.  If they had implemented just one of the inane features I listed above in the past however-many-years I've been a listener, I probably wouldn't feel the need to rant like this.  But they just don't seem to be interested in really doing anything novel with their service.  Instead they just want to keep obsessively polishing the same thing over and over again.  I just don't get it.

Thursday, October 6, 2011

Tough Jobs



"As he liked to say, he lived at the intersection of technology and liberal arts."
-- Walt Mossberg, The Steve Jobs I Knew

I'm not an Apple guy.  Never have been.  I grew up in the age of the clunky DuoDock, not the hacker-beloved Apple II.  Until a couple of months ago, I have never owned an Apple product, and I finally purchased one with great skepticism.  iTunes, iPods, iPhones, iPads, Steve Jobs himself, and the whole cocaine-white Apple aesthetic have been frequent targets of mockery in my conversations with friends and colleagues for a long time.


If you had asked me yesterday evening, "How will you feel when Steve Jobs dies?", I would probably have answered with something like, "Well, I'd feel like Apple lost a great innovator."  Jobs was never someone who I considered an inspiration for myself.  Mostly I was just annoyed that I had to deal with his fan club.

A funny thing happened when he died, though.

"Remembering that I'll be dead soon is the most important tool I've ever encountered to help me make the big choices in life. Because almost everything — all external expectations, all pride, all fear of embarrassment or failure - these things just fall away in the face of death, leaving only what is truly important. Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose. You are already naked. There is no reason not to follow your heart."
-- Steve Jobs, June 12th 2005 Stanford commencement speech (Text) (Video)

When I heard that Steve Jobs died, I was sad.  Mournful, even.  

In the interest of full disclosure, let me get this out of the way right now: I am a total softie.  I cry at movies (looking at you, Up--thanks, Steve) and sometimes at books, too.  As I flipped through quotes, anecdotes, sound bites and artifacts from his life that rose up like crunchy leaves in an autumn zephyr, I was deeply moved.  I literally shed a tear for the man.  "Maybe it's just me," I thought, "or low blood sugar."  But the more I saw of other people's commentary, the more I realized I wasn't the only one.

What was going on?

It's not like I knew the guy.  I've never met him.  I've never even seen him in the flesh!  I had never been so emotionally moved by a celebrity's death before.  So why the sorrow?

Emotions are usually too complex to draw concrete conclusions about them.  I think that is true in this case.  I don't presume to understand the vicissitudes of my own irrationality, but I believe that there is value in examining the mystery.  I have no point to make: my goal is to explore, which tends to raise two questions for every answer it provides.  I'm okay with that.

Emotions are driven by perspective.

"A walk outside in nature: something I can heartily recommend all the folk stoking up their teenage emotion tsunami while swamping [this site] with endless Steve tributes."
-- pseuds_corner, Hacker News discussion

Some conflict is inevitable in the wake of any event like this.  Emotionally, we are all at different points in our lives.  We are all different people, and different things resonate with us.  The sorrow is mysterious by itself, but what about the ensuing backlash?

"I find the outpouring of grief repetitive at best and embarrassing at worst. It's the time of year for everyone to strut out their favourite Steve stories and anecdotes. Gotta tell everyone how you feel.  ... I'm confident 99% of commenters didn't know Steve Jobs personally. If his death is difficult for them, it's a problem they themselves have created."
-- jarek, Hacker News discussion

Now there's an interesting perspective: is Steve Jobs' death a problem for me?  No.  I'm okay with feeling sad for a day or two.  Consolation from friends is not required; my life has not been thrown off-balance in any way.  Though its intensity is a surprise to me, I view my melancholy as a natural part of my existence, just like feeling upbeat after a good comedy film or reflective after a thought-provoking book.

So perhaps that's where wires are being crossed: I don't know many people who profess to have a problem processing Steve Jobs' death, but maybe the outpouring of grief is interpreted by the emotionally unaffected as an imposition.

Of course, it is an imposition, even if the solemn masses aren't explicitly asking for help.  Social sites are filled with everyone's favorite Steve stories and anecdotes; it's impossible to ignore.  If you're just not feeling the love, it's probably easy to feel excluded.  I have felt that way with every other celebrity death.  As my Twitter and Facebook feeds clogged with expressions of grief, I sighed with disdain and pointedly avoided comment.

There's an implied judgment in this conflict: you shouldn't feel that way, or at the very least, you shouldn't burden others with expressions of that feeling.  We have accepted different answers to the question, "Is it reasonable--acceptable--to feel sorrow at the death of this person?"

It leads me to wonder: if I didn't feel this way about Steve Jobs--if I didn't understand--would I feel the same sense of flippancy or judgment?  Would I be restraining myself from typing, "Just get over it, Apple fanboys"?

Probably.

We rarely have perspective on our own perspectives.  You'd need transparent eyeballs for a trick like that.  Instead, preoccupation comes naturally to us, pre-packaged with an iniquity perfectly scaled to fit our situation.

Isn't it indulgent, then, to commiserate over the loss of one man, when other events--equally or more important--are still coming at us full-speed?  What about Fred?  What about the other 99%?

I don't know.

"Your time is limited, so don't waste it living someone else's life. Don't be trapped by dogma — which is living with the results of other people's thinking. Don't let the noise of others' opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary."
-- Steve Jobs

So where did the emotion come from?  Is it grief over loss?  If so, what did we lose, really?  Is it disappointment that we'll never get to meet him?  Or is it something else?


"I am truly surprised at how sad I am. Even if I disagreed on some of the decisions made by Apple... he was to me the most inspirational man alive. What a devastating loss."
-- abstractwater, Hacker News discussion

Apple put a memorial portrait of Jobs on their site, with the filename "t_hero.png".  When this was initially pointed out to me, minutes after hearing of his passing, I was moved nearly to tears.  "Such succinct poignance," I thought.  I later discovered that "hero" is a common term for the best photograph from a given shoot.

(In the industry, we call this "the art of self-trolling").

"Being the richest man in the cemetery doesn't matter to me ... Going to bed at night, saying we've done something wonderful... that's what matters to me."
-- Inscription on Steve Jobs' star at the Entrepreneur Walk of Fame in Cambridge, Mass.

Beyond his legacy as a businessman and designer are the aspects of Jobs' personality that we witnessed over the years.  This is the guy who nurtured a corporate culture that famously flipped off AT&T.  Developers and designers trade stories of his obsessive attention to detail and dogged pursuit of what seemed to be the Platonic ideal of each product, visible only to him.  His products are famous for their immaculate appearance, and he delivered keynotes about them to thousands of viewers while wearing grass-stained sneakers.  He is remembered with fondness and respect by everyone from Bill Gates and Sergey Brin to Barack Obama.  News of his death made it to the homepages of Amazon,  Microsoft, and even Google.  

"They are linking to the home page of Android's competitor. Google's statement says this event transcends money, transcends business, transcends all rational thought.

Observe a moment of silence and reflect. We all lost a great man whose vision changed everything - I just smile a little at the comments from people who say Steve Jobs didn't affect their life, because they don't carry an iPhone, or because they are a DIY guy, or because anything else. You didn't have to own an iDevice to have been touched by Steve Jobs - you lived in a world in which he tinted every facet of technology with his genius."
-- andrewljohnson, Hacker News discussion

All of this, for a guy almost universally mocked and criticized for his stubbornness and need for fine-grained control over every aspect of his company.  And indeed, saying you are unaffected by Steve Jobs because you don't use Apple products is like saying you are unaffected by 9/11 because you didn't live in Manhattan.  So I ask again: Where did the wave of sadness felt by so many come from?  The ripples of Steve Jobs' influence will resonate through our world for decades to come.  Perhaps the sorrow is a sensitivity to the loss of a great ripple-maker.

"Didn't know it was possible to feel so sad by the death of non-family/friend. RIP Steve. Am lucky to have lived in your era."
-- pyUser, Hacker News discussion

As I mull over everything I know about the guy, a few thoughts occur to me.  For one thing:

Steve Jobs inspires me far more than I ever gave him credit for.

"Here’s to the crazy ones. The misfits. The rebels. The troublemakers. The round pegs in the square holes. The ones who see things differently. They’re not fond of rules. And they have no respect for the status quo. You can quote them, disagree with them, glorify or vilify them. About the only thing you can’t do is ignore them. Because they change things. They push the human race forward. And while some may see them as the crazy ones, we see genius. Because the people who are crazy enough to think they can change the world, are the ones who do."
-- Apple's "Think Different" poster

Steve Jobs changed the world in a big way.  You don't need to affect as many people as he has to change the world, but it's still thrilling and scary to view your actions from that angle.  I think a lot of people have presumed to use just such an angle to evaluate themselves; on occasion, I certainly have.
Considering the sum of Steve Jobs' achievements and legacy, I find myself aspiring to be like him; to devote myself to doing what feels right the way he did, to change the world with every opportunity, just like him.  Maybe, just maybe, a lot of us identify with him far more than we ever realized, and this jarring reminder of his mortality forced us to look at him differently: he wasn't a mythical legend with supernatural charisma and design sensibilities.  He wasn't a flawless paragon of everything good in the world.  He wasn't just a CEO on the stage, or a designer, or a developer.  He was a human with a dream, with a birth and a death, just like us.

The only thing separating us from him is time.

"I want to make a ding in the universe."
-- Steve Jobs

Monday, August 8, 2011

method_missing considered harmful

method_missing has many downsides:

  1. Your objects won't answer correctly when introspected with respond_to?, unless you override that too.
  2. Users of your code will not be able to see available methods when introspecting with Object#methods. This has the additional penalty of breaking tab completion in irb.
  3. Your objects are now hostile to being used with inheritance and mixins.

It's better to explicitly create the methods you want using metaprogramming.

class Foo

  ["one", "two", "three"].each do |num|
    define_method "action_#{num}".to_sym do
      puts "Now performing action #{num}!"
    end
  end

end

Now we can sensibly introspect into this object.

ruby-1.8.7-p334 :001 > f = Foo.new
 => #<Foo:0xb77b2408> 
ruby-1.8.7-p334 :002 > f.methods - Object.methods
 => ["action_one", "action_two", "action_three"] 

Don't use method_missing to do metaprogramming. It's like writing an entire website in the 404-handler of a web framework.

Friday, August 5, 2011

Start developing for OS X in just 68 easy steps

My Goal: Get "tmux", my preferred terminal window manager, to run on my new Macbook Air.  I am told that the correct way to get basic development dependencies on an Apple machine is to install Xcode.  I have never purchased or consistently used an Apple product before.
  1. Go to Apple.com.
  2. Click "Buy Now" after configuring my new Air.
  3. Create an Apple ID username & password.
  4. Get a login prompt.
  5. Enter my Apple ID username & password.
  6. Enter my full name and address.
  7. Enter my payment information.
  8. Confirm payment.  Wait for the laptop to arrive by Fedex.  Admire the minimalistic box, and the frankly incredible fact that they put the optional video adapters INSIDE the vacuum-sealed box, neatly nestled in a nook beneath the manual.
  9. Turn on my new Air and go through the setup process.
  10. Enter my Apple ID username & password.
  11. Open the app store and type "Xcode" into the search box.
  12. Click "Buy Now" on Xcode and get a "Login" dialog at the top of the App Store app.
  13. Enter my Apple ID username & password.
  14. Get a popup: "This Apple ID has not been set up for use with the App Store.  Please go to your Apple ID account page and enter the required information."
  15. Click the link in the popup, which opens the Apple ID Account site in my browser.
  16. Enter my Apple ID username & password.
  17. "An unknown error occurred."
  18. Refresh the page.  The username & password input boxes are now gone.
  19. Copy & paste the URL into another browser.
  20. Still no input boxes.
  21. Clear my internet cache and refresh the page.
  22. Still no input boxes.
  23. Google "Apple ID Account" and click the first result.  Now the boxes are back.
  24. Enter my Apple ID username & password.
  25. Accept the terms of service.
  26. Enter my full name and address.
  27. Enter my payment information.
  28. Get a confirmation dialog.  Go back to the App Store app.
  29. Type "Xcode" into the app store search box.
  30. Click "Buy Now" and get a "Login" dialog at the top.
  31. Enter my Apple ID username & password.
  32. Get a popup: "This Apple ID has not been used with the App Store before.  Please enter the required information."
  33. Accept the terms of service.
  34. Enter my payment information.
  35. Get a confirmation dialog.  I am sent back to the App Store search results screen.
  36. Click "Buy Now" and get a "Login" dialog at the top.
  37. Enter my Apple ID username & password.
  38. The download begins.
  39. Leave the computer to complete the ~4GB download overnight.
  40. Come back in the morning.  The computer went to sleep and stopped downloading.
  41. Restart the download.  It finishes downloading.
  42. The Xcode app store icon now reads "Installed".
  43. Go to the mac "homebrew" website.
  44. Run the installation script, which produces an "Xcode is not installed!" warning.
  45. Ignore the warning because I just installed Xcode.  Run "brew install tmux"
  46. Get an "Xcode is not installed!  No such file or directory: /usr/bin/cc" warning.
  47. Run "which cc", no results.
  48. Run "which gcc", no results.
  49. Google "homebrew 'xcode is not installed'".
  50. Google "homebrew not detecting xcode".
  51. Google "os x lion homebrew".
  52. Ask in the "#machomebrew" IRC channel on freenode.
  53. Decide to open Xcode and figure out where it thinks cc is.  Do a spotlight search for "xcode"
  54. See an "Install Xcode" entry, but no "Xcode" entry.
  55. Click "Install Xcode".
  56. Accept the terms and conditions.
  57. The installer sends me to the Apple ID Account page.
  58. Accept the terms and conditions.
  59. The Apple ID website asks me for more information so I can register as a developer.
  60. Enter "asdofhasdgoasdg" for my "Organization", because it's a required field and this is a personal laptop.
  61. Choose my primary industry.  "Software" and "B2B" aren't on there.  (I think I picked "Agriculture".)
  62. Choose what kind of apps I'm going to develop.
  63. Check the confirmation e-mail in my inbox.
  64. Copy & paste the confirmation code into the input form.
  65. Get a confirmation dialog.  Go back to the Xcode installer.
  66. It spends a few minutes installing.
  67. Run "brew install tmux".
  68. Run "tmux" and have a beer.

Tuesday, June 14, 2011

When One Teaches, Two Learn

One of my favorite phrases is "when one teaches, two learn". There are lots of ways to interpret it, but one day I discovered that it can sometimes be applied quite literally.

Every once in a while I manage to convince one of my (incredibly patient) friends to let me teach them binary. Sometimes I have to bribe them with a couple of beers, but they all break eventually. Binary is a good "bite-sized" lesson that can be fully expressed and understood in less than an hour, and it poses some basic challenges for the educator. Since my day job involves very little direct pedagogy, I try to inflict it on my hapless acquaintances and loved ones to keep myself from getting rusty. (And to keep them on their toes.) Also, you will get a full range of enthusiasm in students, from "budding computer person who can't wait to find out" to "couldn't care less about this dumb math thing"; each extreme and everything inbetween subtly changes how the lesson will go.

One of the first steps towards learning binary is understanding some things about our own number system, decimal (or "base 10"), which we usually take for granted. Everyone knows that decimal numbers are expressed with 10 symbols (0 to 9) that represent bigger quantities the further they appear to the left in a given number. That is, a 9 in the "ones" column just means 9, while a 9 in the "hundreds" column means 900.

The way we get the value of these "columns" ("ones", "tens", "hundreds") is by counting how many positions to the left we have gone, and raising our "base number" to that power. Decimal is base ten, so the "tens" column is 10^1, the "hundreds" is 10^2, and so on.

But what about the first column? We actually start counting from 0, and anything to the zero power is 1. That's why the first column is always the "ones" column, no matter what number system we're in.

At this point in the lesson, my friend turned to me and said, "Why?"

I stopped in my tracks. "Why what?"

"You said 'anything to the zero power is 1'. Why is that?"

Suddenly, for whatever reason, I attained momentary insight into the inner workings of my brain. I felt my next sentence before it started to come out. I wanted to say, "Well, that's just how it works." Because that is just how it works. Right? I'm teaching, here! I'm supposed to have an answer, damn it. I'm supposed to know everything! I don't have a better answer, so the answer must be "That's just how it works."

Thankfully, that's not what I said. Thankfully, my ego blinked or sneezed or got distracted by something shiny, and released its grip on my self-delusional cognitive faculties just long enough for me to answer my friend honestly:

"I have absolutely no idea whatsoever."

Neither of us were satisfied with that answer, so we immediately opened up Wikipedia and went to the entry on exponentiation (of course, we searched for "power" and went from there, because who remembers a word like "exponentiation"?). The proof in the article didn't immediately click with us, but we clicked through to the linked article on empty products, and hailed the miraculous existence of the "Intuitive justification" section. When we both followed its mental example of a multiplication-only calculator that had to display a number when you hit "CLEAR", the reasoning for anything-to-the-zero-power being 1 made perfect sense to both of us, and helped us understand the original article's proof as well. We then continued with our original lesson.

When one teaches, two learn.

Friday, May 13, 2011

Do what you love, but don't be a bum

Marc Randolph, former CEO of Netflix, wrote today about "the spin". He contends that the line between "honest marketing" and "dishonest marketing" is determined by the boundaries of the marketer's own beliefs. He also touches on the subtle "anti-hucksterism" bias that is particularly noticeable in some parts of the software/startup world, offering his own belief instead, which is that marketing & product can only coexist: they need each other. I agree; ten thousand times, I agree!

All creative people--hackers, writers, painters--are tempted to engage in the conceit of "marketing avoidance". It is so easy, and feels so brave, to challenge the efficacy of such an enormous field: "Build it and they will come," we say! "Good ideas sell themselves!"

If only it were that simple.

Tuesday, May 10, 2011

Storing Hierarchical Relational Data with Nested Sets

Recently I have been working on a simple discussion board app. I decided to make replies hierarchical instead of linear, which is how most popular apps like phpBB and vBulletin do it.

Consider a post and a reply:

  • We may experience some slight turbulence and then explode.
    • I don't wanna explode!

Oracle gives us the handy "START WITH" and "CONNECT BY" clauses, which allow us to store our data like so:

ID Body Parent
1 We may experience some slight turbulence and then explode. NULL
2 I don't wanna explode! 1

This data is easy to update, but we have to rely on the special SQL functions to query it meaningfully. The official term for this model is an adjacency list.

I have to keep my hippy license somehow, so I decided against Oracle for my forum app. I went instead with SQLite, since I hadn't really worked with it before. At first I was dismayed to find that no such recursive query functions existed, but there is another clever way of representing a tree in relational data called nested sets.