Is this normal when learning to program?

Started by
26 comments, last by B_Knight 19 years, 5 months ago
Source code is impossible to understand in many languages. I can write elegant or algorithmically complex programs, but tiny programs written by others takes some time and concentration for me to understand.

Look at it like this: If someone writes a book, they know everything about it and everything that happens at any point. But the reader has to read it from start to finish to know all that. When looking at code, you can't just glance at it or look at a function and see what's going on, anymore than you can read a random single page in a book and understand the plot. And code is bad because it's not linear; it jumps around constantly. You have to trace the code and it's really annoying.

Anyway, the way I learned to program was by skipping steps 2-400 and just creating simple games. I'd learn the basics of the language (and references are mostly useless and classes aren't necessary, so you don't really need to know those yet), then learn how to do graphics, then start working on a game. :)
~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
Advertisement
I learned C++ two years ago from a book, and started programming games one year ago. But for the longest time, even knowing C++, I ended up just programming in C. I found structures and global functions to be more versatile and easier than classes and member functions.

I'm just now starting to use C++ and classes. I've known for two years how to do them, I've just never taken the time to use them.

It's good that you're getting exposed to the more advanced topics. You'll find that you won't feel any need to really use them. But after a while, you'll realize, "Hey, there's an easier way to implement this particular thing I'm working on." You'll remember the more advanced stuff you once learned about and, bit by bit, you'll begin using it. You'll look back at your old programming books to remind you how the new features work,and start implementing them, a little at a time.

-Gauvir_Micca
Gauvir_Mucca: I was exactly the same way. I was programming in C++ but using it more like C. It wasn't until I was making a card game that I realized that using things like classes was REALLY helpful.

I tend to put off learning things until it becomes so unbearable that I HAVE to learn them. I stopped doing things Cish and started using classes and methods. I started using things like templates and inheritance. And lately I've come to the realization that I should use the STL more because I've written my own LinkedList and Iterators and its become detrimental to NOT use the STL.

Its hard to come up with a good way to use some ideas. Just make sure that you know them, and how to use them. Trust me, there WILL be a time when you're coding and you come across a new situation and you know how to use a tool you've never used before and it works!

Be careful though, sometimes when you have a hammer, ever problem is a nail.
Hi wilsocn. I am a self-taught programmer and I will give you advise that I wish some told me when I was starting out. What you learn from the books are programming concepts and syntax. That is merely like learning how to talk in english. However, just because you know the english language does not mean you can deliver a speech on quantum physics. Language is one thing, algorithm is another.

Because you are posting in Gamedev.net, I assume you want to program games later on. My advise to you is that in addition to learning C++ do a bit of research on current algorithms - preferrably one that does NOT have code in it.

Here are some very useful articles on game engine anatomy and the 3D pipeline that I have found very informative and may just help you:
http://www.extremetech.com/article2/0%2C3973%2C594%2C00.asp
http://www.extremetech.com/article2/0,1558,9722,00.asp

Try to understand what needs to be done first and THEN you can use the C++ language to help you in your task. From there, you should be able to find innumerable resources to help you in your quest (e.g., books and online tutorials). With practice, you should be good to go.

Bottom Line: Do not get lost in the syntax. Keep the algorithms in view.
cgameprogrammer, that is the worst advice I have ever heard.

do not start on square 1 then go to square 400, learn c++ as the books tell you to, 'c++ programming fundementals' is a very good book. Do not skip classes, pointers and stuff like that, classes made no sense to me untill I made a card game.
Quote:Original post by wilsocn
I am learning C++ and I have covered topics such as functions, classes, pointers and now references, but I think I might have a problem.

When I finish a chapter covering a certain topic I make sure that I understand the concepts in that chapter. I understand the example programs, but I couldnt really set down and write a serious program to implement the new concepts that I have learned. I can sit down and write a small program that does nothing other than demonstrate the concepts, but as far as a real world program, I can't do it yet.

Also, when I look at source code for a game or something I feel really overwhelmed and wonder if this is something that I will ever be able to do. I wonder how I will ever remember so many new functions and when to use a pointer, pass by reference, etc etc...

Did anyone else face these hurdles when learning C++?

Thanks


Only one way to get past that. Sit down and code. If it says to make sure you understand the topics covered in the chapter, then sit down and try to write a program yourself. Don't just read through the source code they give you. Typing in the source code works too, although the best solution is to code something yourself. It doesn't have to be complex, it just has to prove that you're comfortable with what you just learned. Don't bother looking at professional code yet (Unless you just want to feel overwhelmed)

