C, the Programming Language: Still On Top After All These Years

Dennis Ritchie, creator of C, with Ken Thompson, creator of B, C’s precursor.

If you’ve ever been with me at a gathering of programmers, chances are that you’ve heard me play The Beatles’ Let It Be on my accordion while singing these lyrics:

When I find myself in hacking trouble
Dennis Ritchie comes to me
Speaking words of wisdom:
“Code in C.”

And right there on my hard drive
gcc is there for me
Speaking words of wisdom:
“Code in C.”

Code in C, code in C,
Code in C, oh, code in C
[insert high-level scripting language here] is for lightweights
Code in C.

C’s got staying power: even though it first appeared in 1972, it’s still popular today, sitting pretty at the very top of the August 2012 TIOBE Programming Community Index:

TIOBE Programming Community Index
“Top 11” for August 2012
Position Programming Language Appeared in
1 C 1972
2 Java 1995
3 Objective-C 1983
4 C++ 1983
5 C# 2001
6 PHP 1995
7 Visual Basic 1991
8 Python 1991
9 Perl 1987
10 Ruby 1995
11 JavaScript 1995

Note the top five languages immediately after C: they all have C’s syntax, as do Perl and JavaScript. Java, C#, PHP, Perl and JavaScript programmers should be able to look at some C code and get the general idea, at least until it gets into more complex work with pointers. C++ is almost a superset of C; a C++ programmer should not only comprehend C code as easily as C++, s/he should also say “Not confusing enough”.

Objective-C is a strict superset of C, which means that any C code that compiles will also compile if fed to an Objective-C compiler. If you’re developing for iOS or MacOS, you’re pretty much a C programmer, albeit a very souped-up one.

C and Me

When I was a computer science student at Crazy Go Nuts University, I chose to do my programming assignments in C (the other language option was Turing, which made the choice rather simple). Since graduating, I’ve only used C for little hobby projects; I’ve never been paid to do any C coding. Still, it’s paid off in many important ways, from having a better understanding of the underlying machinery to being very comfortable with the syntaxes of languages like Java, JavaScript and C# to being of great help as I’m teach myself iOS programming.

Being comfortable with C paid off quite recently when I was interviewing at a startup in the San Francisco Bay area. They asked me to download and install an Ubuntu virtual environment and write a quick little program for the inPulse smartwatch emulator in order to demonstrate my programming chops. Their API documentation was barely that: a straight-up copy of the .h files for their API function library. Because I had the C practice, those header files and a quick look at some of their example code was all I needed to cobble together a quick app. The app became the basis for my inPulse programming tutorial.

Head First C

It’s unusual to see a new C book these days. Take a look at the C programming book listings on Amazon; most of them are at least five years old, and a good number of them have publishing dates in the ’90s. C’s old enough and small enough — even in the latest version, C11, approved only last December, it’s still under four dozen keywords — that most authors haven’t seen fit to write a new C book in some time.

Head First C is one of those rare new C books. Published in April 2012, it’s one of the newest in O’Reilly’s fun-to-read “Head First” series of books, which uses humour and whimsical graphic design to engage the reader. O’Reilly Radar recently conducted an interview with one of its authors, David Griffiths, about the book, the continued popularity of C and what it offers to readers.

When asked “Why write Head First C?”, especially when people still point to Kernighan and Ritchie’s classic book, The C Programming Language, as the go-to book, he Griffiths answered:

Kernighan and Richie’s The C Programming Language is one of most popular, if not the most popular, programming books, and it defined the ANSI standard. That book is still the standard, but through the language hasn’t changed, the audience has, and many learners are coming to the language from a different perspective and set of knowledge.

The C Programming Language was written in a time when it was very unusual to see a computer in someone’s home, well before the era of easily-accessible internet, never mind smartphones and tablets. Back then, C might likely be the reader’s first programming language, while these days, readers are likely to have had some experience with JavaScript, PHP, Ruby, Python or some other programming language, and they’re most likely not doing systems programming. Head First C has some interesting examples and even more interesting labs, featuring an Arduino-powered plant-watering alarm, a webcam-powered computer vision system and an “Asteroids”-like videogame.

