In the first part I talked about resources. In the second post, I mentioned the need of logic and visualization. In the third post I talked about various platforms and the need to pick one to start with. In the fourth post I talked about modeling techniques, the development process and the need for documentation. And now I want to start talking about the first programming language that you should learn, plus the book that will teach you the basics.
This first language should be the Standard C language. Also known as ANSI C or ISO C, or just C. Developed by Dennis Ritchie, who died in 2011 but who also pioneered at developing a programming language meant to create operating systems. Or actually, just UNIX. And the reasoning behind this programming language was that this single language should be able to compile application for all operating systems and computer platforms and a piece of code should do exactly the same on all those platforms. And C supports so many processors and operating systems, making it one of the most important programming languages ever.
The book you will need is “The C Programming Language” by Brian Kernighan and Dennis Ritchie and is less than 300 pages with only 8 chapters and two appendices. And that’s another reason why you should start with C. This language is just plain and simple, yet contains the most important things you will need to learn about programming.
And remember that I have said that programming languages themselves are not important. Using the right technique is. You use languages like tools to solve a problem by making a product. This is also true for C. You should learn it but chances are that you won’t use this language that often. However, many principles in C are also common in other languages. And the C syntax has been borrowed by various other languages too so if you’re familiar with C, you will be able to handle quite a few other programming languages.
If you spend a day on each chapter and take two extra days for the appendices then you’d need 10 days to go through the whole book! In a normal work week, that would be just two weeks to learn a new programming language. The most complex part will actually be working with pointers and memory, which is just something you should know about before moving to other languages. You should understand the principles behind it.
Programming isn’t complex anyways. You’re generally just dealing with three things. You have basic statements, which e.g. assign a value to a variable or display a text on the screen. You have conditions where you will decide which step you will take next based on some value. And you have loops, which allows you to repeat a group of statements.
And there’s something that you can call a compound statement, which is basically a combination of statements, conditions and loops grouped together to create a “new” statement. In C, those are called functions but in other languages they’re also called procedures or methods. And you use these to add structure to your code.
And understanding structure is important in programming. Any data that your code will process will be in a specific data structure. And the code you write will also be in some structure. And even your computer in connection with other hardware will have a specific structure. And as a programmer you will have to use a lot of structures.
So, the C language is generally quite simple. But it is made more complex because the language allows programmers to create very badly structured code and with a lack of documentation, such code becomes extremely difficult to read. Still, C is extremely popular and it is likely that you will have to deal with projects that were developed in C.
For example, most operating systems. Linux, BSD, UNIX, OS X, IOS, Android and Microsoft Windows are all operating systems where the developers used C to write these. And a graphical library like OpenGL is also based on the C language. And these are all extremely complex projects but they have all histories that go back several decades. Even the old MS-DOS was a mixture of both C code and Assembly.
A game like NetHack is also written in C because it has a high performance and because it allows the game to run on basically any platform.
But I’m not telling you that you should learn C to use it, but to better focus on the basics of programming itself. Learn it, then focus om other programming languages, including the various Object Oriented programming languages.
After learning C you could consider C++, Java, C# or even languages like FreePascal, PHP, Python, Visual Basic and many others. But those languages all are way more complex than plain old Standard C. Especially the addition of OO in languages like C++ and Java will add quite a bit of extra complexity.
But C tends to scare off some people just because such complex projects have been created with it. And because some programmers have actually written cryptic C code to confuse others who try to read it. You can actually obfuscate your C code by removing spaces and line breaks and by using various shorthand notations and little tricks. There’s actually a competition to create obfuscated C code, held yearly since 1984!
Don’t be scared to learn C! Once you learn it you will realise that it’s actually quite simple. Don’t try to immediately write complex applications and especially don’t try to make complex GUI applications or 3D render engines with OpenGL because that is way too complex to start with. Start simple by creating console applications like Hangman, where you type letters to guess a word. Use a plain text as user interface since you will learn to make complex GUI applications in the future, once you’ve improved your programming skills! Focus on the C language first.