I don't disagree completely with cgameprogrammer. It's a good idea for every step to try to make something yourself. (For example a simple game, or just a small calculator, or something that prints out 'abc' 2000 times. ;)
But you shouldn't skip topics. Read a chapter, do *something* with it, no matter what, and no matter how simple your program is. Then move on to the next chapter, and so on.

The way I started was a bit different though. I'd read through the entire book, which took a few days, skimming over the source code, but without actually coding anything myself. Then when I'd finished the book, I at least had some idea about what the various concepts meant. What a class is, what a function is, what a pointer is, and especially what they are *not*. :)

Then I started over and began coding from step one. I'm not saying that's the best way to learn programming, just telling how I did it. :)

The advantage was that I had an idea about more advanced concepts, and sometimes as I did some simple exercise, I could see how one of the more advanced concepts (which hadn't been discussed yet in the current chapter), would be able to help me solve the problem much easier.

The disadvantage was probably that it was a lot harder to stick to current topic, because it seemed so simple, and because I was more interested in the later chapters. :)

As for what AP said, I'm not sure why you'd need to know anything about 3D any time soon. As he said, learning the concepts and syntax for C++ is like learning english. And you have to be damn comfortable with the language before even thinking about delivering a speech. In other words, don't worry about graphics, especially not 3D yet. Learn the language, and play around with it until you're sick of it. Then you can start moving on to what you can actually use it *for*. :)
Quote:Original post by Spoonster
I don't disagree completely with cgameprogrammer. It's a good idea for every step to try to make something yourself. (For example a simple game, or just a small calculator, or something that prints out 'abc' 2000 times. ;)
But you shouldn't skip topics. Read a chapter, do *something* with it, no matter what, and no matter how simple your program is. Then move on to the next chapter, and so on.

I didn't mean you should skip topics, I meant you should learn enough to write a simple program you'd enjoy (such as a game) and then fill in the blanks. As you create more and more complex things, you realize the need for more advanced programming concepts (and languages) and can understand their use better. Pointers tend to confuse people, but their use is obvious in a real application... it's just that people try to understand them without using them in good situations.
~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
learn them in order, I didnt know the point of pointers but I know how to use them and then I was ready to go to sdl.



I'd learn the basics of the language (and references are mostly useless and classes aren't necessary, so you don't really need to know those yet), then learn how to do graphics, then start working on a game. :)



classes are necessary, the make sence once you learn them
Quote:Original post by dan1088352

I'd learn the basics of the language (and references are mostly useless and classes aren't necessary, so you don't really need to know those yet), then learn how to do graphics, then start working on a game. :)

classes are necessary, the make sence once you learn them

I've been programming in C++ for 7 years. I know all about classes. :) But they are not necessary. C has no classes and it's still widely used. You can very easily write Space Invaders, Pong, or any number of games without needing classes, or even suffering from the lack of them. But after you've written such a game, you can learn about classes and see how they'd help.

I'm of the opinion that you can't really understand something until you try doing things without it.
~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
Quote:Original post by wilsocn
I am learning C++ and I have covered topics such as functions, classes, pointers and now references, but I think I might have a problem.

When I finish a chapter covering a certain topic I make sure that I understand the concepts in that chapter. I understand the example programs, but I couldnt really set down and write a serious program to implement the new concepts that I have learned. I can sit down and write a small program that does nothing other than demonstrate the concepts, but as far as a real world program, I can't do it yet.

Also, when I look at source code for a game or something I feel really overwhelmed and wonder if this is something that I will ever be able to do. I wonder how I will ever remember so many new functions and when to use a pointer, pass by reference, etc etc...

Did anyone else face these hurdles when learning C++?

Thanks


Yup, that's how it goes. When i first started i would read way ahead until i had no clue what i was reading because i never fully understood the previous chapters that well either.

I think you learn best when you have a need for the things being taught. I would suggest having a pet project (Pong, or your dream MMORPG or whatever) and chipping away at that idea. With each new thing you learn, instead of saying "Hmm... that's interesting", you'll say "Hey, i could really use that!" and turn back to your project to redo it yet again, only better this time! But definately start a project, even if it's totally rediculous. It's how your learn. Experience and real-life problem solving with your own code will teach you much more than a book exercise.

Quote:Anyway, the way I learned to program was by skipping steps 2-400 and just creating simple games.


He he, yeah. I actually agree with that. I only agree because i wouldn't remember steps 2-400 anyway. It usually isn't until i have a need for such things that i actually stop to really learn it anyway. So i get going with my own projects until i hit a problem and then i go back through and think to myself "there must be a better way to solve this problem". Then i look at steps 2-400. Wwhen i spot the solution, i appreciate it more because i now have a need for it, whereas previously i did not and would have skipped over / forgotten it anyway.

This topic is closed to new replies.

Advertisement