Head First C is a pretty good book, and it’s worthwhile read. To find out more about it, check out the interview in the video above.

Learn C the Hard Way

Yours Truly and Zed Shaw

Also worthwhile is Learn C the Hard Way, a book written by the notoriously opinionated Zed Shaw. Based on his earlier book, Learn Python the Hard Way, a book written out of anger and frustration with Mark Pilgrim’s Dive Into Python (a book I rather liked, but hey, Zed’s got a right to his opinion). It’s also a worthwhile read, and unlike Head First C, it’s free-as-in-beer and online!


Updated on My GitHub: “inPulse Magic 8-Ball: A Beginner’s Tutorial for Programming inPulse Smartwatch Apps”

On my GitHub, I’ve updated my tutorial, inPulse Magic 8-Ball: A Beginner’s Tutorial for Programming inPulse Smartwatch Apps to include new sections covering the following:

  • Timers and pulse_register_timer
  • Using multiple timers
  • Cancelling timers and pulse_cancel_timer
  • The “Magic 8-Ball” app, written using timers instead of the main app loop

In case you were wondering, the inPulse smartwatch is the predecessor to the new hotness and Kickstarter darling, the Pebble smartwatch.

As I said in my earlier posting on the tutorial, if you’ve done at least a little programming and aren’t afraid to do a little coding in C, I think you’ll find this a fun exercise. If you’re new to C or just a little rusty, you should check out Stanford’s Essential C page.


Why You Should Hire Me

Writer Paul Constant went to Startup Riot in Seattle and the end result is his wonderfully caustic article titled Yesterday, I Went to the American Idol for Startups. It Made Me Want to Die. It’s a deliciously nasty diatribe against the vapid jargon that’s become the lingua franca at gatherings where people from software, web and mobile startups come to do show-and-tell.

An outsider to startup culture, Constant didn’t write the sort of breathless paean that often graces the pages of business magazines or tech news web sites, in which brash software peddlers are praised for their technical mastery or business acumen (or in some rare cases, their dashing good looks). Instead, he told a horror story of Stepford software-mongers parading inconsequential ideas in an orgy of self-congratulation, all the while doing “brutal violence to the English language, to leave the spoken and written word bloodied and victimized on a cold cement floor, wishing for the sweet relief of death.”

It would be Visual Basic-easy to dismiss Paul Constant’s critique by characterizing him, as one commenter on Hacker News put it, as “basically one type of hipster raging against the hipsterisms of a different type of hipster.” His bio page provides more than enough ammunition for that task, starting with the (presumably) ironically-self aware photo, which I’ve included on the left. It says that he’s the book editor for The Stranger, Seattle’s alternative weekly newspaper, and that his career comprises either writing for various U.S. alt-weeklies or working at book stores, namely the evil chain store Borders (which rates a parenthetical “ugh”) and Seattle’s wonder independent Elliott Bay Book Company. Simply put, he’s the stereotypically snobbish graduate of a liberal arts program, the sort of person for whom concepts like talent, work and ambition are anathema, and  for whom the combination is the anti-Trinity; an unholy menage a trois starring Satan, the Anti-Christ and Barney the Purple Dinosaur. His disgust seems akin to the low regard in which wealthy Victorians held the ascendant merchant class (the word “career” has its roots in the rich of that era comparing people who worked for a living to rats careering — as in “running about — to and fro).

To dismiss Constant’s screed would be wrong for a number of reasons. To begin, it’s a petty argumentum ad hominem kind of retort, the last resort of someone who’s losing the argument. There’s also the fact that he writes so damned well. Armed only with the English language, he does more than merely report what happened — he paints a picture of the event, complete with too-seldom mots justes (when’s the last time you read the word “gossamer”?), memorable turns of phrase and apt metaphors.

Most importantly: he makes a couple of good points.

He writes (the emphasis is mine):

I don’t mean to say that these Startup Rioters are bad people, or that people like this have never existed before. Nostalgia is a cunning trap. These are men and women who want to make a living, and they have ideas they believe are valuable, and they want to communicate those ideas, just like everyone else who has ever lived.

