I don’t really know where that’s leading (forest). In essence, I want to learn about coding before I learn more coding, so that I can direct my studies in the directions I want to take them.
I think the “forest” is knowing different programming metaphors, and knowing when to use which one. A proper choice of metaphor will allow you to solve the problem more efficiently—which means that the program is not only quickly written, but also easier to understand (though sometimes only for people familiar with given metaphor).
By metaphors I mean things commonly called “programming paradigms” and “design patterns”; the former are more abstract, the latter are more specific templates for solving given set of problems. It is good to know these individual metaphors, and to be aware that they exist and you can choose the one you need (instead of seeing every problem as a nail, because you have completed a good hammer-using lesson and you are a certified hammer expert). Different programming languages put emphasis on different metaphors, which is why a good programmer usually knows more than one programming language.
A programming paradigm is an answer to question: What exactly is a program?
a sequence of commands for the computer
a collection of mathematical functions
a collection of facts and predicates (to be reasoned about by a standard algorithm)
a collection of small parts (objects) cooperating with each other
a collection of reactions “in situation X, do Y”
Depending on your problem, a different paradigm is useful. A functional paradigm is useful when you want to calculate functions. A command (imperative) paradigm is useful for tasks you could best describe as series of steps. An object paradigm is great for a user interface, together with “if this is clicked, do this” reactions. Sometimes you should use different paradigms for different parts of your program; for example a program for solving mathematical equations, with a user interface. Sometimes different paradigms support each other; for example you can write a list of steps to do, and then describe additional aspects such as: “and by the way, every time you read from a file or write to a file, make a note in the application log”.
On the bottom level (machine code) it is all a sequence of commands for the computer. Thus the imperative paradigm is most frequently used, because it is difficult to avoid in some tasks, while in other tasks you can still use it instead of other paradigms (even if it sometimes results in a horrible code). Object paradigm is great to split complex code into small manageable parts (although most people split complex code to complex parts, thus creating imperative/object hybrids), and it is also a popular marketing buzzword. Function paradigm is the right thing to do when you have functions without side-effects (the same inputs always produce the same outputs), because calculation of such functions can be cached, paralelized, etc. (Again, most people create imperative/function hybrids by writing functions that have almost no side-effects.)
There is a pattern here: most programmers are stuck in the imperative paradigm, and don’t really understand the constraints and benefits of the other ones. Many languages support multiple paradigms to allow you use them as you need, but this also allows the abuse. It is good to have an experience with a language that only allows one paradigm and nothing else, to understand the essence of the paradigm, so you can later use it efficiently in other languages.
In theory, a perfect programmer needs these skills:
high-level understanding of programming paradigms and design patterns;
mathematical insight to understand complexity of algorithms;
ability to communicate clearly, write clean code, tests and documentation;
detailed knowledge of necessary programming languages and technologies.
In real life, in most job interviews only the last skill is required, because it is most easy to evaluate by people who themselves don’t understand programming. (“Do you have Java experience?” Check. “How many years?” Write a number. “Did you also work with databases?” Check. “Do you know SQL?” Check. “Do you also know Oracle databases?” Check.)
I think the “forest” is knowing different programming metaphors, and knowing when to use which one. A proper choice of metaphor will allow you to solve the problem more efficiently—which means that the program is not only quickly written, but also easier to understand (though sometimes only for people familiar with given metaphor).
By metaphors I mean things commonly called “programming paradigms” and “design patterns”; the former are more abstract, the latter are more specific templates for solving given set of problems. It is good to know these individual metaphors, and to be aware that they exist and you can choose the one you need (instead of seeing every problem as a nail, because you have completed a good hammer-using lesson and you are a certified hammer expert). Different programming languages put emphasis on different metaphors, which is why a good programmer usually knows more than one programming language.
A programming paradigm is an answer to question: What exactly is a program?
a sequence of commands for the computer
a collection of mathematical functions
a collection of facts and predicates (to be reasoned about by a standard algorithm)
a collection of small parts (objects) cooperating with each other
a collection of reactions “in situation X, do Y”
Depending on your problem, a different paradigm is useful. A functional paradigm is useful when you want to calculate functions. A command (imperative) paradigm is useful for tasks you could best describe as series of steps. An object paradigm is great for a user interface, together with “if this is clicked, do this” reactions. Sometimes you should use different paradigms for different parts of your program; for example a program for solving mathematical equations, with a user interface. Sometimes different paradigms support each other; for example you can write a list of steps to do, and then describe additional aspects such as: “and by the way, every time you read from a file or write to a file, make a note in the application log”.
On the bottom level (machine code) it is all a sequence of commands for the computer. Thus the imperative paradigm is most frequently used, because it is difficult to avoid in some tasks, while in other tasks you can still use it instead of other paradigms (even if it sometimes results in a horrible code). Object paradigm is great to split complex code into small manageable parts (although most people split complex code to complex parts, thus creating imperative/object hybrids), and it is also a popular marketing buzzword. Function paradigm is the right thing to do when you have functions without side-effects (the same inputs always produce the same outputs), because calculation of such functions can be cached, paralelized, etc. (Again, most people create imperative/function hybrids by writing functions that have almost no side-effects.)
There is a pattern here: most programmers are stuck in the imperative paradigm, and don’t really understand the constraints and benefits of the other ones. Many languages support multiple paradigms to allow you use them as you need, but this also allows the abuse. It is good to have an experience with a language that only allows one paradigm and nothing else, to understand the essence of the paradigm, so you can later use it efficiently in other languages.
In theory, a perfect programmer needs these skills:
high-level understanding of programming paradigms and design patterns;
mathematical insight to understand complexity of algorithms;
ability to communicate clearly, write clean code, tests and documentation;
detailed knowledge of necessary programming languages and technologies.
In real life, in most job interviews only the last skill is required, because it is most easy to evaluate by people who themselves don’t understand programming. (“Do you have Java experience?” Check. “How many years?” Write a number. “Did you also work with databases?” Check. “Do you know SQL?” Check. “Do you also know Oracle databases?” Check.)