10 Days of Basic Programming, Day 1: Introduction
Do you wanna become a homebrew developer? Perhaps a PSP hacker? Are you just interested in programming in general?
You’re in luck, I will be guiding you throught the process of learning programming from scratch.
To define programming in general I came up with the following: programming is the art of telling the computer what to do, and watch how it ends up doing whatever it feels like. Programming and computers in general are exact science, but not always what you write is what you think you wrote.
That’s why you have to be very careful to understand all the various terminology in programming and make sure you’re using it right.
In /talk I have a very particular signature: any fool can write code that a computer understands, good programmer write code that a human understands.
This was written by Martin Fowler. I don’t really like Martin Fowler, I consider him to be one of the reasons why C++ and Java’s OOP suck ***, but this particular sentence is as true as it can be so creadit where credit is due.
When writing code it is very important to make it as maintainable as possible: code must be very well written, not be overly-complicated, make good use of the different design patterns there are and all the clean-code rules that most good programmers use. Remember, it doesn’t matter how badass you are writing code or how amazing the stuff you do is, what matters is the quality of the code. Also, project complexity doesn’t dictate code complexity. One can create a huge project that does loads of stuff with very clean and readable code, or a small project that barely does anything with really bad and dirty code, so don’t use project size as an excuse for code complexity.
It is also important to know that software is a vast world with many different areas of expertise. Don’t expect to be able to master everything as that’s impossible. One can be generally good in most (or even all) areas, but only be a master in some areas. Nobody can deny that Linus Torvalds is an excellent programmer and one of the best OS kernel developers, but you won’t see his name in AI, graphics or other areas.
This tutorial will teach you programming and general areas where it is used, mostly game programming for homebrews, but it is up to you to find your area of expertise and dig info on it.
For the sake of genericity I will avoid using any particular language in this tutorial, I will teach you programming in general terms and see how various different languages approach the different terminologies. Some people will probably tell you to learn programming with C or C++ to become a guru. That is B-U-L-L-S-H-I-T. Though C and C++ are a must to any programmer, knowing these languages doesn’t make you a guru, and my experience tells me that most people who start learning with C or C++ tend to write bad code as these languages are really versatile as to what they allow, and in the case of C there aren’t many coding conventions, and the ones there are aren’t properly taught or even taught at all. One example of this is ARK, VHBL and TN-X. They were great pieces of software that achieved a lot, but the code was horrible and painful to read and maintain. Most of the time spent on ARK was spent refactoring the code to make it more maintainable rather than fixing it or adding features. VHBL-Reboot, which qwikrazor87 and I worked on, is essentially a more maintainable version of VHBL, not much else changes.
Generally speaking you have to think about this when writing code: if I leave my code alone for several months and go back to it, do I want to spend too much time trying to understand what I wrote myself? The answer should be just plain NO, you don’t want to spend too much time reading the code trying to understand what you were doing back then. That’s why code must be as readable and understandable as possible.
Another important aspect of programming other than code-readability is efficiency. Efficiency can be a problem, or a minor annoyance.
In general terms, the closer to the hardware, the more efficient the language you have chosen is, but also the harder it is to code.
Higher-level languages provide you with tools and syntax that lets you code really fast, but they come at the expense of efficiency. A real guru is not one that can write any code in C, but one that knows which is the best language suited for a given problem. That is why in this tutorial I will cover all from low-level to high-level programming, and show you what are (to me) the two best lanaguages of each world: C/C++ and Python, as well as some mentions to other languages. You should by all means learn as many languages as you can, but those are my personal recommendations.
At the end of this series of tutorials (which will be really LONG, I expect them to take about 3 months) I will show you one of the projects I’ve been working on for personal use: CbC, an external C preprocessor that adds many high-level features to plain C code, similar to C++, but with a much different approach. With CbC I wrote Minefield Madness with much less effort than if I had written it in plain C, without loosing C’s performance.