The big problem is the cliches and extraneous words. This world of business, these job creators, have specialized to the point where they have developed their own language. This is normal, but the problem is that their language is as tepid and lifeless and dumb as any language that ever existed.

There’s no excuse for this. The startup culture largely comprises people from the right side of the bell curve, many of whom have had the benefit of higher education or its equivalent. If you argue that those of us who opted for the algorithms course over creative or essay writing have earned a pass, I will counter that we are equally fussy about language, just in a different way. We’ve all argued about the merits over language A over language B and readable code. Our code doesn’t work if it doesn’t clearly and intelligently communicate our intent to the computer, and it isn’t maintainable if it doesn’t clearly and intelligently communicate our intent to other programmers.

Here’s another complaint of his with which I agree wholeheartedly:

There are no words, no photographs, no graphic design. It’s all “content,” which is “consumed.”

I hate this use of the word “content”. I don’t know what’s to blame: the business view in which everything is simply a generic widget to be either bought or sold, the developer view in which everything is just data to be stored, transferred or crunched, or some toxic Reese’s Peanut Butter Cup of the two. Referring to writing, illustrations, spreadsheets, photographs, music, videos, blueprints and so on — the very reason we use our wonderful computing gadgets — as “content” put them in second place, reversing the natural order. People don’t get things done in order to use software, they use software to get things done.

I hate this use of the word “consume” even more. Jerry Michalski hit the nail on the head when he said the word makes us sound like “living gullets whose only purpose is to gulp down products and crap out cash.”

For extra credit: Watch the keynotes where Steve Jobs introduces the iPad and Steve Ballmer and company introduce the Surface tablet. Count the number of times the word “content” and “consume” or “consumer” appear in each. Note the difference.

Here’s the conclusion of the article:

You can do anything you want with an idea. It can be as big as you want. It doesn’t have to solve a minor problem that nobody ever really realized was a problem. It doesn’t have to fit into something the size of a button crammed into a “folder” the size of a button on a screen the size of a playing card. But everywhere I look, I see tiny little ideas, ideas that are almost petty in their inconsequentiality. And I come back to those cliches, and I think the real problem is in how little thought goes into the language these people use. When the language you employ to communicate your ideas is small and boring, your ideas are going to be small and boring. And when all your ideas are small and boring, your future gets dimmer and dimmer and more claustrophobic until it’s finally just a pinpoint of light on a dark screen, in danger of going out at any time.

If you’ve read 1984, you should be reminded of the Newspeak language, whose purpose was to reduce the scope of thought by reducing the scope of the language to express it. “It’s a beautiful thing, the destruction of words” is a line uttered in the book by a Newspeak dictionary editor, and it’s meant to be appalling. We, as people for whom ideas are building material, should be just as appalled when we practice “linguistic nihilism” in our work.

Here’s the reason you should hire me: I’m a techie who can communicate very well. I don’t sound like the people who made Constant want to die.

Go ahead, re-read the paragraphs above if you need proof of my ability to string words and pictures together into an enjoyable, cogent essay. Read the back catalogues of articles in my personal blog, The Adventures of Accordion Guy in the 21st Century, and in my tech blog, Global Nerdy. Take a look at my latest project on GitHub: inPulse Magic 8-Ball, a tutorial on developing apps for the inPulse smartwatch.

I also give great presentations, in which I make my explanations clear and lively, with a minimum of jargon. Here’s HTML5 and RIAs: Friends with Benefits, in which I talk about HTML5 and rich internet application plug-ins such as Flash and Silverlight:

Yes, that’s my velvety-smooth voice.

Here’s one of my most popular live presentations, Squeezeboxes, Startups and Selling Out, a “pep talk” I gave at CUSEC 2009, a conference for computer science and engineering students:

And finally, as proof that I can do presentations with any competent and cooperative co-presenter, here’s an episode of the children’s web show Developer Jr., where my co-host is a puppet:

If that’s not enough, I can also rock out. On the accordion.

I understand technology and I know how to communicate ideas to other people. Simply put, I’m a tech evangelist. If you have a software company, whether it’s a one-person startup or a Fortune 500 company, you just might need someone like me. I’ll augment your good ideas with mine, and I’ll tell the story of what your software can do, in a way that no one else can.

