Tutorial: Basics for Beginners (Introduction)
This tutorial is intended for beginners who have no or almost no computer programming experience. It assumes the reader is following the instructions and reading the text carefully. It is not intended to be a quick guide for filling in the gaps in a person's computer programming knowledge. The tutorial is a complete step-by-step guide on learning basics of computer programming. It will never skip over an important information, and it will never go too fast and leave you behind.
Computer programming requires a fair amount of time to master. You cannot expect to become good at it in a week or two, or even in a month. Anyone telling you otherwise is not being honest. However, the time invested will be more than worth it. Besides learning a useful, entertaining, and very creative activity, you will also learn a lot about computers and the way they work.
This tutorial is organized in short chapters, each covering a certain topic. Chapters are short enough to be learnable in a single day, and the entire tutorial (all three parts together) contains enough material for two to four weeks of study. We assume you will not just be reading the chapters but also following the instructions, which includes typing in the given programs on your computer and executing them. It is preferable to type in the programs instead of just copy-pasting.
Tip: on a desktop computer you can resize this web page by holding the Control key and then pressing the + or - key. Adjust the size of the text so that it is neither too big nor too small for reading comfortably.
Since this is a tutorial for complete beginners, we will be employing modern C++ in a beginner friendly manner only, making it extremely easy to learn.
Of all the programming languages, why did we choose C++? We could have picked almost any language, because learning the programming language is the easy part, the hardest part by far is to learn the concepts of computer programming. That is why this tutorial was carefully designed to convey the computer programming mindset to the reader.
It's hard to explain why we have chosen C++ without using too much technical jargon. In short, C++ has a feature called "copy construction", which other mainstream languages don't have. It simplifies the task of explaining functions, it makes functions easier to use and write, and, most importantly, gives beginners the right mindset regarding functions. More precisely, it encourages beginners to write functions without side-effects, as opposed to using non-pure functions, which are bad for beginners, and generally less desirable. The best part is that we won't have to explain or even mention copy constructors at all, they just work perfectly by themselves.
Image of a Julia set
Due to the age of C++, it has a greater proportion of experts compared to other languages. Consequentially, as most C++ materials are written for experts, beginners are poised to stumble upon materials not suitable for them. It is difficult to find a true beginner's book on programming in C++, compounded by many authors falsely labeling their books as suitable for beginners.
A skill like programming should mostly be acquired through examples and exercises. It follows that the choice of good and interesting examples is important. We are fond of natural, rather than contrived examples, that are both numerous and intriguing, with simple to understand explanations.
No Tools, No Craft
A physical tool employed to execute our programs for us is called – you must have guessed it – a computer. Although this tool may at times appear to display some level of cleverness, it has no mind of its own at all. It is still a completely mindless machine, with the single ability and purpose – to execute programs.
By executing programs, computers perform various tasks, which makes them as versatile as the programs we can imagine and write.
Of course, programmers would not be programmers if they did not think of some way to make computers help them in their own enterprise. Accordingly, they have created programs that help us write other programs, turning a computer into a programmer's most helpful tool. This tutorial will explain how to install such programming tools starting from Chapter 3. Afterward, those tools will be used extensively.