Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Education Programming

How To Teach a 12-Year-Old To Program? 799

thelordx writes "I've got a much younger brother who I'd like to teach how to program. When I was younger, you'd often start off with something like BASIC or Apple BASIC, maybe move on to Pascal, and eventually get to C and Java. Is something like Pascal still a dominant teaching language? I'd love to get low-level with him, and I firmly believe that C is the best language to eventually learn, but I'm not sure how to get him there. Can anyone recommend a language I can start to teach him that is simple enough to learn quickly, but powerful enough to do interesting things and lead him down a path towards C/C++?"
This discussion has been archived. No new comments can be posted.

How To Teach a 12-Year-Old To Program?

Comments Filter:
  • Programming (Score:5, Insightful)

    by sopssa ( 1498795 ) * <sopssa@email.com> on Sunday December 27, 2009 @03:48PM (#30564852) Journal

    You didn't tell if he actually is interested in programming at all. Because if he isn't, he will never be. I tried to show programming for my little brother too, but he just couldn't be interested. It's something you need to be interested at, and if you are, you've probably picked it up yourself at that age. But maybe it's worth giving it a try at least, but don't feel bad if he doesn't get interested in it.

    I started programming with Quick Basic. I don't remember exactly how I got there, I think I was doing "programming" like stuff with Paint or other such programs and my father instructed me to Quick Basic (this is when I was 7-8 years old). I remember having some game programming with quick basic book, that had simple examples and exercises. It was probably perfect for that age; simple, but still you got to see nice results. If i would had been dropped in to c/c++ instantly, I would probably had dropped whole programming thing.

    Next logical translation from that was to Visual Basic, continuing on making own games, mostly top-down ones. It was nice to be in Windows environment, while still having easy language to go by. And there were DirectX libraries available too, and I learned first basics in 3D programming and raytracing. There were also some nice sierra style adventuring games game developing books released and I had couple of them.

    Next step is more interesting tho. I had tried c++ for some times already, but I never really liked it. It was too much shit to get by, and wasn't that nice to develop with. I mean, I knew it and could code with it, but I really didn't want to. But I tried Delphi, and fell in love with it, mostly because of it's comprehensive component library, good help and nice coding. To this day I still prefer Delphi in GUI programming unless I really have to use C, it's just a lot nicer.

    But the main point being, do not throw him right away to the nerdy shit that programming is. Get him started with the more easy programming languages first. There's a lot more such now a days too. Hell, don't except him to get to c++ programming ever. It's a limited area in work sense. Sure it's good to know it, but it isn't the best language or answer to everything.

    Just let it be fun for him, and get him interested on programming on its own merits. Otherwise it's not going to work.

  • Re:Python (Score:3, Insightful)

    by LaminatorX ( 410794 ) <sabotage@praeca n t a t o r . com> on Sunday December 27, 2009 @03:51PM (#30564870) Homepage

    Seconded. If/when a transition to low-level is called for, you can (re-)write python modules in C to get your feet wet.

  • by bcrowell ( 177657 ) on Sunday December 27, 2009 @03:55PM (#30564904) Homepage

    There's nothing particularly wrong with plain C as a first language. (I'd avoid all the intricacies of C++ syntax for a first-timer. The OO stuff is, in my opinion, totally unnecessary for a first-time programmer to learn.)

    Another good language for first-timers is a scripting language like python or ruby. (I like perl, but perl's syntax is goofy, and if he does want to explore OO at some point, it's better to learn it in a language that uses more standard OO syntax.) I've used python as a teaching language in the past, and it works fine.

    One thing to think about is what programming projects he's interested in doing, and make sure he's set up for success. A lot of kids that age want to program games, but programming a real-time video game requires a *lot* of skills. Whatever project he wants to do, make sure you have a combination of OS, development environment, and libraries that will work.

  • Python+pygame (Score:5, Insightful)

    by sammyF70 ( 1154563 ) on Sunday December 27, 2009 @03:58PM (#30564924) Homepage Journal
    If he has any interest in programming, then Python in combination with pygame is probably the way to go. Python is easy to learn, and pygame will give him instant visual (and audio) gratification. The instant gratification part is the really important bit if you want to keep his interest up.
  • Re:javascript (Score:2, Insightful)

    by sopssa ( 1498795 ) * <sopssa@email.com> on Sunday December 27, 2009 @04:00PM (#30564940) Journal

    I hope you guys are kidding. First of all, javascript is an awful language. Secondly, I really fail to see how he would have fun in creating javascript stuff. It's a web programming language, not something a 12 year old should be using to have fun messing around and maybe trying out some 3D stuff.

    C#, Delphi or Visual Basic are a lot better languages to start with, with their easy to use language, large library and a language you still get somewhat nice results with little programming. It's also a lot easier to move from those to other languages later if need to, because they're fundamentally same unlike javascript.

  • Re:Programming (Score:5, Insightful)

    by johnlcallaway ( 165670 ) on Sunday December 27, 2009 @04:11PM (#30565050)
    Great advice! I also tried to teach my son to program, but he wasn't interested. I think the 'key' is to find something he is interested in that he has to learn to program to do it. Robotics comes to mind. My first language was also basic. My first program was a simple program go plot quadratic equations on graph paper for extra credit in calculus class. My second program was a program to hack passwords because I didn't have high enough priority to run things on the computer. I had a 'reason' to code beyond learning. I learned to code to solve a problem.

    Use the project to select the language, not the other way around. I too tried C++, but because my first program was a Windows GUI, it was hopeless. I then took an online class that focused on more batch-oriented homework, and it was a breeze. Use something that can have lots of small successes instead of one huge result. It's easier to cope with a small setback than a large one, and he will be less likely to get discouraged once he can start growing his skill set and see that growth.

    Start with the simple stuff ... basic syntax and if/then/else type logic. Then add some methods or functions. Toss in some for/while loops. Build a solid base that can be used going forward before you get into heavy stuff like operator overloading or inheritance. Syntax first, learn how to compile or run, learn how to debug simple errors. Then move on to more advanced concepts.

    And for gods sake, find something that he doesn't need to worry about libraries or a debugger to figure it out. Show him how to use printf statements to trace and debug programs FIRST before introducing him to debuggers.
  • by Shaiku ( 1045292 ) on Sunday December 27, 2009 @04:15PM (#30565094)
    Who gives a fuck what Dijkstra says? Modern variants of BASIC are nothing like the '70's and '80's BASICs he was complaining about. A lot of programmers made and still make a good living in VB. I'll bet a significant fraction of /.ers started off in QBASIC, GW-BASIC, PowerBASIC, or VB. The rest of us probably started with the BASIC interpreters built into our "Home Computers."

    You have to learn to walk before you can run. I know a lot of first-time programmers who gave up on Python as a first programming language. It's just too complex and the concepts are too abstract for a lot of people with no prior experience. And you can argue me until you're blue in the face about how you don't think it should be so, but that ain't gonna change the way it is.
  • by dunkelfalke ( 91624 ) on Sunday December 27, 2009 @04:15PM (#30565096)

    IMHO everything is wrong with C as first language. It gives you dreadful programming style and is not a right tool for application programming. You can mod me as a troll if you want but you've got to chose the best tool for the job and C is a tool for writing operating systems for fuck's sake. It isn't even a high level language. All those buffer overflow security holes happen because of both typical "clever hack" C programming style and choice of using a language for writing operating systems to write business applications.

    Pascal wasn't a very good teaching language for nothing - it forced you to write software in a very clean and readable way.

  • Re:javascript (Score:5, Insightful)

    by peragrin ( 659227 ) on Sunday December 27, 2009 @04:25PM (#30565206)

    while java script isn't a good place to start it is doing something they are interested in and that would be web pages.

    You start where you have an interest and move from there.

  • Re:Programming (Score:2, Insightful)

    by Anonymous Coward on Sunday December 27, 2009 @04:36PM (#30565292)

    Or start with the important life lesson. Teach him hex numbers and then show him how to open his favorite save game file with a hex editor and improve his cash position. :)

  • Re:javascript (Score:3, Insightful)

    by uradu ( 10768 ) on Sunday December 27, 2009 @04:50PM (#30565420)

    Javascript not a great suggestion for the OP, that I can second. But an awful language? You either don't REALLY know js beyond some simple HTML even handling, or your definition of "awful" is different from mine. The more I use it as the primary programming language for dynamic, heavily web service oriented web apps, the more I like it. It's one of the most expressive and flexible languages, something completely belied by its deceptively simple syntax. Then again, that's a trait it has in common with its syntactic granddaddy, C, which also fooled a lot a people with its perceived dearth of keywords. Anyway, js can be summed up with one word: closures. Until you wrap your mind around what all can be achieved, js may indeed seem like an awful language to you.

  • Re:Perl (Score:2, Insightful)

    by Anonymous Coward on Sunday December 27, 2009 @04:51PM (#30565442)

    all trolling aside...

    Perl is designed to be a 'natural' language, kind of like the ones we speak. A 4 year old can speak English, and senior scientists use the same language to discuss very advanced topics. Perl is like that. He can learn it very fast and do neat things and not have to worry about the lower level constructs. But when he's ready for those, they are there. And the transition into C from that point will be very smooth.

  • by Dogtanian ( 588974 ) on Sunday December 27, 2009 @05:16PM (#30565610) Homepage

    HTML fascinated the hell out of me, so i tried it

    HTML hardly constitutes "programming" in any reasonable sense. That's not to disparage knowing it as a skill, but regardless of what some people think, it's not programming.

    made some Pokemon websites

    Okay, now you've definitely blown your case. ;-)

  • by CrazyJim1 ( 809850 ) * on Sunday December 27, 2009 @05:42PM (#30565800) Journal
    Actionscript is like C/C++, but with protection from some of the nastier stuff. Also, if you want to get straight to displaying graphics, I haven't found a language as easy to do that with. The most important thing is that Flash games are actually pretty cool so if you become a master in Flash over the years, you can crank out some games. I coded Basic since the Ti-99 in 82, through C64 basic in 85 to GW basic in 91 to quick basic in 92. C/C++ from 95-2009, and now I'm on Flash which I picked up in a week.

    I think the secret to any object oriented language is to avoid complex memory references as much as possible, and just stick with dumb arrays and procedural programming as much as possible. I'd say it is possible for a person to code in Flash without knowing any OO concepts at all as long as they have someone to spoon feed them the basics. Another tip: If you code small chunks at a time, you almost never get caught blinded by where the bugs could be... They're most likely in the new code you wrote!
  • Re:Perl (Score:4, Insightful)

    by Eravnrekaree ( 467752 ) on Sunday December 27, 2009 @06:04PM (#30565948)

    Seriously, perl is the first language i really learned well and would be a great choice.

    I would also recommend seriously just HTML and then later throw in javascript to build on that. it can lead to really fast results to catch interest and has a lot of immediate application in the trendy werb page design/myspace kind of development.

    Perl, it is actually easy to learn and well documented. There are few quirks but it is easy and more powerful than other languages. One just needs to remember to start off each program with $|=1; to turn on autoflush on stdio and to remember that when doing $var=func(); the return argument will always be the last returned. A few rules but nothing really that difficult to remember.

    C/C++ might be better avoided witha newcomer. It could exceed the attention span with those younger programmers. A good GUI builder which can be used in a simple manner is also a good idea. TK is relatively simple but there may be simpler toolkits to use.

    To really capture interest, the programming has to be straightforward and lead to instant tangible resutls so lots of additional code and formalities and having to type lots of intitialisation and set up code, can blow them out.

  • Re:C# Surely. (Score:4, Insightful)

    by A Friendly Troll ( 1017492 ) on Sunday December 27, 2009 @06:17PM (#30566056)

    For one thing, it uses words instead of symbols ;)

    "if x and not y then foo" is much easier for a beginner to understand than "if x && !y foo".

    Having endured some programming classes at the university with people who never had any programming experience, two things could immediately be observed as problems: people kept forgetting which symbols are used for what and few could grasp pointers (one of the reasons why C sucks for beginners).

  • Re:Windoze (Score:2, Insightful)

    by ClosedSource ( 238333 ) on Sunday December 27, 2009 @06:37PM (#30566196)

    "Don't use Windoze or any M$ tools unless you have to, though they look simple, they bring endless unnecessary complexity all caused by M$ trying to screw its customers"

    You're complaining about complexity and suggesting Emacs and Eclipse as alternatives?

  • Re:Python+pygame (Score:4, Insightful)

    by cibyr ( 898667 ) on Sunday December 27, 2009 @06:43PM (#30566238) Journal

    This is the answer. In starting off with pretty much any programming language, you screw around with strings, do some match, maybe make a GUI with some buttons and stuff... With PyGame, you can make games! Or at least, you can put graphics on the screen, move things around, make noises and it's easy... but not restrictive.

    Logo (and programs like GameMaker and its ilk) get the first bit right, but once you want to do something that isn't moving a turtle around you're somewhat stuck. But with Python, you can do pretty much anything. And it's portable too! You can write a script in Python on your computer and run it on your phone (if you've got a Nokia, at least).

  • Re:Python (Score:4, Insightful)

    by Simon80 ( 874052 ) on Sunday December 27, 2009 @07:10PM (#30566398)
    Because Python is more popular, isn't tied to a proprietary vendor's toolchain and runtime, has various modern features that make it rather powerful, has a wide selection of standard and third party libraries, and can interoperate C or C++ as needed later on.
  • by Nicolas MONNET ( 4727 ) <nicoaltiva@gmai l . c om> on Sunday December 27, 2009 @07:19PM (#30566472) Journal

    - It's the fastest scripting language around.
    - There's plenty of doc and examples
    - It's on every computer
    - It's useful right away
    - It has some very interesting constructs such as closures
    - The OP mentioned Basic -- even if you take those tired old cliches about JS at face value, it can't possibly be worse than Basic. No fucking way.

  • Re:Python (Score:2, Insightful)

    by Anonymous Coward on Sunday December 27, 2009 @07:55PM (#30566702)

    Answer:

    He'll go on to play football, party, get pussy, get straight-C's in high school, and become generally well-adjusted with social skills. Then he'll get a degree in business and make a six-figure salary while boning hot secretaries all day as losers like you toil endlessly under shit wages and constant threat of outsourcing.

    Question:
    Though there are many many many reasons, briefly describe the number ONE reason why the united states was not considered a world power nor an economic leader in the twenty first century.

  • Re:Windoze (Score:2, Insightful)

    by Brad Mace ( 624801 ) on Sunday December 27, 2009 @09:49PM (#30567498) Homepage

    Do you know how stupid and childish you look when you say things like 'Windoze' and 'M$'? All that does it let people know that they should ignore whatever else you're saying. And why exactly does a 12 year old care about "an OS and full tool chain"?

  • by macraig ( 621737 ) <mark@a@craig.gmail@com> on Sunday December 27, 2009 @09:51PM (#30567514)

    If you want to teach a kid programming, the lessons shouldn't start anywhere near a computer at all. Start with visual problem-solving "toys" like LEGO, Tinketoy, ErectorSet, ConneX, and the like. This will be an opportunity to observe and find out whether the kid takes well to the activity or even has a mind well suited to it (I have known people who simply cannot program no matter how hard they try). If the kid isn't well suited for it or doesn't like it, then you can move along to something else; if the kid is a natural or takes a real shine to it, give them a few years' time with that to build up a suitable problem-solving framework upstairs, and THEN introduce them to computers and programming. At that point I would suggest a strongly typed and structured language, like Pascal/Delphi.

  • Re:Programming (Score:4, Insightful)

    by Zalbik ( 308903 ) on Sunday December 27, 2009 @10:25PM (#30567696)

    Great advice! I also tried to teach my son to program, but he wasn't interested. I think the 'key' is to find something he is interested in that he has to learn to program to do it.

    No you asshat, the 'key' is to find out what your child is interested in that they show aptitude at and nurture that. Attempting to force your child into some preconceived mold in order to enrich some deranged sense of proxy-succcess you get through your child's achievement is just wrong.

    Your children do not necessarily enjoy the same things you do. Deal with it.

  • by hedronist ( 233240 ) * on Sunday December 27, 2009 @10:26PM (#30567708)

    I've been fortunate enough to mentor a couple of prodigies. The key is not to Go Big, or Go Small, or Go Bare Metal, it is to go where their interest lies. If they really want to know about electron migration through a solid state material, Hell, go for it. But if they are interested in how to generate a web page, that's where you start.

    If they get hooked and you start to work together on really interesting problems, you will eventually get into all of the classic core problems of program development: design, platform choice, networking, deployment, security -- you'll get to all of these eventually.

    My vote for a first language is Python. I also suggest starting with Guido van Robot [sourceforge.net] as an interesting starting point. Even older kids will understand that this is just a starting point and they may zip through the problems in a matter of days or even hours. You will encounter limitations in terms of functions, looping, etc., but that can be a springboard to how you do it in real Python.

    For Windows I found the Aptana environment (Eclipse + PyDev plugin) [aptana.org] to be easy for kids to understand.

  • by squidfood ( 149212 ) on Sunday December 27, 2009 @11:52PM (#30568140)

    Woah, skipping a few steps, are we? I hope he built an ALU and then a microprocessor before that!

    You jest, but (also in answer to other replies) I was more suggesting interesting parallel tracks rather than something proscriptive - a 12-year old can get it.
    If your 12-year old likes learning things by reading, a really really good resource is A.K. Dewdney's Turing Omnibus - a non-major comp-101 level text that's really REALLY good at describing everything from electrons and bare metal to theory and practical coding. Puzzle-oriented and v. accessible to pre-high school nerds.

  • by Schnoogs ( 1087081 ) on Monday December 28, 2009 @01:32AM (#30568518)
    HTML is not a programming language.
  • by Walkey ( 849252 ) on Tuesday December 29, 2009 @02:19PM (#30584348)
    First, does your brother show any interest or at least curiosity in computers? This is a pre-requisite.
    If he does show curiosity then you must first try and understand what motivates this curiosity.

    Is he interested by the looks of an application, is he interested with the creativity, is he interested with how things work?
    The answer to this question will entirely change how you should approach your self-given task of teaching him to program.

    When you have found out his main motivation, then you need to tease his curiosity further by giving him simple examples of things to do and helping him to achieve this. Onl then can you start figuring out which language might be best.

    Personally I started with Logo (http://en.wikipedia.org/wiki/Logo_%28programming_language%29) - in my opinion the best language ever to get started with great ease with a key advanced programming concept: recursion. Then I went on with Basic (eek) and Pascal (great). Pascal (non-OO) was indeed very educational in that it allowed for great creativity and helped understand how a simple language actually worked (including insight into how compilers function).

    But soon, like you suggest, you need to get to a full blown language for a wholesome experience. Nowadays the choice is wide. Personally I would veer towards an interpreted language with an easy GUI toolkit. Python + Qt sounds like right the thing to me - but then again I'm sure you can make it happen with pretty much anything available.

    The key to teaching is not so much what is being taught but how it is being taught. If your brother is having fun, he'll learn anything. If he sees you having fun, he'll learn it quicker again. So you both need to be enjoying what you teach him (you must be familiar with whatever language you choose to teach him) and you must find ways to make it enjoyable for him too (with pragmatic and quick results to begin with and gradually increasing difficulty - it is essential that you teach him the basic problems: sorting, recursion, human-machine interfaces, how memory allocation works, you'll soon talk about multiple threads or tasks and dead-locks, live-locks...).

    Enjoy.

Intel CPUs are not defective, they just act that way. -- Henry Spencer

Working...