Sunday, February 2, 2014

How can SpaceX be so cheap?

I had the opportunity to ask Gwynne Shotwell, the president of SpaceX, how they could be so much cheaper than their competition.  Her response was pretty simple: vertical integration.  

Vertical integration is a fancy way of saying SpaceX does everything in-house while other companies use contractors.  Since each contractor needs a profit on their part, the true cost of everything gets marked up.  Her rough math was if each contractor needs 30% profit on each project, and you do that 4-5 times, you end up with something that costs 3 times more.  Currently, SpaceX is roughly 3 times cheaper than other rocket companies.

The first question I asked myself is why no one has done this before.  It’s pretty clear why it’s difficult for someone to start a company to do the same thing.  Starting a space company is really capital intensive - Elon Musk put in $100 MM of his own money.  In addition, NASA was in a time where it had retired its shuttle program and wanted some way to continue missions to the international space station.  As a result, they came up with programs to award missions to commercial companies. 

But what about existing launch services providers (aka. rocket companies) like United Launch Alliance or Orbital Sciences?  These are the companies who currently launch most US government satellites (for example, for the US Air Force and National Reconnaissance Office). Couldn’t they vertically integrate everything and get huge cost savings? 

It seems there are several strong reasons why they would not have.  

First and perhaps more importantly, these providers are not incentivized to lower price.  Government purchases launches generally on a cost plus basis, that means they pay what it costs the provider to make the rocket plus a bit more (say 30%) to allow for profit margin.  The perverse thing here is the higher the cost, the higher the absolute profit (in dollars) for the provider.  At the very least, there isn't an incentive for lowering the cost.

Second, investing in building capabilities in house is hard and expensive.  It is hard to be an expert in everything.  For example, in the world of personal computers you have Intel building processors, Rambus making memory, and Dell marketing and selling the computer.  These companies have specialized at what they are good at.  Similarly, United Launch Alliance might not want to become an expert at building their own rocket engines - they can buy them from Rocketdyne or another such company.

Finally, no other launch provider has succeeded as a vertically integrated company in the past.  Thus, there is no evidence that what SpaceX did was actually going to work.  As companies with a stable business and a responsibility to their shareholders, it may have been seen as irresponsible to decide to vertically integrate everything.  

Put another way, imagine you are making a decision for United Launch Alliance on whether to outsource a part.  For the last few decades, engines have always been contracted out, you have done analysis which says building engines in-house will require a ton of investment and may take years to figure out, and, what's more, no one has ever succeeded in making money by building them in house.  Would you tell your boss that you think it's a good idea to build engines in house?  It would take someone rather insane to do so.

Saturday, November 30, 2013

What was it like to learn how to code?

About a year and a half ago, I seriously started learning how to code.  I had no formal training, but had picked up some programming knowledge since graduating from undergrad.  Now in business school, I had the idea that I could program a game instead of a normal summer internship.  I'd learn more about technology, put my previous gaming experience to use, and might even make a few dollars.

I remember visiting a friend's gaming startup.  One of the engineers asked me what I planned to do over the summer.  I - hesitantly, I'm sure - answered that I was going to create my own simple tactical RPG. But oh, by the way, I didn't even know how to code.  I was learning as I went along.  He looked at me like I was crazy.

But the thing is - I did it!  I built Solarian Tactics on a shoestring budget and actually shipped something.  This summer, I released a sequel of sorts, Sol Heroes, based on my learnings from the first experience.  Tens of thousands of people have played my games.  And while it's nothing compared to what we would have considered a success when I was at Playfish, sometimes I am still shocked to think that more people have touched this product I made than I will probably get to know in my entire life.

So how does it feel to have my year and half of coding experience?

Mostly it feels like I am doing something wrong.
I always have this nagging feeling that I am doing something wrong.  In the beginning, I had some amazingly ignorant comments in my code like //What is an instance variable?

But even now, I sometimes worry that the entire architecture of my game is fundamentally screwed up or that I have misunderstood something all this time.

When someone asks me how I wrote the artificial intelligence for my game, I still chuckle to myself.  To me, I felt like I wrote some horribly inefficient code and plugged in some probably stupid variables, not something that I can dare call an "AI algorithm."

I fought a lot more with libraries than I expected
I used an open source framework, Cocos2D, to help run my game.  There were a lot of questions I had that I couldn't easily find the answer for - could I use Cocos2D with storyboards? Does it make sense to use CCBatchNode when I just have 10 sprites?  I was simultaneously shocked that the documentation could be so bad, and amazingly thankful that someone took the time to make the framework available to me free of charge.

There was a time when Sol Heroes was crashing more than once a day for each user it had. Someone left a review of my app with the title "Terrible Coding" and I felt my users had finally figured me out.  The issues turned out to be related to how I misunderstood Cocos2D.  And I felt I spent days searching Google and Stack Overflow for my obscure error.  It didn't feel productive at all - I wasn't writing any code and I also wasn't learning something useful about the library.  I just went down different rabbit holes hoping the problem went away.  I finally fixed that particular problem - and I'll leave this graph here since I'm damn proud of it - but it was painful.

It was times when I could just write code that I felt most productive - for example, ironically, the "AI Algorithm" that I created.

I'm afraid of updating anything
In this last year, I learned to be afraid when updating anything (I suspect "real programmers" would not feel this way).   For example, I updated my iPhone to iOS 7 when it came out.  This simple change led to a series of pain.  First, I realized that I could no longer test my game on my phone through Xcode.  I had to update Xcode.  So I went ahead and tried to do that.  I realized I had to pay $20 for the Mountain Lion upgrade to my Mac OS before I could update Xcode.  I paid and upgraded to Mountain Lion.  Now, I updated to Xcode 5.  Unfortunately, Xcode 5 is really meant to only work with iOS 7.  My whole games UI was based on iOS 6.  So I had to look up some clever ways to support both iOS 6 and 7 on StackOverflow.  Okay, now that I did that, I realized iOS 7 displays fonts differently than iOS 6, so I needed a solution to that... and it went on and on.

It's satisfying to ship something
Despite all of these hiccups, I had a great time making these games.  It was satisfying to have an idea of what feature I want to make and then just be able to make it.  I could see feedback from users, good or bad, once it was released.  It is fun to open up my iPhone and show people what I made.

If I step back, it was satisfying not just release games, but to take on a big technical challenge like learning how to code a game without any experience.  A part of me never thought I could actually actually do it (though I obviously decided to try!).  And I think I demystified for myself a lot of what it means to program something.

Overall, I expect in the future I'll be less afraid to tackle new technical challenges.