Friday, December 21, 2012

C Is Your Friend

The C Bible

I read a post today about Why C++ Is Not Back. I've been thinking a lot lately about the various languages that exist and why people hate on C and C++ and insist they aren't relevant (I'm not saying the above post is guilty of that it just got me thinking about it). I want more software developers to get into firmware development. I'm not talking Raspberry Pi or even Arduino. I'm talking about buying a $2 PIC or AVR microcontroller and writing C code to make it do cool stuff. But when I talk to people it's always the same thing, "I have to write in C? Ouch."

What Are You Afraid Of?

Most software developers I know are smart people who are good at solving complex problems. Why are you so afraid of C? Is it the memory management? Is it the pointers? People, these are not hard things to understand. Certainly no harder than dependency injection or inversion of control. Are pointers harder to grasp than writing multi-threaded code? In my office my .NET books stack well over 2 feet high. 840 pages of LINQ. 1000 pages of WPF. 680 pages of C# Object Basics. Almost another thousand pages of ASP.NET MVC. On and on. And then there is my C book. The only book I reference for C questions. 274 pages of basically all you need to know about C.

Get Ready For A Change

So what's my point? C is really not that bad. I'm not suggesting you write everything in it. Not at all. I love C#, Ruby, etc. They're great. I do think, however, that there is going to be a growing push for software developers to contribute more to hardware development as the Internet of Things takes off and every major corporation tries to carve out it's share of the loot. Now I know what you may be thinking. "You're right man. That's why I bought me a Raspberry Pi and I hack on that." While the Raspberry Pi is an amazing little device that pushes the limit on cool factor it simply is not what companies will be using to connect their devices. Not even close. They are using low level microcontrollers that have C code on them.

C is Not Back....But Relevant

So I'm not trying to start the "C is back, join the revolution" movement. In fact as hardware gets faster and smaller I think we will move on to higher level languages being closer to metal (Node.js on a PIC anyone?) but we're still a ways off from that. C is still, and will be for years to come, the go to standard for embedded development. And may I even suggest that learning C will make you a better programmer in your other languages. It certainly did for me. After all, being good at memory management never hurt anybody.