Here’s my LinkedIn profile; here’s my resume [107KB PDF].


Microsoft Developer News Roundup: Microsoft’s Build Conference Sells Out in an Hour, Windows 8 Pros and Cons, Windows 8 UI Described as Bad Fit for Desktop, Surface 2 Already Being Worked On

Well, That Was Quick.

Microsoft’s Build 2012 conference, the current version of what used to be known as the Professional Developers Conference (PDC), sold out in an hour. The conference, which will be all about developing software for Windows 8 and companion technologies such as Windows Azure, Windows Server 2012, Windows Phone, Office 365, Bing, Visual Studio and Xbox, is scheduled to take place from October 30th through November 2nd, mere days after the release of Windows 8 to the general public on October 26th.

The first conference under the “Build” name was held in 2010 in Redmond, with 1,000 attendees, each of whom received an unlocked Windows Phone 7 device. The 2011 conference took place at Anaheim Convention Center where 4,000 attendees each received a Samsung tablet loaded with a developer preview of Windows 8. Build 2012 sees the conference return to Redmond, which sets a natural limit on the number of attendees they can take in — presumably at or near 1,000.

A more cynical person would remark that limiting attendance to 1,000 guarantees that the event will sell out about as quickly as Apple’s WWDC (5,000 attendees, sold out in under two hours) and Google I/O (5,000 attendees, sold out in 20 minutes).

Update: An earlier version of this article erroneously reported that Build 2011’s attendance was 1,000 instead of 4,000. Thanks to Guy Barrette for spotting the error!

TechRepublic’s List of Windows 8 Pros and Cons

TechRepublic carried out a survey in which 1,888 IT pros were asked if their companies were going to upgrade to Windows 8. The results, including the most common reasons why they will or won’t upgrade, are in their infographic below:

Infographic courtesy of TechRepublic. Click to see the original.

Sascha Segan’s Not Impressed with Metro (er, Windows 8 Style UI)

“Don’t call it Metro. Call it overkill,” begins Sascha Segan’s PCMag article, titled Microsoft’s Massive Metro Mistake. He says that while it’s suited to touch devices like tablets and phones, a big market where Microsoft is playing a desperate catch-up game, it’s a poor fit for desktop and laptop computers. On the tablet and phone side, he says that Windows RT lives in that uncomfortable in-between zone between phone-style OS and dekstop OS. He says that RT will be especially disappointing to corporate and hardcore Office users since Office for Windows RT won’t support VBA.

This isn’t the first time someone with a large audience has said “Windows 8 on mobile devices, good; Windows 8 on desktop, bad,” but we have to keep in mind that the other person was from Gartner, who have been known to make terribly, terribly wrong predictions (including ones about the size of the Windows Phone market).

I’m running the latest release candidate of Windows 8: one on a Dell laptop and one on an HP TouchSmart desktop machine with touchscreen. I tend to dismiss the Metro screen and drop into “Desktop mode”, especially on the laptop.

Already Working on the Next Version of Surface

According to this TechRadar article, Microsoft’s job board says that there are a dozen job openings on the team working on the next iteration of Surface.

This shouldn’t be too surprising for a couple of reasons:

  • When Microsoft commits to something, they take the long view. When I was working at Microsoft and Windows 7 had just come out, I’d already heard about some things that were going into Windows 8.
  • They have some serious catching up to do. Many enterprises — Microsoft’s best customers — are already standardizing around the iPad, and the last thing Microsoft wants to do is lose the tablet war for those customers.

Mobile Developer News Roundup: LinkedIn TechTalks on HTML5 Mobile Apps and jQuery, and jQuery Mobile 1.2.0 Alpha Announced

It’s a holiday in my neck of the woods here in Canada — the Civic Holiday — so I’m making this Mobile Developer News Roundup short and sweet. To all of you who get the day off, have a good one! To those of you who have to work today: well, I was doing some job hunt-related stuff, so I was doing some work anyway.

LinkedIn TechTalks on Building Performant HTML5 Mobile Apps and jQuery

