Tuesday, September 25, 2012

iPhone vs. Android? Seriously?

I just had a brief and interesting conversation with a friend on Facebook about the usual iPhone vs. Android debate. This time it was different, though, because I don't think either of us exhibited any measure of "fanboyism" and instead just had a fairly calm and mature discussion on the topic. I know, what the hell, right?

But it left me thinking about the whole debate from a 10,000-foot view. It's all the usual stuff as you'd expect. Apple just released a new product, the market is abuzz, the sales are soaring, and everybody who doesn't ride that train is touting their own warez as being superior in various ways. The argument is tired, but it's important.

An interesting statement was made, though. "Android is working its way into everything." It reminded me of the various pie charts we've all seen over the past few quarters, watching Android's install base creep up past the iOS install base. And now Android fans love that pie chart. Because it proves that their system is winning, right?

Doesn't it? Or... does anybody really care?

Sure, Android has the larger install base. And it will continue to have that. But so what? Where are the profits? Where is the brand recognition? Does anybody who owns an Android device know or care what Android is? Or that Google is behind it? They don't call it Android, they call it by the device name. Take that same pie chart and add the dividing lines between the actual devices, then which piece is bigger?

On the other hand, when somebody owns an iPhone they know it's an iPhone. They know it's Apple. They know that they want to buy other things from Apple. They go to an Apple store and talk with Apple people about the Apple products that they're buying from Apple. The brand is right there in everything they do. And so are the profits.

Six years ago, Apple pulled a new product out of their collective ass. They conjured it out of thin air. Quite literally any competitor in that space could have done the same thing. Microsoft, Google, Nokia, Samsung, Sony, Blackberry, Palm, anybody. But they didn't. Apple did. And that one product unquestionably turned the mobile phone market on its ear. Overnight everybody suddenly had a lot of catching up to do.

And they've caught up. Good for them. Competition is a good thing. Well, at least the technology has caught up. But the money sure hasn't. Look at what Apple had going at the time...

Rewind six to eight years and look at the iPod. How close was that to 100% market saturation for the MP3 player consumer base? It was a household word, for God's sake. There were tons of other MP3 players out there, but who cared? They were all "non-iPods." The iPod was the market leader by a wide margin. That one simple product revolutionized and dominated the MP3 player market.

Then Apple rode that capital into the iTunes Music Store. The music industry in general was a bit more complex and had bigger players in it, but Apple still rocked that boat. The people had spoken, and what they said was that they wanted to download music. Everybody else in the industry fought the market, while Apple capitalized on it. They opened up the iTunes Music Store, told the music industry that there's a new set of rules in town, and the market went with it. Profits soared.

Then Apple rode that capital into the iPhone. This one single product has since dwarfed the entire corporate empire of Apple's longest running rival, Microsoft. And it didn't take long for that to happen, as opposed to the decades Microsoft has been riding the enormous former gap between the two. And again, it was a revolutionary product. Again, overnight everybody had a lot of catching up to do.

And while everybody was catching up in that market, Apple had a few more tricks up their sleeves. Next in line was the Macbook Air. Sure, it didn't have quite the impact that the iPhone had. Not by a long shot. But what did it do to the ultra-light laptop market? Was there even an ultra-light laptop market before that? Sure there was, but it wasn't serious. Then that Air came out, and it was beautiful. The price was at a premium though, mostly because it was the first of its kind and the technology (SSDs anyone?) was pretty pricey at the time. And what has the market done since then? Have you looked at Dell's ultra-light laptops recently? They look remarkably similar to Airs. Everybody's does. Because they're playing catch up.

Ok, let's let that market play catch up for a while. In the meantime, we've got an iPad to release. A what now? An iPad. You know that fledgling tablet market that everybody's been trying to open up for years? Apple opened it up. Wide. And dominated it. Just as revolutionary to the tablet market as the iPhone was to the mobile phone market, the iPad quickly became the standard against which all others would be measured. And all others have been playing catch up ever since. Have you used any of those "competing" tablets? Most of them are pretty awful. And so another entire market/industry was turned on its ear.

I'll grant you that the iPhone 5 isn't revolutionary. It's a pretty standard upgrade from the iPhone 4S. (I'm still buying one, of course, mainly because I don't have a 4S. I have a 4. And the difference between the 4 and the 5 is staggering.) I'll grant you that Android has a wider install base. I'll grant you that Windows 8 and Windows RT are exciting and innovative. (About time, Microsoft. The last time this happened was Windows 95.) I'll fully stipulate that Apple didn't revolutionize any markets or turn any industries on their ear this year.

