Wednesday, October 29, 2008

EclipseWorld

This week I have been speaking at EclipseWorld in Reston, VA. I have been talking about Ruby on Rails mostly, and a little session on iPhone (web) development. Most of the developer here are Java developers, so they look at Rails as a way to make their jobs easier. It's a grim economy, and they are being given the classic task of doing more with less. They look at Ruby on Rails as a way to do just that. More features. Less code. Happier developers!

EclipseWorld has been a great conference to speak at. What has been very cool for me is interacting with developers outside of Silicon Valley. Now don't get me wrong, if you are a developer, especially a web developer, then Silicon Valley is the place you want to be. I would compare it to working on Wall Street if you are in finance, or working in Hollywood if you are in show business. It's not for everybody, but it presents the chance to prove that you've got what it takes, and, if you are lucky, a chance to make a lot of money.

However, in the Valley it is easy to forget that most web development is not about creating The Next Big Thing. In the Valley, @tychay will rip you up for using Rails because it fails at web scale. On the east coast, I have met a lot of developers creating internal web applications, or maybe customer service applications. These are applications that can run just fine a single multi-core box, even with the database running on the same machine. They aren't stressing out over page weight, database partitioning, or terabytes of cache. They are creating sophisticated applications, and always have way more feature requests than they have time.

These are the people who are most empowered by tools, especially Eclipse. They don't have some huge team with specialists for doing the CSS or tuning the database. They do it all themselves, and Eclipse makes that a whole lot easier. I've written a lot about things you can do with Eclipse, but this experience has really put things into better perspective.

Wednesday, October 22, 2008

AjaxWorld 2008

AjaxWorld was this week, and it was interesting. I think the down economy is having an affect on everyone, but there were still a lot of interesting things to learn about. On Monday, I did a talk on a favorite topic of mine, networked applications. The talk was a lot of fun, hopefully the audience would agree with that assessment. Overall though, I would say there were a couple of major themes at AjaxWorld this year.

1.) Comet. There were a lot of talks about some form of data push from the server to the browser. Kevin Nilson did a nice job of differentiating Ajax (infinite loop of XHR polls) vs. Comet (long poll.) The folks at ICEFaces have built some nice abstractions on top of Comet. There was also a lot of interest around WebSockets, especially the work by the folks at Kaazing. A duplexed socket connection to the server sounds great on paper. I think there will be some very interesting technologies that grow around that.

2.) Don't make me learn JavaScript! There seemed to be a lot of folks advocating the "only know one language" approach to the web. In most cases that language was NOT JavaScript (even though the Jaxer guys say it can be.) Vendors liked Oracle and ICEFaces preached abstractions that shielded the developer from JavaScript. Of course the GWT folks say do everything in Java. Microsoft says use Silverlight so you can do everything in C#. Of course one of the best sessions was by Doug Crockford who told everyone to man up and learn JavaScript. I tend to agree with Crockford, even though I prefer ActionScript...

Wednesday, October 15, 2008

Recession and The Valley

Are you a programmer who recently moved to Silicon Valley? Are you nervous about what things will be like now that the greater economy has gone pear shape? Then listed to this old man tell you all about his experiences in the last recession in the Valley.

I moved to the Bay Area in 2000, right as the last great recession was getting started. Like this recession, it was happening in an election year and it really hurt the incumbent party. I started off working at a very small start-up in San Francisco called InternetElements. They had a cool idea. Allow any bank or even large organization provide the tools to their members to buy and sell stocks. Remember that back then the stock market was really hot, much more so than it has gotten in the last few years. New companies sprung up all the time and went IPO. Everybody bought into the IPO and made crazy money. It was great.

Anyways, once the stock market started tanking and IPOs disappeared, nobody had much stomach for InternetElements' idea. I was employee #4 there. Our CEO basically told us that we had cash in the bank to make payroll up until a certain date. This was about a month before that date. There were talks going on to get us either some more money or do a merger with another company that had more money, but neither of those worked out.

I started looking for a new job. This was fall of 2000, so things weren't too bad just yet. I didn't have much experience, but I had a degree from a (among the tech world) well known school. So that opened doors for me. I found a new job two weeks before the old one was set to die, and started at the new one on the Monday after InteretElements stopped promising to make payroll. The two founders of the company continued on trying to salvage their company, but there were no hard feelings at all.

