First of all, if you haven't read the first post I highly suggest you to go and read it to get a basic knowledge of what we'll be talking about this time; if you feel like going on anyway, just be sure to at least read the list of many different programming languages I posted, it will come in handy.
Ok, let's dive in the crucial points of this lesson:
How do I choose a programming language?
Some of you may already know that planning ahead what you want to build is always a good practice, this applies to every aspect of real life as well. A carpenter does not build a piece of furniture by adding random wood pieces together, he researches what type of wood fits best his uses and, to know beforehand what he'll be needing, he has to know what he wants to build. This rule of thumb is fundamental in computer programming because more often than not you will find yourselves trapped inside a project bigger than yourselves and you may be forced to restart everything from the beginning with a different approach till you get what you really wanted. Something like this cannot be completely avoided, but a bit of reasoning behind your whole project will help fixing it. Going back to the carpenter example, though, there is one fundamental detail that must not be skipped: to know which wood fits best his project he has to know all different types of wood qualities/uses and how to work them, hence he won't have a limited array of choices to choose from, which is something not suggested.
How can I learn all the programming languages on Earth in no time?
This, my friends, is the most important information you will need in this lesson: all programming languages are the same, there are only minor differences from each other and the theory behind them all is just one. What you now have to learn is how to handle the theory behind computer programming well and you will be set for life. That is the hardest point to manage and is what screws many newbies in software development. The average home-schooled programmer will learn, in his lifetime, at most two or three different programming languages (plus dialects and different implementations) and will feel like he has mastered them in no time, however when facing a new language or piece of code, he won't be fully able to understand it because he'll be lacking the theory behind it. This is something you'd want to avoid and that's the reason why I'm trying to give you a complete and competent view of all the different possibilities ahead of you. If you'd rather just start programming straight on, without knowing what you are doing, Google has got plenty of tutorials for every programming language you may want.
The universal language.
Unlike real life, in software development there is a language that every well-schooled developer understands which is called a Flow-Chart. Technically, a Flow-Chart is not a language, it is a diagram. A picture used between software engineers (and also in industrial engineering, where the Flow-Chart was born) to exchange informations regarding a process, a certain number of steps, from the problem to the solution of the said problem. But what does this have to do with computer programming? Everything, and here on read why:
The Algorithm, let the computing magic begin:
What is an Algorithm? This is what probably most of you are asking yourselves while reading this, and that's why I'll try to be the most explicative I can without going into too many details, because it could get pretty complex. Quoting wikipedia: "In mathematics, computing, and related subjects, an algorithm is an effective method for solving a problem using a finite sequence of instructions".This is really all you need to know about it. This is what computer science is all about, finding a solution to a problem through the means of an algorithm that tells a calculator (our computers) how to walk from the problem to the said solution. This, actually, is what everybody does in real life as well when approaching different scenarios in their everyday's life.
Understanding algorithms before everything: how to program breakfast?
Before I explain how a Flow-Chart works and how to approach different programming languages, I want to get the concept of Algorithm and problem-solving stuck inside your head with a nice example to make it even easier to understand. One thing everybody does in their everyday's life is having breakfast, so let's try to understand this common scenario with a problem-solving approach and see how it works:
Imagine a guy comes to you with a statement and expects from you a direct, informative answer; his statement is: "I have a problem, I want to learn how to make breakfast for myself every morning, however I can only follow a definite number of steps and actions and I cannot learn them, I have to read them on a piece of paper everytime I do them and I need your help: I want you to write down every single step to have a nice breakfast, how can I have breakfast?".
First, we'll have to understand what we require and where we want to go, in order to give informative answers to this poor breakfastless guy. The problem we have here is the following: How to have breakfast? We need to find a solution to this and, to most of you, the solution should be pretty clear, it can be divided in these steps:
1) Wake up. (we'll be skipping all the prior-breakfast activities here)
2) Walk to the kitchen.
3) Take every item you need for your breakfast (it may vary depending on your breakfast).
4) Set the table.
5) Prepare the food you like.
6) Put food inside a plate/bowel/whatever.
7) Hold spoon/fork/knife/chopsticks/whatever.
8) Use said tool to get food from the plate to your mouth.
11) Rinse and repeat till breakfast is over / you're full.
12) Clear the table.
13) Wash dishes.
This is what an algorithm looks like and is what our computer asks us, in the form of a written (well, typed) programming language, in order to solve our problems for us. We give it the problem, an algorithm, and it gets us straight to the solution (if it's possible). Our task as software developers is to define the algorithm for the given problem and code it in a way the computer can understand it.
Algorithm and Flow-Charts go hand in hand.
For every algorithm, there exists a Flow-Chart describing step by step how to get from point A (the problem) to point B (the solution), this is upon what we will be basing our programming experience. Except some easy, down to Earth, algorithms, you will need (trust me, you will) a Flow-Chart (or similar) to describe every step you have to approach/code in your projects before you get down to the actual programming part. In most projects, the stages behind the coding are the most difficult ones but also the most important, with a well written plan and nice Flow-Charts describing every algorithm you will need, you will see your project taking shape way faster than expected and with less bugs than usual. I won't really go into how to understand a Flow-Chart (regardless of how simple it is) and if you really want to, there are lots of tutorials on Google about it (Wikipedia is nice as well), I will just tell you how to read it showing you an example of the breakfast algorithm:
As you can see, all you just need to do is get from point A(top) to point B(bottom) in the simplest number of steps.
Unfortunately, even today I wrote more than what I expected, so I can't get to the "fun" part yet. I will have to postpone the presentation of the languages to the next lesson. I'm really sorry, but these posts are really bigger than what I thought.
Next week I'll talk about all the languages I mentioned in the first post and how to transform a Flow-Chart into a code the computer can understand. In the meantime, I'd suggest you read up a little of Algorithm theory and Flow-Chart designing, there are some interesting links on Google which you can't miss. See you in the next lesson!