But, again, so what? Do you really expect them to change the world every year? Feel entitled much? Ok, so maybe this post reads like Apple fanboyism, and maybe the language I've used supports that. I'll admit to being a fan of Apple products. I enjoy the brand, and I'm fairly loyal to it. And isn't that the point? Don't take my word for it, don't even take those various install base pie charts' words for it. Listen to the one thing we're all in this for... Listen to the money. Riding wave after wave of revolutionary product, building a line-up that dominates everything it touches and a brand that permeates the very lives of its legions of customers, Apple has risen to become the most valuable corporate entity in the history of capitalism.

If that isn't the bottom line, what is?

So, sure, Apple didn't innovate much this year. Their captain died at the helm. Wouldn't it be somewhat noble of us to grant them quarter before continuing the fight? Ok, while that was a nice analogy (and I've been looking for an opportunity to work "granting quarter" into a conversation for a while now), it doesn't really matter. They're still riding the biggest wave around.

This year they're leaning pretty heavily on the brand and the marketing. So? They built that wave, let them ride it for a moment. They're still on top. A single product release didn't send shockwaves rippling through the industry, but it's a bit early to be sounding the death knell for anybody sitting on that kind of capital. The anti-Microsoft crowd (myself included, of course) has been trying to toll that bell for years. But that mountain of money is tough to move. And cute little toys like Linux just don't have the market force for move it.

Speaking of Linux, isn't that what Android is made of? Ah, yes, that's what we were talking about. Android devices vs. Apple devices. Or, again, a vast sea of varied devices vs. a unified and immensely successful brand. Is that really a competition?

Technologically there are plenty of devices which compete with or even surpass Apple's devices, at least by some measures. Maybe not all, but some. I've still yet to find one that has the same... je ne sais quoi... as Apple's devices. They compete or even surpass on a piece here and there, but you'd be hard pressed to demonstrate one that presents as compelling an overall experience. I guess the price points help with that, though. The competing ones are cheaper. So if you want something with a better Feature X than an iDevice, you can find one at a better price. As long as Feature X is all you care about, I guess.

But I'll say again... so what?

Remember that scene at the end of Pirates Of Silicon Valley when Steve Jobs realized that Bill Gates had beaten him to market saturation?  That Microsoft had won?
Steve Jobs: We're better than you are! We have better stuff.
Bill Gates: You don't get it, Steve. That doesn't matter!
My how the tables have turned.

You Can't Help Everybody

I love Stack Overflow, that much is certain. But why? What is it that makes Stack Overflow such an attractive place for professional software developers? What is that quality contained therein which just makes the experience... better?

It's the noise to signal ratio, hands down. I've been on forums, I've been in newsgroups, I've subscribed to email lists, etc. They all suffer from the same problem... noise. And lots of it. Where does this noise come from? Well, the Internet of course. But these things are on the internet, just like Stack Overflow is. So how is it that they get all of this noise and we don't?

There's something about the Stack Overflow community which, while not acting as a "walled garden" by keeping the community close and private, does present a barrier to entry for noise. It's a very simple yet radically unconventional approach to an online community. Quite simply, not everybody is welcome at Stack Overflow.
Not everybody is welcome at Stack Overflow.
I told you it was radically unconventional. It even sounds rude, doesn't it? But it's true, and it works. Don't get me wrong, we welcome everybody by default. But not everybody belongs there. And the community does a fantastic job chasing away unwelcome participants.

Throughout other online communities, numbers are important. More users means more advertising revenue, more content, more incentive for even more users, etc. So not only is everybody welcomed, but the maintainers do whatever they can to try to cater to everybody. Adding countless features, making countless modifications, etc. And what ends up happening is that they lose the focus of the community itself. They dilute the purpose in order to try to cater to a wider audience.

By trying to be everything for everybody, they end up being nothing of substance to anybody.

Stack Overflow takes a different approach. We vehemently defend the core purpose of the community, and while we welcome anybody who wants to participate we also reject anybody who doesn't want to be a part of that core purpose. The purpose itself is simple... To provide a place for software developers to ask questions and get answers about the software they're developing.

To illustrate, I came across an interesting example today of somebody who isn't welcome in our community. Take a look:
To be fair, some of the comments came off as a bit rude. We do have a problem with that. But this is hardly the worst of it. The real problem here, clearly, was the person asking the "question." They didn't want to clarify, they didn't want to try to work toward a solution to their problem, they just wanted to argue.

This person was a clear example of a help vampire. They were more interested in arguing about the question than in improving it, and it desperately needed improvement. Where does this sense of entitlement for help from others originate? The Internet, I guess.

So, not having received... whatever it is this person was looking for, they rage-quit. And that's ok. Nobody from Stack Overflow is going to contact them. Nobody is going to chase them down and try to make nice. The community will do just fine without them. Essentially, the creation of content like this is unwelcome. (Though I can at least give the user a tip of my hat for pro-actively deleting the question, otherwise we would have had to clean up after them.)

Is the user now no longer welcome at Stack Overflow? That's up to the user. It's really the content that's unwelcome. So if the user continues to submit such content then the user would demonstrate themselves as being unwelcome. If the user improves the content, then the user becomes welcome. The point is that it's the user's decision, not ours. We simply represent the community and the standards therein. The user can participate or move along. (Or rage quit, if they'd rather do that.)