They’re new to me, and they might be new to you: LinkedIn holds regular “TechTalks” on various development topics at their Mountain View headquarters, which they also post online. The latest two TechTalks they’ve posted are Building a Performant HTML5 App, featuring some of the HTML5 mobile app tricks they use (posted above), and jQuery at LinkedIn, a tour of the really cool things that it does and how they use it at LinkedIn, posted below:


jQuery Mobile 1.2.0 Alpha Announced

According to the announcement, this release features “a new popup widget, an autodivider option for listviews, and a host of enhancements and fixes throughout the library to make things smoother, faster, and more polished.”


The “Developer Middle Class” Gets a Boost From iPhone and Android App Stores

ReadWriteWeb take a look at Flurry Analytics’ blog post, The Great Distribution of Wealth Across iOS and Android Apps, and make these observations:

  • Apps are bringing in more money as more people buy smartphones and tablets. Flurry’s estimate of the value of the app ecosystem, which includes in-app advertising, is just shy of $9 billion for 2012.
  • The growth of the “long tail” in mobile app stores is growing the “middle class” who are neither the top sellers nor at the bottom of the market.A larger proportion of developers is reaping the benefits.

For more on this “middle class”, see the section on “The Next 19%” from my mobile roundup on July 31st.



Microsoft Developer News Roundup: Metro No More, Visual Studio and .NET Final Builds, Speeding Visual Studio by Optimizing the Toolbox and Windows 8 Hackathons in Canada

Metro No More

Don't call it "Metro" any more

As luck would have it, Microsoft is discontinuing the use of the term “Metro”, the name for the design language behind Windows Phone 7 and later, all of Windows 8. It’s a great shame, because it was an unusually pithy and catchy moniker to come from a company that thought that giving products unwieldy names like “Microsoft Server 2008 R2“, “Windows Phone 7 Series“,  and “Windows RT” (Windows 8 for ARM devices) was a good idea.

According to The Verge, they’re working on a replacement term and have asked Microsofties to use “Windows 8 style UI” in the meantime. I’m just worried that the replacement term will be something like “Windows 8 Natural User Interface” or some other multi-word combination that fails to roll off the tongue.


Visual Studio 2012 and .NET 4.5 Have Hit their Final Build

Stick a fork in them: the final builds of Visual Studio 2012 and the .NET 4.5 framework are done! If you’re an MSDN subscriber, you’ll be able to download both on August 15, 2012. If you’re a subscriber with Visual Studio Professional, Premium, Test Professional or Ultimate, you can register for a free one-year developer account for Windows Store immediately as well. No date has yet been announced for Windows Phone developer accounts for Windows Store.

The August 15th date is a “soft launch” of sorts for Visual Studio. The “official” launch happens at a “virtual launch event” on September 12, from 9:30 a.m. to 12:30 p.m. Pacific Time (UTC-7). You can find out more on the Visual Studio 2012 launch site as on the blog of Jason Zander, Corporate Vice President for the Visual Studio Team.

The timing of these final builds coincides with the August 1st announcement that Windows 8 and Windows Server 2012 were released to manufacturing (RTM) and would become generally available on October 26. It was in keeping with their goal to release their developer tools “on the same cadence as our platforms”, according to S. “Soma” Somasegar, Microsoft’s Corporate Vice President of the Developer Division.


Speeding Up the Toolbox Bottleneck in Visual Studio 2012

On the Visual Studio blog, they’ve been writing a series of articles about boosting the IDE’s performance. In the latest article in the series, Visual Studio program managers Duke Kamstra and Chuck England discussed how they increased the speed of many common operations in Visual Studio by optimizing its Toolbox. In many test cases, these improvements sped up these operations dramatically — sometimes by orders of magnitude.

The Visual Studio team has been using performance data from PerfWatson, an extension included in the Visual Studio 2012 beta release which monitors delays on Visual Studio’s UI thread and if the user consents, sends performance and diagnostic reports when the IDE becomes unresponsive. Many of these “performance traces” were generated by the Toolbox, so the team profiled a number of solutions from customers as well as test solutions that would typify the source of a large, complex project.

