Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Ok, so I started on my journey of learning C a while back. I have a huge list of books from C to C++ to Game Programming and what not. Sometimes when I read, my mind seems to get foggy and I understand absolutely nothing. Other times, all is well. But I feel that overall my progress is too slow.

With most books ranging from 300 - 1500 pages (and I have a bunch of them on my wishlist) what is the strategy that you guys use to learn programming? I mean, how do you learn best? Are most of your self-taught by reading through all these books? Do you finish one then pick up the next or do you read several books at once? Do you learn better by getting advice from all your peers/colleagues. Does it happen by solving problems??

Do you have any advice on how I could learn C/C++ faster and still become proficient? I feel like I'm getting stuck at the beginner level forever so I was curious at what the pro's did to learn the mentioned languages efficiently.

Oh and, also I feel that I seem to forget some of the knowledge pretty quickly which is annoying. What are good ways to retain it? What are your methods? Do you write stuff down, memorize it or how does it work?

Thanks for ideas/suggestions/help!!

share|improve this question
3  
pick something and make it work: game, utility, control, driver... – aaa May 16 '11 at 23:50
2  
First thing to learn: C and C++ are distinct languages. While you can do most things in C++ that you can do in C, writing C++ in a C style is bad and unidiomatic code. I'd recommend learning one at a time (and you can learn either first). If you learn them simultaneously, keep track of which you're studying, and always know what language you're writing code in. – David Thornley May 17 '11 at 16:03

migrated from stackoverflow.com May 17 '11 at 3:26

10 Answers

up vote 3 down vote accepted

One important thing is the quality of the books you choose. For C++, I'd recommend to start with Stroustrup, of course:

http://www.amazon.com/Programming-Principles-Practice-Using-C/dp/0321543726/ref=sr_1_2?ie=UTF8&qid=1305590823&sr=8-2

That book covers all the basics. After you mastered it, get a good book about metaprogramming and a good book about the STL. For instance:

http://www.amazon.com/Modern-Design-Generic-Programming-Patterns/dp/0201704315/ref=sr_1_4?s=books&ie=UTF8&qid=1305590969&sr=1-4

http://www.amazon.com/STL-Tutorial-Reference-Guide-Programming/dp/0321702123/ref=sr_1_3?s=books&ie=UTF8&qid=1305591028&sr=1-3

You won't need much more than this for your first two years, probably. Of course after that you can improve your knowledge with more books. Again, choose carefully the authors. I am quite biased towards Dewurst, Meyers and Koenig (besides Stroustrup, of course).

For game programming there are so many good books, and it is a so broad body of knowledge, that it is difficult to recommend material without making a huge list of books. Also this area evolved so much that it can be very difficult to get proficient by yourself, unless you plan to dedicate a lot of time and patience OR you intend to create only very simple games. Have you considered taking a graduating course? Anyway, this is a good start:

http://www.amazon.com/C-Game-Programmers-Development/dp/1584504528/ref=sr_1_20?s=books&ie=UTF8&qid=1305591922&sr=1-20

About the learning methodology, surely it will make a big difference if you have someone to teach you and share experiences. So if you have a friend that has some experience in the field, or if you can enroll in a college course related to these subjects, it's way better. Other than that, practicing is more important than reading lots of materials. Also, don't worry about forgetting concepts. Your mind will take care to remember what you use the most, so once you are able to write the first programs, you'll notice that absorbing new information that's useful for a problem you have to solve becomes easy. And don't even bother memorizing things like APIs and every detail of the libraries you use. Not only this is practically impossible nowadays (given how huge they are), good development environments integrated help and auto-complete features will assist you pretty well about remembering method names, etc.

share|improve this answer

Nothing beats pure practice... The best way to learn anything (especially programming languages) is to just jump in. there is no substitute. Sure books will give you a good theoretical background but without actually doing it and fighting through the problems will you really understand it.

That being said, pick something... Anything really...but just get started. Whether it be how to crate a simple gui using some sort of framework (Qt) or parsing raw web page data or simple control logics... Anything that interests you or you will eventually need is a great start