We're not out to help everybody. We're out to help each other. Anybody is welcome to be a part of that if and only if they have the same purpose... to help each other.

Monday, September 10, 2012

Clean Code Screencast

I've finally finished recording and moderately editing my first screencast. As I mentioned in a previous post, this was considerably more difficult and time-consuming than expected. By comparison, giving a presentation in front of a live audience is much easier and far less aggravating. I had to break this into segments because doing it all in one take just wasn't possible, and then edit those segments together after multiple takes of each.

The outcome also isn't as clean as I'd like to get to at some point.  There are some audio problems which I've identified and need to work on.  I also don't like the preview image that YouTube is using by default.  Overall there's touch-up to be practiced over time.

In any event, it's done. This was originally something I'd worked on with a colleague or two and the original version was internal to my employer. Having been well-received and having been presented again to another internal audience and again being well-received, I decided to clean up the whole thing and start to build what might be a small series of these.

The presentation itself is a simple introduction to Clean Code, inspired by Robert C. Martin's book of the same name. It's a pretty simple and straightforward review of some of the core concepts presented in the book. For much more in-depth information (from a better public speaker with better videos) I highly recommend Uncle Bob's Clean Coders video series. They're not free, but a personal license is worth every penny.

There are additional presentations I'm working on as well, and I hope to continue to practice these screencasts over time. But for now just finally finishing this one is a huge sigh of relief for me. Lessons have been learned, practice has been had, and I hope to get better at this.

So without further ado, here's the screencast. Enjoy!

Thursday, September 6, 2012

Testing Private Methods

You shouldn't test private methods.

There, wasn't that simple? Perhaps too simple, so allow me to explain...

This debate seems to pop up on the internet and amid various developer groups from time to time. Should we test private methods? It's a simple yes-or-no question (or, even simpler, it's a "no" question), and there seems to be an encampment of zealous opinions on both side. I, of course, am no exception to that. The thing is, I've yet to hear any good argument in favor of such practice. And I don't believe there is one.

First of all, consider the argument that we should "test everything." With that statement I wholeheartedly agree. But how do you define "everything"? Certainly you should test all outward-facing (read: public) functionality. So, by extension, this would also test all private functionality, would it not? If you have private functionality that isn't being used by the public functionality... Then why do you have it? If nothing is using it, get rid of it.

Suppose you do test your private methods, perhaps through some trickery of the language or some reflection of assemblies of whatever. Then what do you do if your implementation changes?

Let's say you have some repository which uses a database and you write tests against that functionality. But the repository also has private helper methods for handling common database tasks, so you write tests against those as well. Now let's say you swap out that repository implementation with one that saves to an XML file. The public functionality should be identical so as to not be a breaking change to the rest of the code. But it is a breaking change to the tests. The private helper methods are all different, so the tests need to be updated in order to test the same interface.

This, of course, is unacceptable.

Private is just that... private. You mark something as private when you feel that it's a detail which needn't be known to the rest of the code. It's not part of the interface. Well, the tests are part of the rest of the code. They're not special. They're not some one-off thing that hangs onto the side of the codebase. They're classes and methods like anything else. If something is private, your tests shouldn't know about it. And if they shouldn't know about it, then certainly they shouldn't try to directly use it.

Seriously, can anybody present a compelling reason why a private method should ever be tested? Why code which by design is entirely unknown should somehow be examined?