Seriously, has the Mozilla team run out of important things to work on in Firefox?
My Firefox browser updated to 3.6.2 today and I’m greeted with this page, asking me to try their new personas:
I’m not really a customize-my-browser-to-look-like-a-teenage-girls-Twitter-page kind of guy, but I thought I’d give it a shot and see what happened.
In a word: horrific.
My browser’s link bar went from easily readable to complete obscured:
And not just with one, but pretty much ALL of their “recommended ones”.
WTF Mozilla? Have we decided to throw out 30-odd years of user interface practices in favor of ponies, rainbows and unicorns? Really?
There are 30,000 MORE of these monstrosities to choose from! Keep in mind that Mozilla would, of course, showcase the best and most interesting on their update page…But if these are the best, I’m frightened to dig any deeper.
This reminds me of the skinning snafu of the early 21st century where every damn audio application (WinAmp for example, but certainly not limited to them) had to come out with 368 cool skins to go with their app.
Not only did you have to learn an entirely new interface with the application’s custom look-and-feel, but you often had to relearn it for each damned skin you switched to. The same was true of Linux usability. Reminds me of a quote:
Whenever a programmer thinks, “Hey, skins, what a cool idea!”, their computer’s speakers should create some sort of c*ck-shaped soundwave and plunge it repeatedly through their skulls.
This is a usability nightmare**. No, wait, usability nightmare doesn’t even begin to cover it. And now Mozilla wants to do that with my browser? As if MySpace pages didn’t make the web awful enough…
For the love of all that is good and easy to read in the world, stop. Just please stop. Tell me where to send the money to make it stop.
My eyes are still bleeding.
UPDATE (part 1): Looking to REMOVE the personas? Do this:
Go to Tools -> Add-ons ->Themes Panel. Click on Uninstall on the persona. Then restart Firefox.
UPDATE (part 2): Since I have the (un)fortunate Page 1 Google ranking in “firefox personas”, and the comments seem to fall into 3 categories in rough order:
Dude, you’re a grouch.
Dude, you’re an idiot AND a grouch.
Dude, I totally agree with you.
I realize I fell prey to a classic issue often happened in math class too…I skipped straight to the answer and failed to show my work.
** When I say “usability nightmare”, what I mean (hyperbole aside) is that personas violate some well-known principles of web usability all posited by Jakob Nielsen, the guru of web site usability. He doesn’t just guess on these things, he actually researches them, observes behavior and reports results.
Which principles? Well, I can probably dig up a dozen if I try hard, but without going too crazy, here’s a short list of the ones that FF personas pretty much violate right out of the box:
Usability matters. And grouchiness aside, the more we infect these kind of eye-Twinkies (think: eye-candy, but far less nutritious) on people, the less capable they are of actually using the web in the first place.
About 12 years ago, I was a member of the Professional Services Group for a C++ tools company. They created a great framework for C++ classes, particularly dates and strings, that really didn’t exist in a standard format at the time. They dominated the market because their tools were second-to-none.
One of my many gigs at the company took me to Dallas, Texas, home of great bar-b-que and technology companies. My observation upon arrival is that the density of the two is approximately 1:1, or at least it was at the time. Coincidentally, another colleague of mine from the same company was also on assignment during the same two-week period at a company just down the road, a major telecommunications company (let’s call them “Lint Communications”). Not coincidentally, I think lint was all that existed between some of the managers ears at that company.
My friend was tasked with porting the C++ toolkit over to OS/390 for Lint Communications. This sort of work was typical for our group–anyone who wanted support for our libraries that was outside the supported platform list usually hired Professional Services to come on-site and create a custom build for them. After you did a few of those, it was mind-numbing work usually consisting of chasing down obscure compiler parameters and libraries in paper manuals at a time when Google and the Internet were not really up to the task of storing that information.
Oh, did I mention that our company charged about $500,000 for a single OS/390 license? Yeah, so there was serious cash on the line. That might be important later.
This gig started out innocently enough. We had dinner about midway through the week, during which we traded war stories:
Me: How did it go today?
Friend: Uh, it was kind of weird. They are telling me to finish the port, but they are talking to the sales guy like they’re not all that interested in it. Something about it not working right.
Me: Did you run the standard test suite? Did it pass?
Friend: Yeah, flying colors. No problems.
Me: Did you offer training or help?
Friend: Yeah, they tell me they don’t have time right now. One other thing though…
Friend: Every hour, on the hour, the file system slows to a crawl. Kind of seems like they’re taking backups of it or something.
I should tell you that my friend was a junior engineer working in our group and this was one of his first gigs. He seemed to think this felt wrong, but he just wasn’t sure. At this point, my alarm bells were ringing. Here we had a customer that was paying good money to have an engineer on site, but telling the sales rep that the product wasn’t working and they didn’t want help to fix it. And taking snapshots of his work.
Our conversation continued:
Friend: What should I do?
Me: Finish the port like they asked. However, just in case, put in a time-bomb. Something not easy to find on quick inspection inside of our headers that will kill the library after a certain date.
He completed his work and put in the Trojan horse in the string library, something like:
After we returned from our jobs, we learned from the sales rep that they decided not to purchase the software license and they deleted the software from their mainframe. We considered the matter dropped and went about our other projects.
About 45 days later, our customer support department got a call from Lint Communications. They complained that our toolkit was crashing their application every time they launched it, based on stack dumps. A quick search of their customer information confirmed they had no purchased licenses.
Sure enough, they had continued to use the OS/390 port without paying for it.
Our sales group negotiated a nice settlement with them to the tune of almost $3 million for a license deal after agreeing not to sue them for piracy. After that, my friend turned over the compiler option to Lint Communications that was required to shut it off.
I learned a critically important lesson in consulting that day: Take the customer’s word, but make sure they are telling the truth.
So you’re a mobile developer and you want to start building apps for the glory, the fame, and the cold, hard cash. You’re probably looking at the iPhone vs. Android war unless you were just recently thawed out from cryogenic storage, in which case I welcome you to the 21st century.
As a mobile development platform, the iPhone might as well rename itself to “Lightning Rod for Criticism.” The critiques are not undeserved–largely due to its App Store, but the platform itself has a fair number of things to gripe about too. Google “iPhone App Development Sucks” and you’ll find lots of complaints usually distilled down to:
Getting approved requires intervention by the Pope or some higher deity. Rejections are potentially random.
Approval times are so long, users get mad because bug fixes take a long time to migrate into the ecosystem.
The vast majority of apps in the store are ignored because they are swimming in a sea of competition.
Apple is just plain mean and kicked my dog for amusement.
Maybe not the fourth one as much as the first three, but they’re all around in various proportions. They usually result in the following solutions:
Apple should change the app approval process.
Apple should remove its stranglehold on the iPhone app store.
Developers should get the new <insert Android-based phone here> because Android’s platform has:
No problematic approval process
The hot new market
Better development environment
My question to the mobile development community is the grass really greener on the Android side of the fence? Let’s take a hard look:
The Android Marketplace
I have a few friends with the Droid/Android phone sets and they love to brag about just how cool they are compared to the iPhone. I’ve seen the handset and played with it for a bit. It’s nice enough for sure. But when I ask them about the Android App Store, instead of telling me about Android, they rail on how broken the Apple App store is. That missed the point. I wanted to know how theirs works. So finally, I checked it out for myself…
There are no less than SEVEN different stores (that I can find to date, Jan ’10), either already available or in the works, including:
MiKandi (the first adult app store, and no I’m not linking to it. 🙂 )
General Mobile and
Sony Ericsson (both mentioned here, coming soon to a browser near you)
This is progress? Now instead of contending with ONE process, ONE registration fee, and potentially, ONE set of handset, I’m faced with a nightmare combinatorial problem of up to seven places to deal with as a developer (with seven fees, seven policies, seven places to potentially get rejected if they dislike something, etc), and SEVEN places to shop as a consumer. As a developer (especially a micro ISV), my resources were already strapped but now they’re positively spread razor thin in this model.
Not looking good there for Google, is it? Yeah, so you’re going to hedge your bets, submit to multiple stores and reach for some aspirin. So #1 on our list isn’t looking great.
The number one reason most (but not all) developers create mobile apps is to get some economic benefit. How does Android stack up in terms of economic potential?
Apple and Android stores couldn’t be more different in size: Apple’s app store is estimated to make $2.4 Billion dollars per year (source: AdMob). For some perspective, that’s about the 2008 GDP of Somalia and about 2x the 2008 GDP of the Maldives. Official Android figures have yet to come out, but AdMob has estimated their size at about $60 Million dollars per year, as of about 6 months ago. For the mathematically challenged, that makes Android’s Marketplace about 2% of the size of Apple’s iTunes economy, or Apple’s iTunes economy is about 40x larger than Android’s.
And as if that weren’t depressing enough, the Android Market’s purchase rate is less than half that of the iTunes App Store (19% of Android users bought apps vs. 50% of Apple users). There’s some speculation that Android users have a higher ability to pirate purchased apps, and this is impacting the actual purchase rates. Either way, the fact that the Android user base is less likely to buy apps coupled with the size difference makes the economic benefit of the platform shaky at best.
That makes #2 as a reason to switch somewhat naive.
A good example is the well known game Trism, which sold over $250,000 in it’s first two months on the iPhone. On Android it has sold, to date (August 2009), less than 500 copies. That’s $1,046 total earnings, max. How psyched are those guys that they ported a huge hit to Android and can’t even cover a party sub for the release dinner?
Ouch. And if a well known title is struggling like that, what does that say about the lesser known apps?
Internal competition is a good thing–competition means that everyone thinks this platform is interesting. Android doesn’t seem to have critical mass here. Unfortunately, Android has external competition, but not in a good way. If you want to get the best deal on apps, you actually need to shop and price-compare appsbetween stores–how’s that for a great experience?
Android has the buzz, but Android’s market share just doesn’t touch Apple’s, either in terms of payout or number of handsets available. Here are figures from Quantcast for Oct/Nov in 2009 comparison charts (This is the most recent data available for this post, I’d love to see how Dec changed this, if at all, with the release of the Motorola Droid).
Notice two things:
Android’s jump in market share was at the expense of RIM, Windows Mobile and other non-Apple OSes.
Apple’s market share remained untouched.
So why does Apple maintain such a captive audience? They understand that a mobile device should be
The iPhone is the first mobile device to accurately capture that trifecta of characteristics. A positive user experience will trump “open platforms” and all that other developer-centric nonsense that we like to spout. Android merely copied most of what the iPhone had already innovated, but without adding much to its predecessor’s heritage. As an iPhone user, my motive to switch platforms is low. Android’s market share will stagnate soon for that reason alone.
What about the Android Marketplace vs. iTunes? iTunes is a case study in user friendliness. The Android Marketplace is functional but a real pain to navigate. Try this fun experiment: Browse the Top Paid Apps in the Android Marketplace. You have to hover over each app to find out what it does and each page contains 8 apps. You can’t see how much an app costs until you visit the developer’s own site. Apple, by contrast, puts some minimal info on each app including publisher and price for each app and I can see up to 100 at a time.
Developers, Developers, Developers!
The Android’s development platform is a clear win for software nerds. Developing an Android app means using Java, a well-known, well-documented language with loads of great tools and relative ease of uploading them to the device. Apple’s XCode is a piece of crap, even on a good day. Provisioning your iPhone app is a small nightmare that even the most seasoned of developers will struggle with.
Finally, a point for Android! But unfortunately, developer friendliness is the least important aspect of the platform. Not just Android, any platform.
Steve Jobs Is Still Pwning Android
Let’s recap thus far: With Apple, you have a painful setup process, a lousy development environment , a costly annual fee, and a single app store that if you’re part of the Blessed, you can make some fat cash, hand over fist.
With Android, you have seven potential stores to deal with, a reasonable development environment, a lot of uncertainty about the market, and no economic incentive to make apps because the payout isn’t working out like Apple’s app store.
I wouldn’t call that much of an incentive to go with anything but Apple, even with all the negatives in Apple’s basket.
The iPhone scratched an itch no one knew they had and the Apple App Store took off into the stratosphere, inspired by a paranoid and sometimes irrational father figure culture. And it’s still kicking the crap out of everything else. Android’s game of catch-up is turning into a potential nightmare for customers and developers alike.
My advice is to buy a black turtleneck, some khakis and buck up with your iPhone development. Cocoa may be a pain and Objective-C far less fun than Java, but Android’s cure is worse than the disease.
UPDATE: Six weeks later, the Nexus One launch is declared a flop. Sales are 10% of either Droid or iPhone during the same 74 day period of their launch cycle. Not exactly the iPhone killer Google was hoping for.
Apparently the US Military can’t write software worth a damn. Here’s a textbook-classic case of what happens when you decide to ignore a problem that is clearly evident at requirements time until well after post-deployment.
The Wall Street Journal did an article about the unmanned drones zipping over Afghanistan and Pakistan. Apparently, local insurgents found a $26 piece of off-the-shelf software that could tap into the drone’s unencrypted video feeds and give the insurgents a clear view into what the US Military was watching, thus ruining the element of surprise.
Can you say “Ouch”?
A quote from the article itself says it all about military incompetence arrogance:
The potential drone vulnerability lies in an unencrypted downlink between the unmanned craft and ground control. The U.S. government has known about the flaw since the U.S. campaign in Bosnia in the 1990s, current and former officials said. But the Pentagon assumed local adversaries wouldn’t know how to exploit it, the officials said.
Holy Ostrich-Heads-In-The-Sand, Batman! Not only did the military put software out the door with an obvious security flaw in it, they’ve ignored this problem for over 10 years because they thought the enemy was too dumb to figure it out! And the justification?
Fixing the security gap would have caused delays, according to current and former military officials. It would have added to the Predator’s price.
Yes, that’s absolutely true. But honestly, how much would it really add? The Predators already run in the millions per drone (10-12 per the article). Let’s analyze that, based on current prices of software contracting, estimated efforts and the technology involved. First, we need a list of assumptions:
Encryption requires additional processing power to encrypt at the drone and decrypt at the receiver. Let’s assume they add a special card to each drone to dedicate to this task so the video feed isn’t compromised on the sending end. Cost: $1,000 per drone because it’s a special piece of hardware capable of running at 2Gs. (Off the shelf solution today: probably about $250)
Cost to install in each drone: Let’s say that it takes a tech about 2 hours worth of time per drone. And assume the tech is paid a modest $20/hour to do his work. $40per drone.
The card requires additional software to link it into the current drone video processing loops. Let’s assume the video processing is well-known, and the encryption addition takes roughly 2 engineers 1 month to complete. (2 engineer months @ $150/hour government contracting rates = $24,000 for all drones).
The receiver software requires a comparable upgrade to handle the decryption. Assume another 2 engineers are dedicated to that task for a similar length of time. Another $24,000 for all drones.
Figure in some extensive testing: Another 2 engineers for a month: $24,000 for all drones.
Assume that managers are involved and their costs are amortized into other projects, which is likely true.
Finally, assume this is for an existing fleet of 1,000 drones.
Adding all that up, I get the following:
1,000 drones * $1,040 = $1.04 million for all drones.
Fixed costs = $72,000
Total costs = $1,112,000 dollars for 1,000 drones OR
At $10 million dollars (the low end) per drone, that’s a 0.0112% increase in price per drone. Hardly a massive cost overrun by military standards. And let’s assume I’m off by a factor of 10 on all my calculations…still, that’s still about 0.11%. Again, not a massive overrun for something that mission critical. Compared to most software projects with mid-double digit overruns on developer time, this is positively amazing.
And the delay argument? Maybe 6 months to retrofit the fleet. At best. You’d think that in 10 years time, the military could find 6 lousy months to upgrade its most important asset in the 21st century. Even a phased upgrade would have worked here over that time frame.
This is all taking into account that the military is fixing this problem well after the design and implementation phases (our old friend Habit 5: Fix it Later) instead of identifying and fixing this problem up front. That would reduce the costs even further. I find it completely incredulous that not a single person during the design or requirements gathering phases said, “Hey, maybe we ought to encrypt the video feed…” Aren’t they supposed to gather information, uh, secretly?
Clearly one of two things is going on here:
The military is too lazy or stupid to realize that the enemy will find and crack that exploit given enough time and resources (let’s just throw out the number 10 years…)
The military price to fix this flaw is much higher, meaning that the cost overruns are due to corruption, incompetence, or outright greed in government contracting.
Shame on everyone involved. This sort of breech wouldn’t happen at Amazon.com’s ecommerce site. It shouldn’t happen with some of our most important software technology given that this is a solvable problem with known constraints.
* UPDATE @ 12:48p, 12-17-2009: My math was off by a factor of 1,000 on the calculations and my addition sucked. I’ve just embarrassed every math teacher I’ve ever had. Now it’s even cheaper and more horrific!
Cloud computing is clearly not where we want it to be.
On the one hand, we have folks actively trumpeting the benefits and utilitarian nature of cloud computing and data storage. It’s attractive for sure. Access data anywhere. Avoid the hassles of local backups. Prevent data recovery disasters. Pay-for-what-you-eat models. Unlimited computing potential. It’s all sounds great on a blog. Clearly the proponents want us to think Cloud computing is exactly like living on “Cloud Nine“.
The reality is still more hype than help to most of us. Mostly early adopters are using it today. There are steep learning curves to use the APIs. Costs of usage and storage are decreasing, but are far from the “zero cost” models touted. Nightmarish security issues arise when you don’t know where your data lives. And people are losing control of their data. That brings me to today’s Google infraction.
Google Docs is the classic example of storing data in the cloud and it’s proving to be somewhat unreliable and unpredictable. Not exactly what you’d want to hear when you are storing away personal and important information. Here’s a small list of documents that have been recently rejected with “inappropriate content” messages from Google:
Some of these issues have lingered for over a month, and still have no resolution or response from Google. Some are brand new. Either way, how can you feel good about your data in Google Docs? And if the one of the largest cloud computing advocate-providers can’t get it right, who can? Do you really want to play guesswork with important information like that? That’s just insane.
– 8.3 Google reserves the right (but shall have no obligation) to pre-screen, review, flag, filter, modify, refuse or remove any or all Content from any Service.
I understand the intent of this statement. Google probably doesn’t want the liability of Al Qaeda using the Cloud to do predictive modeling for their next attack. Or to storing documents spewing anti-Semitic hate speech. But the reality of what they’re protecting is a bit more utilitarian and ugly: copyrights. There’s nothing worse than the MPAA or RIAA coming after you because you posted some content they own the copyrights to and you’re using without their permission. This is a CYA move by Google for sure.
But what about my daughter’s homework? If her upload somehow violates a magic filter, completely obscured from public scrutiny during upload and Google prevents her from accessing it, does she get to claim that the Cloud Ate Her Homework? Never have Microsoft Word, a local hard drive and laptop in her room looked so attractive for safety and security. Precisely the opposite of what the cloud says.
Are we getting this level of (dis)service because Google is tired of providing things for free now? Are they going to force us to pay for the data we already put into the cloud?
Google’s entire history is about creating useful applications (GMail, GTalk, Wave, Google Docs) that are free to use, and allowing those that wish, premium features for a modest upgrade. I don’t think it’s too much to ask that basic reliability (Google saves my documents and keeps them safe) and predictability (Google gives me access to them next time, or at least tells me why I can’t see them) are part of the “free service”, within some reasonable limits of storage. If I have to pay just to ensure that Google will store a simple document in the first place, and not lose, modify or reject the content, that model really fails the general public and breaks with Google history to date.
As long as the cloud can freely mess with my information without my consent, “Cloud 9” computing sounds more like “Plan 9 from Outer Space” and I doubt I’d want Ed Wood in charge of my family spreadsheets.
In Part One of this post, we discussed the Great Concurrency Problem and the promise of Go in taking the throne from Java. Today, I show why Go isn’t going to get us there.
Back in the heady days of C++, if you wanted to add concurrency support to your application, you had to work for it. And I don’t mean just find a few calls and shove them into your application. I mean:
Find a threading library available on your platform (maybe POSIX, maybe something more nightmarish, maybe even a custom thread library that would run you a few hundred bucks per license)
Locate the obscure documentation on threading APIs
Figure out how to create a basic thread
In the process, read the encyclopedia-sized docs about all the real issues you’ll hit when building threads
Decode the myriad of options available to you to synchronize your threaded application via header files
Add the library to your makefile
Code the example and
Make it all work
Contrast that with Java:
Create a Runnable interface
Implement the run() method
Call new Thread(myRunnable).start();
Debug the obscure errors you get after about 6 months of production
Whoa. At least with C++, the Threading Shotgun wasn’t loaded, the safety was on and it was hanging on the wall. You had to do the hard work of loading the gun, removing the safety and pulling the trigger. Java took all that away by handing you the loaded shotgun, safety off. That shotgun is the Great Concurrency Problem.
Java’s great contribution and Achilles Heel, in my opinion, was the choice to make threading so darned easy to do, without making developers innately aware of the implications or difficulties of concurrent programming with the shared memory model. C++ made you wade through all the hard shared-memory stuff just to get to threads, so by the time you wrote one, you at least felt smart enough to give it a go. The concurrency models in Java and C# hide all sorts of ugliness under the covers like shared memory models, caching of values, timing issues, and all the other stuff that the hardware must implement to make these concurrent threads do their jobs. But because we don’t understand those potential pitfalls before we write the software, we blithely assume that the language semantics will keep us safe. And that’s where we fall down.
Write a multi-threaded program in any shared-memory concurrent language and you’ll struggle with subtle synchronization issues and non-deterministic behavior. The timing bugs arising from even moderately concurrent applications will frustrate and annoy the most seasoned of developers. I don’t care if it’s in Java or not–the issues are similar.
My specific beef with Java is the ease with which we can create these constructs without understanding the real problems that plague us down the road. Until we have the right tools to produce concurrent applications in which we can reliably debug and understand their behavior, we can’t possibly benefit from the addition of a new language. In other words, if you want to create a Java killer, you’re going to need to make concurrent programming safer and easier to do. A tall order to say the least.
Enter Google’s Go in November, 2009. The number one feature trumpeted by reviewers is the use of goroutines (the message-based concurrency mechanism for Go) and channels to improve concurrent programming. Initial reviews are mixed at best. But I don’t think we’re anywhere close to killing Java off with this new arrival on the scene for a variety of reasons:
Go decided to use a foreign syntax to C++, C and Java programmers. They borrows forward declarations from BASIC (yep, you heard me right…BASIC), creating declarations that are backwards from what we’ve been using for close to 20 years. Incidentally, syntax similarity was one of the main reasons C++ programmers easily migrated to Java during the Language Rush of 1995, so this is disappointing.
Performance benchmarks that put it slower than C++ (and therefore, slower than Java today since Java finally caught up to C++ years ago). OK, I’ll grant you that Java wasn’t fast out of the gate, but Java was also interpreted. Go is statically linked, and not dynamically analyzed at runtime, so it’s not likely to get better immediately.
A partial implementation of Hoare’s CSP model using message-based concurrency. I almost got excited about this once I finally understood that message passing really makes for safer concurrency. But they didn’t get the model quite right. For example, did you know you can take the address of a local variable and pass that via a channel to another goroutine to be modified? Bringing us right back to the same crappy problems we have in Java and C#. Oh yes. Not that you should do that, but even Java was smart enough to drop the address of operator for precisely that reason.
A few low-level libraries bundled with language, but just barely enough to be functional for real world applications. Completely AWOL: Database and GUI. (translation: “I get to rewrite database access. One. More Time.” Neat.) Did I mention Java had those during it’s 1.0 release?
Static linking. OK, I admit I’m an object snob and I like a strongly-typed, dynamically-bound language like Java. I like reflection and dynamic class loading and the fact I can pass strings in at runtime, instantiate objects and execute functions in ways the original code didn’t explicitly define (and yes, I’ve done this in enterprise production systems!). Not with Go, instead we’re back to C++ static linking. What you build is what you get. Dynamic class loading was probably one of the most useful aspects of Java that allowed for novel ways of writing applications previously unseen. Thanks for leaving that one out.
Excepting Exceptions. Go decided to omit exceptions as the error handling mechanism for execution. Instead, you can now use multiple return values from a call. While it’s novel and perhaps useful, it’s probably a non-starter for the Java crowd used to error handling using exceptions.
This feels like some academic research project that will be infinitely pontificated about for years to come, but not a serious language for enterprise development (obligatory XKCD joke). In short, I’m not impressed. And I kind of wanted to be. I mean this is freakin’ Google here. With the horsepower of Robert Griesemer, Rob Pike, Ken Thompson in one building. The #1 search engine in the world. The inventor of Google Wave that created so much buzz, people still don’t have their Wave Invites yet.
Enterprise Languages should be evolutionary steps in a forward direction. But Go doesn’t really get us anywhere new. And it certain isn’t much of a threat to Java. Sorry Google, maybe you need to give it another go?
* Many thanks to my friend Tom Cargill (who you may know from the “Ninety-Nine Rule“) who reviewed early drafts of these 2 posts and corrected my mistaken notions of concurrency, parallelism, Goroutines and Go syntax. He didn’t stop the bad jokes, though. Sorry about that.
There’s buzz in the air about Google’s new language Go. Naturally, I was excited hearing about it. After all, Google has produced so many interesting tools and frameworks to date there’s almost automatic interest in any new Google software release. But this wasn’t just a product, this was a Google language release. My programmer brain pricked up immediately.
Language releases always catch my attention. Since 1995, I’ve constantly wondered what is going to be the Great Java Killing Language. Java’s release was the Perfect Storm of Language Timing–the rise of the internet, the frustration with C++, the desire for dynamic web content, a language bundled with a large series of useful libraries (UI, database, remoting, security, threading) previously never seen. Lots of languages have been released since, but none with quite the reception of Java. But with that perfect storm came some serious fallout.
At the same time Java rose to prominence as the defacto web and enterprise language of choice, Moore’s Law was hard at work and hardware companies were creating new kinds of processors–not just faster ones, but also motherboards that supported multiple processors. And then multiple cores on those processors. Concurrency became the new belle of the ball, with every language making sure they added support for it. Which gave rise to the widespread use of concurrency features in languages. In essence, Java brought attention to the Great Concurrency Problem that has haunted us almost two decades now.
Before I address the Great Concurrency Problem, we have to agree that most people confuse Concurrency with Parallelism. Let’s start with the definitions from Sun’s Multithreaded Programming Guide:
Parallelism: A condition that arises when at least two threads are executing simultaneously.
Concurrency: A condition that exists when at least two threads are making progress. A more generalized form of parallelism that can include time-slicing as a form of virtual parallelism.
Parallelism has only come about with multi-processor/multi-core machines in the last decade or so. Previously, we used Concurrency to simulate Parallelism. We program our applications to run as concurrent threads. And we’ve been doing that for years now on multithreaded processors. But the Great Concurrency Problem is really a problem about the differences between Human Thinking and actual Machine Processing. We tend to think about things linearly, going from Breakfast to Lunch to Dinner in a logical fashion. In the background of our mind, we know things are going on. You might even be semi-aware of those yourself. And occasionally, we get those “Aha!” moments from that background processing of previous subjects. We use this mental model and attempt create a similar configuration in our software. But the shared-memory concurrency model used by Java and other languages creates implicit problems that our brains don’t really have. Shared memory is a tricky beast. You have objects and data inside Java that multiple threads can access in ways that aren’t intuitive or easily understood, especially when the objects you share get more and more complex.
Shared memory communication is the most common of the two and is present in most mainstream languages we use today. Java, C#, C++ and C all used shared memory communication in their thread programming models. Shared memory communication depends on the use of memory locations that two or more threads can access simultaneously. The main danger of shared memory is that we share complex data–whole objects on the heap for example. Each thread can operate on that data independently, and without regard to how other threads need to access it. Access control is granted through monitors, mutexes and semaphores. Making sure you have the right control is the tough part. Too little and you corrupt your data. Too much and you create deadlocks.
Let me give a concrete example to show just how nasty this can get for shared memory communication: Let’s say you’re handling image processing via threads in a shared-memory model–like Photoshop does for image resizing. And let’s say you’re trying to parallelize this processing such that more than one thread handles a given image. (Yes, I understand we don’t do that today and there’s a good reason for that. This is an analogy, just keep your shirt on a sec.) An image is an incredibly complex object: RGB values, size, scale, alpha, layers if you’re in Photoshop, color tables and/or color spaces depending on the format, compressed data, etc. So what happens when Thread A is analyzing the pixel data for transformation and Thread B is trying to display that information on the screen? If Thread A modifies something that Thread B was expecting to be invariant, interesting things happen*. Thread A may accidentally corrupt the state of the image if Thread B doesn’t lock the entire object during read operations. That’s because Threads A and B are sharing the entire object. Oh sure, we can break the image down into smaller, simpler data abstractions but you’re doing that because of the shared memory problem. Fundamentally, Java objects can be shared between threads. That’s just a fact.
Keep in mind this is just a TWO thread example. When you write concurrent systems, two threads is like a warm up before the Big Game–we’re barely getting started. Real systems use dozens, if not hundreds of threads. So if we’re already having trouble keeping things straight with two threads, what happens when we get to 20? 200? The problem is that modeling any system using concurrent programming tools yields a subtle mess of timing bugs and problems that rarely appear until you have mountains of production data or traffic hammering your system. Precisely when it’s too late to do anything about it.
Even Java’s own documentation from ages ago cautions just how hard this problem really is:
‘‘It is our basic belief that extreme caution is warranted when designing and building multi-threaded applications … use of threads can be very deceptive … in almost all cases they make debugging, testing, and maintenance vastly more difficult and sometimes impossible. Neither the training, experience, or actual practices of most programmers, nor the tools we have to help us, are designed to cope with the non-determinism … this is particularly true in Java … we urge you to think twice about using threads in cases where they are not absolutely necessary …’’
Harsh words (at the bottom) from a language that really opened Pandora’s Box in terms of giving us the tools to make concurrency an everyday part of our applications.
Message-passing communication is perhaps the safer of the two models. Originally derived from Hoare’s Communicating Sequential Processes (CSP), message-passing communication is used in languages like Erlang, Limbo and now, Go. In message-passing communication, threads exchange messages with discreet amounts of local data via channels. I like to think of message-passing communication to be kind of algorithmic atomicity–you are performing some action, say transforming an image and at a certain step, you need the data from the image’s color table. So you wait to get a message from another thread when that data is available. And then continue processing locally in your own algorithm.
Because threads are restricted in what they can share, the risk of corrupt data and deadlocks drops considerably. But this comes with a higher processing cost than shared memory communication. With shared memory, there was no re-writing of the data before thread access. Just the opposite is true for message-passing. Until recently, message-passing communication was considered far to expensive to use for real-time systems. But our multi-core, multi-processor world of the 21st century has finally broken down that barrier.
The question is, does Go really solve that problem in a way that overthrows Java as King of the Enterprise? Tune in tomorrow for Part Two, where we look at Go’s features, whether Go really addresses any of these problems, and if Java is doomed.
* “Interesting” is the default programmer adjective we tend to apply when what we really mean is “incredibly BAD”.
From the late 1800s until the 1950s, railroads dominated the transportation landscape. Want to go from LA to Chicago? Chances were you did that by train. It was the preferred choice of the traveler–cost effective, comfortable, and enjoyable. In short, the railroads enjoyed a near monopoly on passenger movement for nearly 100 years.
When the automobile began to dominate the landscape, railroads simply ignored the threat. “We are vastly superior, have a lock on many markets, and offer an experience you can’t touch!” Unfortunately, the American consumer disagreed with them and railroads entered a period of decline. Cars became the preferred mode of transportation, changing the way cities were built and how people spent their leisure time. By 1966, railroads only carried 2% of all intercity passenger traffic. And by 1970, only one major railroad carried passengers at all. The railroads shrank, cut routes, and closed down wondering what happened. This is now a classic example in business texts, MBA courses and lectures: railroads failed to understand they were in the transportation business, not the passenger business. They didn’t realize their core strengths causing certain death when their market shifted.
Back in the early 90s, my first job out of college was technical support at a GUI toolkit company. This company’s claim to fame was a platform portable library(written in C, later adding a C++ framework) where you could build a user interface on say Windows and then move it to Motif, Mac, OS/2 or a litany of other unfamiliar and obscure platforms, recompile and BOOM, your app ran there too. At the time, it was a novel concept and one folks were paying a mighty fine premium to obtain. Licenses ran about $2000 a piece, plus annual maintenance for support. Writing these kind of applications required a level of GUI expertise that wasn’t commonly available to many developers of the era which gave rise to a Consulting and Training Group that charged hefty rates for their highly sought-after services. Life was good: the company sold several million dollars of support, product and services each year. ISVs writing C and C++ applications gobbled up the software as voraciously as their CFOs would approve the purchase orders, creating a very large and lucrative market during that time. They were kings of the hill.
Fast forward about 3 years. Java and HTML appear on the scene. Younger developers in the company are checking these new technologies out and sending emails to the executives saying how cool Java is and how HTML is taking over the world. The executives didn’t care. “HTML? Bah, that’s for children. Java? A toy language at best…all it can do is make Duke dance in an applet window. Ignore them. We have the Enterprise to worry about.” They missed the point. They were in the business of providing a platform-portable GUI development solution. They forgot that technology doesn’t factor into their mission statement. They were focused on getting new customers in their existing market. They insisted everyone would use C++ forever because it sucked less than HTML and Java, instead of seeing how the market had changed. Just like the railroads.
A few years later, the company shrank from the 100+ employees in 1994 to less than 5 by the Millennium. Developers left in droves because Java was the hot new language and C++ developers were in demand. Professional services was sold to another company because management wanted to “focus on product sales, not services”. The product sales dried up slowly and only a few stubborn customers who couldn’t get off their C/C++ platforms paid the outrageous maintenance fees charged by the remaining shell company. Java became the defacto language for the enterprise. HTML is the lowest common denominator of everywebframework today.
The lesson here is clear: Understand your strengths because your market isn’t static. When the market changes, be prepared to adapt to it with those strengths. Otherwise, you’ll die thinking your strategy was right.