Practice makes perfect... Once you get a good feel for the language and worked through some issues (the internet is your friend here), the books will really make more sense and things will start to click very quickly

share|improve this answer

I recommend getting good at the basics of a language before jumping into something as complicated as game programming.

If you want to learn C, then start with K&R second edition and go through it trying the examples and make sure you get good at handling pointers.

If you want to learn C++, pick a good modern text. (Modern C++ is very different from the C++ I learned 15 years ago; it's nicer in many respects, but a lot of what I learned back then is no longer best practices now. So try to find a good new book. :) Go through it slowly, and make sure you try the examples.

I wouldn't try to learn both simultaneously. They're different enough that what is good advice for one is awful advice for the other. (C++ is subtle and quick to anger.)

Once you've got the basics, then perhaps it is time to branch out; if you wish to do systems programming, Advanced Programming in the Unix Environment is an excellent next book. (Feel free to skim it heavily during the first reading; all the details of specifications can become overwhelming.)

Reading multiple books at a time is fine, once you get bored with one, move on to the next. More important is to keep your brain engaged. :) Getting bored and frustrated and feeling like you "have to slog through it" is just a recipe for getting nothing done.

And don't forget that the best way to get a lot of programming done quickly is to be motivated to work on it. Pick a utility or game or something you want to work on, and work one it. :)

share|improve this answer

There's two different things here ... there's learning a computer programming language, and learning to program. There's actually quite a difference here because programming in and of itself transcends any language construct, so before you get caught-up in the "I need to be a C/C++ expert" rat-race, I would make sure that you have a thorough understanding of how to program. That includes a solid grasp of debugging techniques, coding practices, as well as a solid foundation in algorithms and data-structures. And especially keep in mind two very basic fundamental concepts of computer programming that trip up a lot of people which are indirection (encompassed in pointers and references) and recursion. These are the sorts of tools that you will take with you to any language, and are the building blocks that will help you create actual working programs rather than language exercises that explore the minutia of an individual language's constructs and quirks, but don't do much of anything in the real world.

That being said, when it comes to learning C/C++, after having developed a good foundation in algorithms and data-structures, I found that Unix/Linux systems programming was one of the the best ways to learn how to code in C/C++, and at the same time learn how to make practical real-world tools that could actual work in "real-world". Considering the fact that Unix, as we know it, was basically written using C, and C was created to be a higher-level abstraction above lower-level assembly language that still gave low-level access to the hardware layer, it's really no surprise that you'll learn quit a bit of how and why C exists if you delve into system-level programming. It's also quite satisfying since you're moving away from the abstract, and into something that is very concrete.

share|improve this answer

The best thing is to try coding as you read the books, and try to understand all the details in the simplest programs. While this is slower at first (and if you're like me, it's hard to resist the temptation to just jump straight into coding), in the end, it gives you a good solid understanding, which you need as the foundations of your skills.

When I was first learning to program, one of my mentors mentioned that a good strategy is to disable autocomplete in your development environment, because it forces you to remember the constructs, the syntax, the keywords. Of course, once you're familiar enough with the language, you should take advantage of the sophisticated development tools available (e.g. Microsoft's Visual Studio).

Also, while books are powerful friends, you can pick many many more brains online, by looking at this site, and others, such as Code Project, DevX, DotNet Developers Search, etc--all for ZERO cost to you! And that without even mentioning the code samples available for free at MSDN, where you can learn by example. Start by reading the code quickly, and then try to recreate it with as little peeking as possible. There's nothing like trying to figure out a problem to help you realize what you don't know. You will quickly notice that when you read the solution you think you know how to solve the problem, but that only when you try to solve the problem without help do you become aware of how much you truly understand.

Ultimately, programming is definitely a skill that is learned by doing, not by reading. Practice, practice, practice.

share|improve this answer

