Hello! I have a friend that is really interested in programming, I'm going to try to teach him this summer. I'm posting this to begin a discussion on how I think I'm going to acheive this so he has the best understanding of everything down the line. The title of this is a metaphor, bottom rung of the ladder being low level computer stuff, top rung being high level/scripting languages.
Most times when I see someone self taught or learning, they start or started with a high level language, like Python, Some form of BASIC, or PHP. I find this starts someone out but hinders the user greatly down the line, these languages are meant to be simple and easy language someone can use to quickly write something up, NOT a learning tool. People that start with these languages I find have incredibly bad habbits and due to the abstraction have no clue what is going on underneath and can't appreciate it or optimize. Other than these habbits, people tend to stick to this language for a long time, because they like the sense of knowing a language, they don't want to return to not, and with languages like Python they have to relearn tons since Python (like) syntax isn't used often...
With my friend I want to dodge this bullet, by starting from the bottom rung. First thing to do would be teach him how a computer works, especially the processor. Secondly we will spend a considerable amount of time in x86-64 assembly, learning instructions and how they work. With assembly knowledge he will understand how programs actually work and what goes on behind the scenes in a compiled language.
After there is a thorough understanding of these low level concepts I will begin teaching him the C programming language. With one exception, I won't be teaching it like most people. Some people learn the C language without any clue about what's going on behind the scenes, blindly calling printf etc... He definitely already knows some of what is going on behind the scenes but he needs to more specifically about C. To teach him this, we will start in C with nothing. I will be sure he doesn't link with the standard library and it's just raw C. What is raw C? Raw C (there is rawer I suppose but I'm speaking in terms of OS executable) is just C without the standard library and runtime. The standard library and runtime does much more than you think, consider this:
int main()
{
return 42;
}
That's code with the runtime. Without the runtime this won't even compile. This is because the actual name of the entry proedure identified is _start
. When using the runtime, _start is automatically included calling main
, _start
does another important thinf though.
int _start()
{
return 42;
}
This code will compile without the runtime but it will fail on execution with a segfault or something of the like. This is because we need to tell the operating system the program is done when it's done, which the runtime normally does by itself. There's also standard input/output procedures I will have him implement. This will give him a bit more practice of practical assembly, teach him the simplistics of the C language (procedures, variables, various statements etc...) and give him more understanding about what is going on behind the scenes in the runtime giving him the ability to reproduce it later, or appreciate it and use it more efficiently. Once this is finished we will continue with more practical and every day C, teaching him all of it's features which should be easy if he learned assembly, even easier if I correlate the instructions to statements a bit.
Once he is able to write a nice C program I may work with him on some practical stuff or a Object Oriented Language a bit (D probably, because its awesome and C++ is ugly and gawd awful), then let him lose to explore the world. With all of this low level knowlege and C experience he should be able to comprehend almost anything and teach himself anything else he needs to know. In the end being much, much, much smarter and competent then someone starting on the top rung maybe even in a shorter time.
Thoughts on this somewhat unorthodox way of doing it?