My next company was called RMX. I would work there for the next two years. It was also a start-up, but was sort of a spin-off from Chevron. I was there throughout the recession. When I first started, we were expanding pretty quickly. They had hired a lot of consultants to build the initial site and needed to replace them with full-time employees. There was also a grand vision of a big company with an large and intricate org chart.

That vision died pretty quick. Soon the hiring stopped, and then some layoffs started. Tech companies everywhere were struggling. We knew there would be no additional rounds of funding. So we had to become profitable to sustain ourselves. Our management were great. They explained everything in detail at all times. We met as a company every Friday morning. Management talked about how much money we had in the bank, what our burn rate was, and what kind of sales prospects we had.

We worked really hard at RMX. We closed deals with new customers. We drastically cut costs by replacing licensed software with either open-source or in-house built software. By the spring of 2002 we were profitable with about $4M in the bank still. Everybody felt pretty good about themselves. We had survived the recession, even when it got amplified by the aftermath of 9/11. Or so we thought...

In May of 2002, our board of directors voted to shut us down. The reasoning? Even though we were profitable, the recession had changed the landscape they thought. Our ceiling was much lower, even though our risk was also now very low. We weren't a worth investment, so decided to liquidate us.

Half of the company was laid off within a week of that. The other half was kept around. We had customers and contracts with those customers that required us to help them transition to not using our service. Basically each customer got a copy of our code so they could run our service for themselves, on their own hardware. So all of the engineering folks were needed for the transition, but obviously sales and marketing folks were not.

Everybody laid off got one month's pay as severance. Everybody who was not laid off and staid until the end got one month's pay severance, and got a bonus for staying to the end. I was one of those folks. It was a pretty good deal in some ways. I had a job, while it was understood that I would look for a new job. However it was pretty depressing. Half the folks in the company were gone, including a lot of friends. Everybody still working knew their own end was in sight. The closer it got, the more stress people felt.

I wound up staying until the very end. We had a big party on the last day. It was nice, but it was pretty upsetting for me. After two years with a start-up, I had a lot of emotional investment. I was too shook up by it to even say proper good-byes to everyone.

The next week I went on unemployment! I had COBRA papers ready to file when my health insurance ran out. And I did a lot of job hunting. I felt a lot of desperation to find a new job and took the first offer that came my way. That was a mistake in hindsight. I wound up only going one week without a job.

The new job was a contract and it was doing code in C#. I was intrigued about learning a new language, as I had only done Java, Perl, and a little C++ previously. I was a total gun-for-hire at this job, and I was not used to that. I had been an integral part of a start-up for the three years prior to that, and I did not adjust well. Luckily after four months, I found a job at Yet Another Startup: KeepMedia, now MyWire.

The worst of the recession was over in 2003, but things were not peachy. I started working at KeepMedia in February and we launched that summer. It was a great company, and I was back in the kind of role I liked. Things did not take off like we wanted. I think that had more to do with the business plan then the economy, but who knows. We never had any layoffs or anything like that there. But we did everything on the cheap, and I do mean cheap. Our biggest expense was an Oracle database. We were scared to put people's credit card numbers in a MySQL database.

Anyways, that was an interesting experience too. It was a stat-up that started in a recession. What was a little different about KeepMedia is that we were funded by a single person, Louis Borders. We did not have a certain amount of money in the bank and there were no plans to seek VC funding. That would have been tough to get anyways at that time. But there was still huge emphasis on saving money at all costs. We were very creative at doing that. I learned a lot of valuable lessons by having such constraints placed on the systems I built.

I wasn't at KeepMedia very long. That's a long story in itself, and I hated to leave. However, by the time I left, the recession was officially over in The Valley. Let me summarize some lesson that I learned back then:

1.) Start-ups are still start-ups. They are no better or worse just because there is a recession going on.
2.) However, if you are at a start-up, it becomes even more important to know what the heck is going on.
3.) You should still be picky about your job. Don't let the recession force you into a job you hate. Now the recession can force you into that situation, i.e. you are running out of money, etc. But don't put yourself into that situation artificially.
4.) If you do find yourself in a bad position, don't be afraid to make a change.

