views:

450

answers:

16

My wife receintly asked if I could teach her to program. I think the best lang to teach in is C++ (please don't argue that point, it's what I learned on and what I know best).

Other then the C++ tutorial on the C++ website, what else would you give a brand new programmer. I'm thinking boolean math, but other than that I can't think of what a newbe would need.

Any suggestions would be cool.

+1  A: 

My preferred method for picking up a new language has always been to create mini projects. I used to write number factoring programs (basic loop, math, I/O). The nice thing about going through a book is that each chapter will give you ideas about something you could write, which gets you excited to look up everything else you need to write it.

dmo
+3  A: 

Bjarne Stroustrup's book Programming -- Principles and Practice Using C++ is a great beginner's book. For those who don't know. Bjarne designed and implemented the C++ language.

Keltex
+2  A: 

I remember learning c/c++ with Bruce Eckel's Thinking in C++ book. I haven't checkout the latest edition but if it was as good as his first one I think it is a must. http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html

JD
A: 

Boolean logic, Loops, Conditional statements (if/then/else), variables, what an error is and how to handle them would be a good place to start.

Jay
+1  A: 

I would start with the classic "Hello World" - learning how to make the computer print something to the screen.

The next thing I would do is teach her how to get the computer to accept a tiny bit of user input, manipulate it, and print the result.

These activities give the student some instant gratification of making the computer do something and if they have any interest in programming this should hook them immediately.

Then I'd walk through all of the basic syntax of the language without even touching more complex concepts like references or pointers until they've got the basics down. Talk about boolean logic and start introducing control elements like for, while, etc.

Once the very basic syntax is learned, start introducing concepts like functions and code reuse.

17 of 26
A: 

I would target the lessons around creating something she would find useful or interesting. Perhaps something related to a hobby of hers. This certainly doesn't have to be the first goal but perhaps one you work to achieve in the long term. The lessons up to the end goal could be smaller pieces of the final product.

For example, if you wife like art then maybe doing some manipulation of images might be interesting. Instead of forming things like arrays, loops, and matrix problems around pure math try and form them around a high level topic she finds interesting. Unless of course the pure math part is what she finds interesting.

Evan
+4  A: 

Francis Glassborow's book, You Can Do It!: A Beginners Introduction to Computer Programming is what I'd recommend. Francis was a high-school teacher throughout his working life (he basically created ACCU in his spare time;-) and knows how to teach raw, bright but totally-raw, beginners. Also see the book's web page (and thanks to @Chris for mentioning that URL in his comment!).

Alex Martelli
Win, I was going to give that answer. :-)
Chris Jester-Young
http://www.spellen.org/youcandoit/ is the book's web page.
Chris Jester-Young
@Chris, tx, very useful URL (hope you don't mind me editing the answer to include it, just in case people don't read comments!).
Alex Martelli
+1  A: 

Just some weeks ago, I have asked a related question due to a similar situation that I was facing, I was pointed to some excellent online resources that are freely available, you may want to check out the original discussion Introductory Programming Podcasts with C++ emphasis?.

none
+2  A: 

One thing I learned over the years is "Working with high quality code is worth 1000 books"

I was young and naive and my job required me to use MFC and some other low quality libraries. I was inexperienced, and I can't help but learned from the library I use and code I work with. It took me a while and working with, learning from, and getting beat up by some of the best developers to unlearn all the bad habit I picked up from MFC.

If your wife like doing things more visual, I'd recommend getting the Qt library and the demo app source code. The Qt demo has a lot of interesting but useless apps. You can pick a demo app and show her how to modify the code or add functions to do other stuff. That's how I'd teach my kids to program. Making a 3D cube spin beats printing "Hello World" to the console. As far as GUI framework goes, the code quality in Qt is generally pretty high. Qt is LGPL and comes with an IDE.