Scan through the language(keywords, identifiers, statements, etc), program structure(eg: C needs declarations at the beginning of the block), and, read some idioms and phrases. Then, study a decent book on software engineering, one on algorithms and one on data structures, preferably the ones that are using illustrations in the language that you are looking to learn. Quickly run through as many design patterns as you can. When I read them first, I felt very vague and abstract. But it is paying back good when I read programs and am able to see the patterns they use.

By now, you should have had enough reading. Start reading other people's programs, as many as you can. If you pick any project in FOSS, you should be able to identify the idioms and phrases that you studied. Also, you should be able to see the data structures and algorithms, or simply find out the used data structures and algorithm and read up on it.

By now, you should have gained enough confidence to take on the world. Start with baby steps and submit a bug or a bug and its possible fix to the project you were studying so far. When the fix gets applied, you have become a programmer. If you have had enough reading and writing to other projects and are raring to write your own, go ahead. Here onward, your code should speak for you.

In short, it is going to be a long journey, where you will meet compilers, text editors and/IDEs, debuggers, linkers, loaders, error messages, exceptions, and most importantly, many many fine people who are just as passionate about writing programs. You will be writing code from early on, and will become better and better toward the end of the journey.

share|improve this answer

I would suggest trying out the UVa Online Judge problem set archive. This is a free online site that has hundreds of "programming challenges" which are small problems that have some kind of algorithmic solution.

You write your C program using their example input and expected output and try to figure out a solution to the problem. You then submit your code to the online (automated) judge and it tells you if your solution is correct.

The cool thing about this is that the problems are of manageable size and focus on learning data structures and algorithms, two key aspects of what computer science (and programming) are based on.

I wouldn't stress too much about retaining all the information in those books, because the short answer is, there's simply no way one person would ever be able to retain all that. You learn by practice, and what you've practiced most recently will be available to you without having to look it up.

But believe me, it doesn't matter how well you "master" even fundamental concepts. Given enough time away from a particular language or problem type and it will be like starting all over again as a beginner. With experience though, the amount of time it takes to get back up to speed will get shorter and shorter. Don't sweat it and try to enjoy the current knowledge and skills you have.

share|improve this answer

I am taking a C++ class right now and this is the book we are using "An Introduction to Programming With C++" by Diane Zak.

http://www.amazon.com/Introduction-Programming-C-Diane-Zak/dp/0538466529/ref=sr_1_1?ie=UTF8&qid=1305854293&sr=8-1

I can tell you for certain that if you actually READ and DO ALL OF THE quizes, examples, questions etc after each chapter you will be on your way to learning how to first program, second, use the C++ language to do so.

share|improve this answer

Don't be put off by the number of pages, you usually don't have to read them cover to cover. If you have some experience with programming you could consider starting with Accelerated C++.

Amazon: http://www.amazon.com/Accelerated-C-Practical-Programming-Example/dp/020170353X

I found this book to be quite useful when I was learning C++ (I'd worked a little with C before this). Its really nice and can get you started quickly. After getting some idea about the language and its syntax you could skim through:

For some of the advanced topics and the not-so-clear/subtle points. I currently use them both as references, since I can't remember all of that stuff. :)

The best way to remember all of this stuff is to keep using it. Granted, you may not remember some of the esoteric stuff, but the basics shouldn't be a problem when you are constantly writing code (even better if you cna do this on a daily basis). Also with books and Google can quickly help you refresh your memory, should you need to deal with some of the topics that you cannot recall.

Getting proficient is a continuous process and there is, IMHO, no end to it. Even after working with C++ for quite sometime, you do learn something new every now and then, especially when looking at code other people have written.

A good starting point towards better programming would be to have a good grasp of the basic concepts, understand the paradigms of the language and to strive for a good design while writing code.

share|improve this answer

I like to recommend Who's Afraid of C++ it is a great introduction to programming in C++ for absolute beginners and covers all the Object Oriented theory for C programmers as well. There is also a follow up book Who's Afraid of More C++.

I also like Thinking in C++ Volume 1 and Thinking in C++ Volume 2 : Practical Programming for solid foundation skills.

For advanced details anything by Scott Meyers and Andrei Alexandrescu are must reads as well as Herb Sutter.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.