That covers the professional side of things for me. When it comes to personal things, honestly the last recession did not affect me negatively. Rent prices dropped a lot during that recession, mostly because they were way too high before it. I never took a pay cut and I never had any money in the stock market other than my 401K. So in many ways my buying power actually increased during the recession. Now if I had been unemployed for a long stretch... well obviously that would have been a lot different.

Will this recession be even worse? I actually don't think it will be worse for The Valley, just because the last one was so bad. This one looks like it will be worse for the country at large, and maybe it will last longer. The last recession was four years solid in The Valley, though maybe less elsewhere.

Monday, October 13, 2008

ActionScript Vector Performance

Flash Player 10 is coming out this month. This weekend I went to Adobe's FlashCamp. It was a lot of fun by the way, and a big thank you must go to Dom and the folks at Adobe for a great event. Adobe really treats developers well. Anyways, there are a lot of great new features in Flash Player 10. Other folks will talk about 3-d and text engines and Pixel Bender, etc. but me? I'm excited about Vectors.

If you are like me, then the first time you heard about the new Vector class in ActionScript, you thought it might have something to do with graphics and what not. However, I was overjoyed to learn that it was like the Vector from C++ and Java, i.e. a list-style collection. Like the Vector from the STL and in Java 1.5+, it is parameterized. Even better, you can specify a fixed length for it. In other words, you can say that is a collection that only allows one type of object and that there is fixed number of objects in it. This leads to excellent performance optimizations that are possible, and indeed Adobe has taken advantage of this. Of course I had to test this out for myself.

One of the other nice things about FlashCamp was that they gave us a new build of Flex Builder. This one has support for the new language features supported in Flash 10. To enable the new features, you just change the Flash Player version that you target and voila! I took some benchmark code that I had used for Flash/JS comparisons. Here is the original code:

private function testArray():Number{
var startTime:Date = new Date();
var arrStr:String = null;
var arr:Array = new Array();
var i:int=0;
for (i=0;i<=94;i++){
arr.push(i);
}
for (i=0;i<=arr.length;i++){
arr.push(arr.pop());
arr.sort().reverse();
arr.push(arr.splice(0,1));
}
arrStr = arr.join();
return (new Date()).getTime() - startTime.getTime(); }

And here is the new version that uses a Vector instead of an Array.

private function testVector():Number{
var startTime:Date = new Date();
var v:Vector.<int> = new Vector.<int>();
var arrStr:String = null;
var i:int = 0;
for (i=0;i<=94;i++){
v.push(i);
}
for (i=0;i<=v.length;i++){
v.push(v.pop());
v.sort(comp).reverse();
v.push(v.splice(0,1));
}
arrStr = v.join();
return (new Date()).getTime() - startTime.getTime(); }

Do you like the Vector syntax?

Anyways, back to the results. The Array averaged around 90 ms on my MacBook. The Vector code averaged around 20 ms on my MacBook. 4.5x? Very nice.

One thing I immediately wondered about Vector was if the Flash compiler erased the type. At first glance, there is no reason to do this. It is a different type, so there is no backwards compatibility issue. It does not extend Array, but it is a dynamic class. The documentation states that the push() method does not do type-checking at compile time, but does do this at runtime. This seemed weird, but it would imply that type information is not erased, since it can be checked against at runtime. However, in my testing I could use push() to push any object into any Vector, and had no compile time or runtime errors.

Keynes vs. Hayek, The Final Round

This is it. Much of the last century has been a showcase of two divergent schools of thought in economics: Keynes and Hayek. Keynes ruled up until the late 70's. The Hayek school found believers in Thatcher and Reagan, but they were both compromised. At best a compromise was struck, with attempts at "supply side" economics that was close to Hayek's Austrian school, along with more Keynesian monetary policy.

Now we have the kind of financial implosion that Austrians have all said was an inevitable consequence of Keynesian monetary policy conducted by central banks. Governments have responded with extreme measures -- extreme Keynesian measures. Austrians aren't willing to say that this won't work, but do say it is only delaying an even worse fate.