From the performance traces, the Visual Studio team found a number of scenarios in which the Toolbox was a complete boat anchor that dragged down performance, particularly with large solutions. In one case, they observed that when closing a large solution, the Toolbox blocked the Visual Studio UI for an unacceptable 30 seconds. Even 3 seconds would drive you mad after a while.

They identified the following operations as the ones that provided the best opportunities for optimization:

  • Loading a solution
  • Opening a designer
  • Changing the build configuration (from Debug to Release or vice versa)
  • Building a solution
  • Closing a solution

The team followed a couple of principles in improving Visual Studio’s performance:

Don’t do anything you don’t have to do. The Toolbox ensures that the components it contains are up to date and relevant to the designer currently being displayed. The team discovered that Visual Studio updated the Toolbox window even when it was closed. They also found that when designers updated the Toolbox contents, they did so by clearing and then refilling it with all the components instead of simply adding or removing the components as needed.

Freeing the UI Thread. The UI thread responds to messages from the operating system and the user. Any long-running tasks on the UI thread prevent Visual Studio from responding to user input or messages from the OS to update the screen, making the IDE less responsive. They found that in many cases, work for the Toolbox was being done in the UI thread instead of being performed asynchronously in a background thread.

Kamstra’s and England’s discussion closes with this chart showing the performance improvements that their Toolbox optimizations made when using Visual Studio with their set of benchmark WinFoms-, WebForms- and WPF/XAML-based solutions:





Load Solution with Toolbox and Designer Open




Load Solution with Toolbox Open




Open Designer with Toolbox Open




Change Build Configuration with Toolbox Open




Rebuild with Toolbox Open




Incremental build with Toolbox Open




Close Solution with Toolbox Open





For the most part, the operations they set out to optimize now run significantly faster than in earlier versions of Visual Studio 2012.

Windows 8 Hackathons in Canada: I’ll See You at the Toronto One!

Microsoft Canada calls them “Windows 8 Hackathons”, but what they really are is free training for Windows 8 development. If you can spare a whole day off work (I can!) and want to learn how to build Metro — er, Windows 8 style UI — applications, you might want to check this out. Once again, they’re free — all you have to do is register.

The upcoming Hackathons will take place in:

  • Toronto: Friday, August 10 at the Ted Rogers School at Ryerson (I’ll be here — this event is waitlisted)
  • Ottawa: Friday, August 10 at Algonquin College
  • Montreal: Friday, August 17 at the BMO Amphitheatre at Concordia



tshirtOS: I Want One, and I Want to Hack on One!

I’ve given some thought to buying one of those geeky-yet-cool t-shirts lit up with flat LEDs or EL wire, but tshirtOS is the first one that I really want to buy…and hack on. It’s a project created by electronic clothes company CuteCircuit and sponsored by Ballantine’s, and it’s a “wearable, shareable, programmable and 100% cotton tshirt”. It’s also proof of a theory I’ve been espousing for a while: when whiskey and geeks get together, wonderful things can happen.

It features “a small brain in the t-shirt”, which is then controlled by “a big brain in your phone”, in the same spirit as the Pebble smartwatch. In their promotional video (shown above), they suggest a few possible applications, including a constant display of tweets tagged with your favourite hashtag. Perhaps a display that shows to the world how far you ran or walked today? A mood shirt? Magic 8-ball?

Here are tshirtOS’ known specs:

  • Processor: CuteCircuit has been experimenting with two types, both from Atmel — an 8-bit one (which, while sort of old-school, probably consumes very little power and should be relatively easy to program) and a 32-bit ARM Cortex chip (presumably from the same family as Atmel’s SAM4SD32).
  • Display resolution: 32 by 32 large pixels, driven by 1,024 ultra-thin RGB LEDs.
  • Other output: A pair of headphone sockets
  • Networking: USB and Bluetooth. Communication with iOS 4 and 5 is supported.
  • Sensors: Camera (tiny, with 32-by-32 resolution), microphone and accelerometer.

The shirt is currently a prototype, and has the price tag of a one-off. However, if there’s enough demand, they plan to take advantage of economies of scale and mass produce them at a more reasonable price. They’re monitoring the YouTube hits (and presumably other online sources) for that demand, so if you want one — and wow, I do — make some online noise!