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?

Recommended Answers

All 18 Replies

I've taught both ways, and high level to low level works better. Going the other way just results in an excessive amount of prerequisites to do anything meaningful, and the student either gets bored or frustrated. Starting higher level while making it clear that there are important things going on under the hood that need to be understood later seems to produce better results.

I agree with deceptikon. Learning the way you describe is nice from the perspective of acquiring a deep understanding of everything. I did something similar with mathematics, from basic logic axioms up to calculus of variations, and it was very enlightning and amazing. However, doing this requires, as a pre-requisite, a strong and unwaivering interest in the subject matter. I already did a lot of math and loved it before I went on this bottom-up journey. You have to build the passion and the curiosity before you go on that road.

Remember, the challenge of teaching is not about what is the most logical way to present the material, it's about sustaining interest or fostering a passion for the subject. If you had a matrix-style brain-plug, I agree that your description would the correct order in which to download the knowledge (bottom-up), but until then, we are stuck with those real challenges of pedagogy.

Personally, I sort of learned from the top to the bottom. I started with a language heavily inspired from Visual Basic (a kind of open-source clone of VB). I was instantly hooked on this amazing power to create applications that looked just like the "professional" software, I was just amazed that I could do that with just a bit of brain-to-finger gymnastics. I got tired of the limitations of this VB-like language (and library), so I moved on to something more "mid-level", which was Delphi (an object-oriented language somewhere in between C++ and C#, but derived from Pascal). At that point, whole new worlds was exposed to me, that of 3D graphics, professional GUI applications, and so on. Then I moved to C++ when I got convinced of its superiority over Delphi, and never looked back. And from there, I delved deeper, but only did so whenever needed (or felt I lacked in understanding).

I would generally recommend something similar. Early introduction should be done in a high-level language that will grab the attention of the student and let him discover that awesome well of creative power. But then, move on quickly to a "proper" language (C++ or D).

As for teaching C, I would say, don't. I see no purpose, in today's world, to teach C specifically. Teach C++ or D, with some C alongside. The way you program in C (procedural programming) is extremely important and very powerful, but you can do that in any decent multi-paradigm language. I never learned C, and I rarely use it, and when I do, knowing C as a subset of C++ is perfectly adequate. And, with native languages like C++ or D, you can teach all the good low-level stuff too.

Interesting...
You both make very good points, not sure which I'll do though.

Although Mike, I disagree with your opinion on C. C is a very important language, some may think it's ancient and has been superseded (multiple times) but it's still incredibly important and useful to know about.

When you learn to play a musical instrument there is a reason that music theory is not taught until the basic playing skills have been acquired. As Mike says, it is important to keep the interest up and that means getting the student to write something quickly. It doesn't have to be anything fancy. It only has to give the student a feeling of accomplishment. When I was in university we didn't learn assembler until second year. By that point we'd learned that anything complex requires time to accomplish and we'd developed the patience and the skills to craft a program with care and forethought.

I would, however, take some time at the start to teach how to break up a problem into smaller problems. This can be done in one or two lessons and does not have to involve writing any code. One of my favourites is to get the student to write down the steps required to tie shoelaces.

Oh I see... Maybe I should flip it around a bit... I'll work on it. I see what you're saying about accomplishment/results, I really got going with PHP because I could get almost immediate results in my browser, is this a good idea?

I really got going with PHP because I could get almost immediate results in my browser, is this a good idea?

To keep someone interested, maybe. To learn programming, probably not. I'd prefer to teach somebody C#/WinForms which has results just as quickly, but has the advantage of type checking, and a proper class structure.

Try to visualize what it is he wants to learn, and you want to teach. If that's clear, choosing the "better" language will be easier.

If he wanted to learn how to drive, would you start by teaching him how a car is built from the ground up?

start with a language where you can simply see something on the command prompt after typing it in, like Python or Ruby.
Java and C are almost as simple.

PHP? Why make things harder by requiring correctly configured application servers as a prerequisite for getting things working?
And then a language that's incomprehensible :)

Member Avatar for iamthwee

As much as I hate to admit it. Python. To me the syntax always sucked. I only used it once seriously.

But everyone says, start with python. Is the easiest to understand. Then you can move on to other things. PHP is definitely worth considering as Web Dev is highly sort after these days.

You all make interesting points.

pritaeas, interesting idea but I'm trying to get him to work with Linux because Windows is inneficient and a pain.

jwenting, almost any language you can see something in the 'command prompt' after typing it in. PHP doesn't require much configuration, especially if you're running something with a package manager, you can grab it and get it running in minutes, technically you don't even need a webserver, you can just write scripts and get output from the interpreter.

iamthwee, everyone I've ever met that started with Python is sadly, "a python developer/programmer". I'm not leading him by starting with a slow, annoying, nonsensical hell. I would rather use ruby or something to be quite honest.

I've been interested in programming as a hobby for about 4 years.

The first 6 months odd I used a scripting language called AutoIt, which despite its description on the home page is incredibly powerfull while stupidly easy with a huge catalogue of standard libraries to draw on.

It was incredibly useful to me when making switch to C C++ windows programming.

Pro's: Simple powerful, and can create functional worthwile applications very quickly.

Con's: Windows only.

Worth a look.

Member Avatar for iamthwee

LOL right... You would rather use ruby than python because it is a nonsensical hell. Hmm, I looked at ruby and the syntax looks pretty much the same. OK...

So in this thread you've pretty much slated off all the advice you've been offered and made pretty sweeping remarks, 'windows is inefficient and and pain', 'c++ is ugly and god awful.'

Hey that's fine you're entitled to your opinion. To be honest it seems like your mind is pretty much made up. Good luck with showing your friend the entry points in a C program.

See learning a language and teaching is something totally different. Teaching requires not only a passion for the subject but an inate ability make learning it ENJOYABLE and easy to understand. It requires an ability to cold read the personalities of the people/children you are teaching to make sure they respond to your style of teaching.

It is sooo, sooo much more different than just using what you might think is a good first language and running with that.

But hey don't let me stop you. You've made up your mind, hey be sure to tell us how your 'bromance' goes.

Suzie999, Thank you for mentioning AutoIt. I haven't decided to use it but it did make me remember another system I heard a friend talking about while back, it's called Processing. I could be beneficial in the sense of quick results and a sense of accomplishment which was discussed above. It's a language with a C-like syntax that produces visual results.

iamthwee, Python and Ruby do look similar. BUT Ruby promotes better practice and it just makes more sense. Ruby also supports OOP much better imo.

Member Avatar for diafol

Your student's needs may be very different from the things that you intend on teaching. I'd encourage you to teach a high level language that the student could pick up quickly and get "fast results" and be able to work independently. Teaching is very important, but active learning is where it's at. I think the amount of teaching involved with low level languages would greatly outweigh the independent learning which is essential for garnering and maintaining interest in the subject.

As pritaeas mentions, although I love it, PHP is very loose and can help develop bad habits or not introduce concepts essential in other languages. However, it does have the advantage of allowing a student to grasp the basics of common constructs very quickly. It's also grown up a lot over the last 10 years too.

I'm an enthusiastic hobbyist and totally self-taught, so I can't really comment too much on the teaching of programming (other than that I am a teacher by profession - but in a different field), but I would encourage you to provide your student with simple step-up real-world challenges / scenarios that will keep him engaged, and perhaps interject hard theory - or explain how some of these commands work behind the scenes at the appropriate time - not enough to able to write low-level stuff, but enough to give him a very basic appreciation of what some of the high level stuff is doing.

Nard, a lot of languages don't even have a command prompt any more, 90% of the first several weeks learning them is spent learning some IDE's menus and keyboard shortcuts...

Of course the whole idea of "teach yourself computer programming in 24 hours" is decidedly silly.

Member Avatar for diafol

learning some IDE's menus and keyboard shortcuts...

IDEs ?? From what I gathered, we need to be looking at punch cards :)

nah, ticker tape is much more flexible and you don't have to resort it every time you drop a bunch.

much more flexible

Flexible, yes, but just try to correct a typo mid-program ;-P

People talk about the plaintive cry of a a loon or a lone wolf baying at the moon. If you want to hear a sad sound, it's the sound of someone who has dropped a 600 card deck of unsequenced cards the day that his assignment is due. Chilling.

oh, razorblade and sticky tape. The original patch...

commented: Literally cut & paste. +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.