The Austrians are smart folks, but they don't like to be measured and tested. They denounce any kind of objective, scientific measurement of their ideas. But they cannot avoid this one. This is it. If you are a follower of Hayek, then you must agree that we will see economic hardship on a grand scale within the next ten years or so. How grand? Again the Austrians will never give you numbers, but you gotta figure we're talking Great Depression kind scale. That would be 25% unemployment, western governments collapsing, democracy giving way to totalitarianism. If we don't have something like that in the next decade, just a run of the mill recession, then the Keynesians (and most of civilization) win.

Wednesday, October 08, 2008

MLB Final Four

What can you say about the Cubs ... but wow. Statistically they were favorites against the Dodgers. Most people would have said that they were "heavy" favorites, since they had the best record in the NL. As an Atlanta Braves fan, I can tell you how little that matters. Statistically there was a 48% chance of the Dodgers winning, vs. 52% for the Cubs. That being said, there was only about a 10% chance of a sweep...

Of course those numbers are based on season statistics, and many would point out that the Dodgers were a much better team with Manny Ramirez on the team. Is this true? Their record was 29-24 with Manny vs. 55-54 without him. They outscored their opponents 249-214 with Manny, which would translate to a ridiculous 40-13 expected record. Even with 53 games, you see the craziness of small sample sizes... The Dodgers actually gave up slightly more runs per game with Manny than without him, 4.04 vs. 3.98. So the improvement really was in the offense. They scored 4.7 runs per game with Manny, vs. 4.14 without him.

So, Viva la Manny? The small sample size skews things, but they sure look like good picks for the NLCS. The Phillies were a better team in the regular season, but nobody is as good as the Manny Dodgers. You're not going to find me picking the Dodgers. The Braves were in the NL West for a long time, so I learned to hate the Dodgers many years ago. Of course that's only gotten worse since I moved to the Bay Area nine years ago.

So what about the ALCS? Boston is statiscally a better team than Tampa Bay. What is unusual too is that these two teams had strong home vs. away stats. Both teams were much better home teams than road teams. Tampa Bay won the AL East, so they have home field advantage. Could the home team win every game in this series? Even with these teams it is statistically unlikely, but the home team bias suggests that this series will be very close.

By the way, it should be no surprise that the ALCS is between two AL East teams. Six of the top AL hitters in terms of runs created were from the AL East. Ten of the top twenty hitters in terms of runs created per 27 were also from the AL East. Eight of the top fifteen AL pithcers in terms of ERA were also from the AL East. And it's not just Boston, Tampa Bay, and New York. Baltimore and Toronto also had very good hitters (Nick Markakis, Aubrey Huff, Alex Rios) and pitchers (Roy Halladay, Jeremy Guthrie).

Sunday, October 05, 2008

October Talks

October is going to be a busy month for me. Next weekend I will be at Adobe's FlashCamp. I will be there Friday night and Saturday, and I may do a short session on TwitterScript, the ActionScript API that I maintain. In particular I want to talk about some of the authentication wrinkles present in TwitterScript and its forked brothers.

On October 20, I am speaking at AjaxWorld. I am going to be talking about a subject near and dear to me, Networked Applications. I'll be talking about why you shouldn't waste the power of your servers building HTML strings but why you should instead start using things like jQuery, GWT, or Flex to cash in on the power of your user's computers.

The week after that, I will be on the east coast speaking at EclipseWorld. On Day One, I am doing a day long, introductory workshop on Ruby on Rails. Of course I'll also talk about how Eclipse can help you out. On Day Two, I am doing two talks. One ties in to the previous day's workshop and is about RadRails. The other session is on ... iPhone development. Kind of a strange topic for me. Chris Williams from Aptana was supposed to do both sessions, but couldn't make it. So Aptana asked me to fill in for him. Hopefully they won't wind up regretting that decision!

Friday, October 03, 2008

Feed of Shame

What do you do when you are on Facebook and notice this in your feed?
Palin? Really? I can understand people supporting McCain. If you are pro-war, then you should be pro-McCain. If you are in a very high tax bracket, then it is in your best interest to vote for McCain. There are other rational reasons as well, and of course there is the old standby "he's not as bad as the alternative."

But what would make you support Palin? Are there women who she appeals to, despite her extreme anti-abortion stance? Maybe you like her views, that is reasonable. But then to have as a spokesperson for your views is ... embarrassing to say the least: