I’ve never been able to self teach myself something unless it’s very intuitive… and that’s where I’ve been falling short here.
Computer programs do exactly what the programmer tells them to do. In some sense, that makes them ultra-intuitive. If you see in a program “6+7”, you know what the answer will be. Programming is more complex then that though, and you never stop learning. I started programming years ago, but I still find code I wrote last week “I did it that way? What an idiot I was, this way is much better”
The problem is that a huge amount of programming is language independent. You won’t find any language since the 80’s that don’t have functions:
python: def function_name(parameters)
C: return_type function function_name(parameter_type, parameter){}
etc.
And many ‘introductory’ books and tutorials forget that people new to programming don’t know what a function is. (Hint: think of a program as a recipe book, and a function is something like “Make a white sauce,” a small recipe used in other recipie’s).
Someone needs to write a “Generic Programming Guide” that teaches you all these concepts.
So here are a few genericisms:
Variables = A convenient way to store data so it can be used in multiple places. Example: num=10 sets the value of the variable “num” to 10. You can then do math such as other_num = num + 20. Not all variables are numbers. They can be strings and other more abstract things.
Function = Small programs that can be run multiple times with different sets of data. Think of an oven as a function called “bake” If we pop in some eggs and flour we may get out a cake. If we put in pasta and cheese, it may produce a lasagna.
Loop = A way to run a bit of code lots of times. A “For” loop runs the code for each element in a list. A “While” loop runs code until a certain condition is met (eg until a certain time).
List = A collection of variables in order. Like a numbered set of bullet points, the data stored in a list can be extracted using it’s number. To get the first item in a list in many languages: data = list[0]
Dictionary = A collection of variables stored by an ‘index,’ often a unique string. Just like a physical dictionary, you get the data when you look up it’s name. To get an item in a dictionary in many languages: data = dict[“index”]
Objects = Now this is an interesting one. Let’s say we want to represent a space ship in code. We can create a collection of variables, functions and wrap them all up into an “object.” Our spaceship may have an internal parameter called “fuel” and an internal function called “useEngines().” You can have multiple instances of these objects, and because the data is internal, they will be unique. Note that a string is an object. It stores it’s characters internal to itself, and in many languages has functions such as “string_instance”.split(’_’)
Instance = A single ‘copy’ of an object.
API = Application Programming Interface. The programmers bible for some other program. For instance playcanvas’ api tells anyone who knows how to use javascript how to use playcanvas. The Stellaris EKS-LM3S1968 (a microcontoller) also has an API. A lot of hardware has an API, and a lot of software has an API. It takes upwards of a month to become familiar with an API. This is the answer to your sample question. It’s our “book of commands we refer to,” and unless you’ve programmed the same program for a couple years, I guarantee you that you’ll need to refer to it.
Syntax = Every language has a syntax. It is the rules that say that: “In javascript an ‘if’ statement shall take the form if(LOGICAL_EXPRESSION){}” It specifies the layout of the () the {} and the ;
Every language has a different syntax.
There are of course a lot more generic programming concepts, but hopefully this gives you a little heads up.