Shing Yip
Qt is of course LGPL. http://www.qtsoftware.com/about/licensing
Comptrol
Yes, Qt is LGPL. Finger slip and typed not LGPL. Thanks for the correction.
Shing Yip
A: 

I find learning from others is the best way to learn, when I started out programming and had nobody to ask I would read other peoples code and modify it to see what happens. It is easier (IMHO) to do that than to start from scratch with a program. Maybe you could write her a starting framework for her to expand, something related to some interest of hers.

Also teach her how to use a debugger, it is very useful to see how the code executes line by line in order to understand better.

Anders K.
+1  A: 

Seriously, I will teach her Python/VB/Ruby(or anything easier) at first, then I will teach C++. I think it is the most effecient way for a people want to leant C++ without any programming concept.

yoco
i wont recommend that practice as being x-teacher myself. As these dynamic languages offer such a luxury then its very hard to do the things you take for granted. I agree with the baash5 that you must teach them some 3rd Gen language like C++/Java or event C# but i preffer the first two.
Gripsoft
Gripsoft, Amen.. I picked C++ not just because I know it best (though I might know it best for the same reasons) The langs above lack something that I think is a must for a new programmer. Pointers and an understanding of them. Python's approach is frakly offensive to me. (I know I'll get flamed for that). x = 5 x = x + 1.. What do you mean I create new memory to add 1? Java and C# would be viable but the garbage collection is not something I think new coders should have. Too much is lost when you don't understand how memory actually works. (ps I like garbage collection)
baash05
+3  A: 

I have to disagree that Stroustrup's book is good for beginners. Beginers should start with something like C++ Primer or Thinking in C++ (online book available). Stroustrup's book is an excellent one and a must read by every C++ programmer but AFAIK, it is tough for absolute beginners.

Appu
does ur answer include this also Programming -- Principles and Practice Using C++ ??
yesraaj
Obviously Appu is confusing "The C++ Programming Language" and "Programming: Principles and Practice Using C++", both by Stroustrup. The former is a solid reference but terrible for newbies. The latter is a great introductory text.
MattyT
Yeah. MattyT is correct. I was referring to The C++ Programming Language.
Appu
+1  A: 

Why does she want to learn to program? Based off this information, you can tailor the learning path to best fit her perceived need, at least once you get off the basics.

Rob
She's expressed interest in becomming a programmer before, and getting paid for it. I've been at it for a time and C++ is where my heart lies. She's the smartest person I know and I think she could make a good coder. She's very technical and learns quick. Also (above all) she is lazy. I'm not sure if she's lazy enough to be a good coder, but she might just fall under the cut off line :) PS SHE'S NOT REALLY LAZY, BUT LIKE MOST OF US SHE HATES DOING THINGS THE HARD WAY WHEN THERE SHOULD BE AN EASY WAY.
baash05
A: 

Whichever way you pick, foremostly, read this paper of Kevlin Henney: Miseducation of C++.

Comptrol
Interesting read. I don't exactly agree with it, but it was interesting. True the other stuff is a lot easier to work with, and more real world, but then I reciently got asked to reverse a linked list in an interview and couldn't for the life of me do it. (2 min after the interview I could). I'd have used STL to store the list and never considered doing it manually. Still that's what they used to not give me the job.
baash05
+1  A: 

I learned on C++ Primer Plus. That said, unless she's hardcore, the ability to not get cute gui's and things pretty quick could be a detriment. I'd maybe thing about Java simply because it's standard library is so accessible.

While I love C++, I don't necessarily thing it's a good introductory language anymore.

Chris Kaminski
A: 

To beginners I usually recommend Accelerated C++ by Koenig and Moo or, more recently, Stroustrup's Programming: Principles and Practices Using C++.

In my opinion Accelerated C++ is better if you've got some programming experience - in any language - but are a beginner to C++. Where Principles and Practices shines is teaching people who have never programmed.

MattyT
She's a total neophite. (is that the right spelling?) I'll see about finding the principals and practice book
baash05