Learning C

Posted on

I've made it a goal to learn the C programming language.  Why, you may ask?  Why am I subjecting myself to the pains of learning a language that was replaced by so many other Object Oriented Languages like C++, C#, or Objective-C?  Well, I'm glad you asked!  I've had several people ask me how they can learn to program for the iPhone or iPad.  Generally they don't have any programming experience (though some may have HTML coding experience), and they just want to write the next app that will allow them to get out there.  The thing is, if you go to learn Objective-C, every tutorial, self-taught book, and whitepaper assumes you have already learned an OOP language, and just need to port your skills over to Objective-C.  Unfortunately, that is not the case.  You see, in my experience, there are a lot of people that now have a platform that fits their imagination, and want to learn to program for this platform.  Generally they will either be graphic designers, educational professionals, or even just writers.  They have never had a programming class, or at least nothing beyond learning to write up a web page.  How are they supposed to wrap their heads around objects, structures, strings, arrays, etc. if they haven't had any formal training in the basics of programming?  So I made it my goal to teach an introduction to programming class.  Great, but what language?  If you are not familiar with the programming world, you may not know that there are several languages out there that could do the job as a primer.  There's C (of course), Java, Lua, Ruby, Python, Perl, and several others that I didn't consider.  So the question then became, how do I want the students to learn to program for the iPhone?  I first thought Java would be a no-brainer, as it's pretty standard for cross-platform programming, and the basis of the programming language for Android.  I figured I would just kill two birds with one stone!  But Java has a lot of built-in short-cuts that end up being bad practice when you try to learn Objective-C.  The same goes for all the other languages out there, except for C. C is unique because it is the basis of Objective-C.  All the tools you can use in C are there in Objective-C, plus additional tools that we could cover when we got there.  And as I took Objective-C primer classes from Apple, I found that starting from a language like C can help you develop a better memory-managed and optimized program for an iOS device.  Things were looking up. But how does one learn C?  Most programming books I found out there focus on C and C++ (another Object-Oriented Programming language like Objective-C), and they are not the same thing.  So I started scouring the Internet for some good tutorials, and started going through them.  While I went through them, I started writing my book.  Not to copy, obviously, but to make sure I understood the concept.  I would test it in Xcode to make sure everything worked.  If it didn't, I would start hitting up the Internet again to find out why.  So at this point I'm almost done with the content of my book, and I think I have a great foundation for anyone looking to learn how to program in Objective-C: learn C first.  As I went through the C tutorials, things in Objective-C that I just had to "accept" as right made sense.  I finally started to understand what the developers of Objective-C were thinking when they went that direction (instead of C++).  It's like learning Latin to get a better understanding of Spanish or Italian.  Or learning Latin and Ancient Greek to better understand Celtic, Sanskrit, or German.  It's all about seeing the basis, the foundation, and seeing how it grows from there.  Once I finish this workbook, my next project is to learn to program in Objective-C for the Mac desktop.  Again, it's just a stepping stone to move from there to the iPhone, and so many programs are now integrated through iCloud that it makes sense to be able to code for both.  I'm really looking forward to offering these classes!