Jump to content
  • Advertisement
Sign in to follow this  
3dmodeler

reading source codes

This topic is 3442 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am pretty comfortable with c++ I have been looking at source codes to better understand it. It is easy to read a few pages of code for a small program but waht about thousands od lines of code, it takes a long time to understand it. any tips on reading code faster or easier? 3dmodeler

Share this post


Link to post
Share on other sites
Advertisement
The trick is ... don't read the code. [smile]

When you need to work with a piece of code, all that is relevant (usually) is the function prototypes and type declarations you need. You rarely care about the code behind them (this assumes that this is a relatively well tested codebase). If the code has good documentation, you may not even need to open any of the files that make up the program.

As you get more experienced, you will find it easier to navigate large codebases quickly.

Also, this might be worth a read.

Share this post


Link to post
Share on other sites
Reading source code to learn how to program is one of the worst ways to learn programming. That's like watching spanish soap operas, trying to learn spanish purely from context. It might be possible, but it's going to be a lot harder than if you go out, buy a spanish book, and actually start SPEAKING spanish, no matter how poorly.

Writing programs -- no matter how simple -- is almost always a better way to learn programming than by looking at source code someone else wrote.

Share this post


Link to post
Share on other sites
I have been learning c ++ with books I just wanted to see code the way other people might use it (lots of differences in developing a project) Reading it i think can help to see how something is done.

I read that article rip-off thanks i alway heard it was a good thing to read sourcecode I guess i am wrong

3dmodeler

Share this post


Link to post
Share on other sites
Well i'm not as experienced as most of the people here that will give you advice on learning to program, but i don't see reading source code as a bad thing. Or course, it's always better to do some exercises, hands-on experience is best, but reading other peoples code can give you insight into their methods and styles. You just have to remember that their code may not the best and a book will instruct you of proper usage of the language. And it's only really worth it if the code is well commented. I don't think anyone would disagree that tutorials can be helpful, but just reading source code without any explanation on what it does can also be a good exercise.
At least, that's what i think. [smile]

Share this post


Link to post
Share on other sites
right reading it isn't totally bad but there are proper steps whne doing it. Take me for instance. One day i started reading some source from the quake 3 engine that was release under gpl. I didn't understand anything when i began even though i had written many programs. For one, the tool i used was totally lame. Visual studio regardless of what ever one says is the best tool for beginners. It has superb searching and debuging is the best i have seen. ok when reading from source you have understand some context to grasp the rest. its like when reading we often use context clues to learn new words. Its kinda the same except in coding code isn't straight forward to beginners

Share this post


Link to post
Share on other sites
Quote:
Original post by owiley
...except in coding code isn't straight forward to beginners

Yes, i agree that it complete n00bs shouldn't just sit down and start reading source code when they barely know how to program.

Share this post


Link to post
Share on other sites
don't read the code. Compile it, run it, put a breakpoint where you want to figure out how something works. Step through the code till ya understand it [smile];

-me

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!