Sign in to follow this  
loxagossnake

How do you 'learn' a programming language?

Recommended Posts

loxagossnake    172

The topic header might be a bit ambiguous and rage-inducing, so let me clarify it for you before I end up with life threats rolleyes.gif I have only recently put my foot in the waters of game development, and it's mostly theoretical stuff about it. My story with programming -and desire to develop games- though has begun at least 6 years ago, in High School, in an extracurricular class, but that was mostly Pascal-based procedural algorithms. Lately, and after finding a few good men who would like to join me in my quest (and they are serious about it) to learn and finally develop a game or two, I started putting a more serious effort in it. Before you bash me about gathering a small team when even I can't stand on my feet, I have to say that it's just two friends (one is a coed of mine in Physics school) and it really helps keep the motivation up, since we insist on learning together and every time someone gets disappointed, another member of the trio keeps him enthusiastic.

Now, on to the actual question. Since I have fallen flat on my face many times when I thought making a small game would be a piece of cake, I have gotten a more realistic picture of what is in store for us. So, I wanted to start from the basics: learn a programming language, and learn it really, really well. I know I can't master it in the next 5 or even 10 years, but I want to achieve a solid understanding of its elements. That language is C++. I know it's rough and low-level and I didn't pick it because 'it's what the pros use'; I actually love it with all its shortcomings, and I find its attention to detail to be parallel to game development itself. Thus, I shelled out some cash to pick a book after some brief research: that book is C++ Primer, 5th Edition. I have to say it is pretty readable and goes very deep where it is needed, so no complaints about the book itself. It's me who has the problem. Whenever I establish a good reading routine, some kind of OCD kicks in and all in all, I give up. What usually happens is that I read a lot of material, and even if I leave it for a couple of days because of college work, I believe I will forget everything and insist on starting all over again. And yeah, I do most of the problems in the book and write my own code. Also, whenever I get stuck at something I don't understand, I get disappointed. This pattern repeats and it is usually one or two month gaps that I don't do any work. The result? I end up actually having to re-read.

This may be suited better for a psych forum, but before I visit the shrink with such a ridiculous problem, I wanted to ask you people. Which do you think is the best way to absorb the material of such a big book? Do you have to actually understand every single line to even consider stepping into a game development framework? Or can someone go through the book once, fully understand the basic concepts like OOP, and just hop up in the pages again if further reading is needed?

Share this post


Link to post
Share on other sites
Chad Smith    1343

really the best way to learn programming is to just code and keep coding.  You said you read something and you do the examples.  Ok good, but is that all?  I used to do the same thing and well I thought I knew all the concepts but I found later on when it came to applying them to a different program I hadn't really learned them.  Then what I started to do was create my own examples.  Ask yourself questions while reading.  While your reading try creating your own examples before you even get to your exercises in the book.  What you will end up doing is helping yourself understand this concept in a lot of different ways.  The ways/examples you do might not be meaningful or useful but that is ok.

 

Next after you do the examples in the book, try to extend on them and make them into a more "complete" program/example.

 

Finally if you don't understand a certain concept try writing it down.  Work through that concept on paper like the program would run it step by step.  Then put that concept into a program and use your debugging tools to attempt to run the program step by step.  Look at what values changed?  Why did they change?  Work that out on paper and compare the results.  If you are getting the same results on paper as you would get in the program then you're understanding the concept more.

 

It all comes down to, just keep programming.  Their will be concepts you don't get or understand right away.  Just keep programming.  We all need breaks and everyone here understands that.  Though in the end make sure you come back and keep programming.  When you come back instead of thinking that you have to reread everything try testing yourself on what you read previously without looking at your book.  If you keep doing all of this before you know it you will solving problems all on your on.

 

Just remember though we all need help sometimes.  Don't be afraid to ask questions.  Everyone here be it professional or not need to ask questions sometimes and we have all been there before and we all understand (ok their are a select few people I've noticed that do believe they are above everyone and think they understood everything first try, but ignore those people).

Share this post


Link to post
Share on other sites
blewisjr    752

I know many programming languages and it is really not the language that is difficult to learn this is often just various API, and Syntax.  The best way others have mentioned is to learn by doing and researching as you get stuck.  By doing this you learn various algorithms and data structures they carry over across programming languages and then it is really just about the syntax.  This follows suit for all imperative languages and does not really break down till you try to learn a functional programming language where all the design patterns, algorithms, and data structures must be represented in a completely different way.  So as long as you are sticking along the lines of C++, C, Java, C#, Python, etc... Learn by doing/researching eventually it will start to click and make sense.  There is no way to just learn by just reading a book it really takes personal projects to get the total picture.

Share this post


Link to post
Share on other sites

I know many programming languages and it is really not the language that is difficult to learn this is often just various API, and Syntax.  The best way others have mentioned is to learn by doing and researching as you get stuck.

 

And be sure to indeed do that research, because there's little that is more frustrating than trying to "learn by doing" when you don't actually know what you're supposed to be doing. wink.png

Share this post


Link to post
Share on other sites
Buster2000    4310

I used to read the book cover to cover then go through the book again but this time actually write the code and also edit the code and make my own changes.

I think recently things have changed with proper online courses.  I'm currently learning Scala and have found the easiest way is to do the free Moocs offered by coursera.  Some of programming Moocs offered are really good.  If I was a complete newb and I wanted to learn to code I'd probably try code academy, Udacity or Rails for Zombies.

 

 

If you want to do C++ there are several courses on Udemy, Coursera and iTunes U.  The quality of these vary but they are all a lot better than any for Dummies, For Idiots or in 24 hours books.

Share this post


Link to post
Share on other sites
NathanRidley    1092

The problem when you start out programming is that your brain is not really trained to think at the sort of logical level required to effectively deconstruct problems and create logical solutions. The only real way to train yourself to think this way is to force yourself into situations where you must think this way to solve the problem. In other words, however little you know, use it to write something.

 

First, why not try to write a simple guess-the-number game? Look back over your code and try to work out what you could have done better. Post your code in a Gist (over at Github) and ask people here to help code review it for you, but be sure to explain what you're happy with and what you think could be improved (i.e. what effort you've put in so far to that end). Code review with peers is very important to your growth as a developer, so don't try to do this in complete isolation or you'll slow your growth down severely. Last but not least, be extremely self-critical and always seek to do a better job with your coding than you have previously. After 15 years of coding myself, I still find things I can do better and I always assume that there are plenty of others out there who are much better than me, that I can learn from. With that attitude, you'll pay attention to programming articles, you'll investigate how others have solved problems similar to what you're working on and you'll stay on top of the curve in general, just because you're genuinely interested in being the best that you can be.

 

Finally, expect road blocks and frustrations every step of the way, but don't let them stop you. Be relentless in trying to understand the individual aspects of what you're doing and in figuring out the issues you're trying to solve. StackOverflow is an invaluable resource, use it! Khan Academy is fantastic for fundamentals such as math and physics, when you need them, and there are plenty of other online learning resources that cost you nothing as well. Remember, when your head feels like sand after feeling like you've been beating it against a problem for hours, know that your knowledge and skill is growing. When you relax and especially when you sleep, your brain is reprocessing what you've experienced during your coding and is optimizing its neural connections little by little so that, with persistence, you'll become more and more proficient in every aspect of what you're doing.

 

It will take time, but persist and you'll win!

Share this post


Link to post
Share on other sites

i haven't actually coded a single game yet or a single applicatin yet...

 

i've been reading as many books as possible on c++ and watching a crap load of video, algorithms by robert sedgeiwck on coursea.org. Now I know how to implement merge and quick sort and binary tables.  I'm working on red-black trees now.  

 

I'm trying to get recursion 100% down. I understand tree traversal with recursion to a certain extent. IT's still a challenge though. Working through Stanford c++ YOUTUBE - cs106b. I'm stuck on recursive backtracking. Trying to figure out how that all works. 

 

what else can i learn? i already read (skimmed) Head first design patterns.  

 

so far i guess i have a rudimentary knowledge of c++, java, and javascript.  Any suggestions on what I should do next? I think i need to start realy learning STL with Boost. 

Share this post


Link to post
Share on other sites

I'm trying to get recursion 100% down. I understand tree traversal with recursion to a certain extent. IT's still a challenge though. Working through Stanford c++ YOUTUBE - cs106b. I'm stuck on recursive backtracking. Trying to figure out how that all works.

I thought it was just a matter of memory allocation and that, the longer the recursion travels, the more memory it requires because the computer needs to store all that information simultaneously and then calculate it all once the recursion has reached the end. But I get the feeling that this isn't what you're wondering about.

 

Suddenly you made me curious about recursion again smile.png

Edited by Malabyte

Share this post


Link to post
Share on other sites
Tutorial Doctor    2573

I typed in Game dev in google and got this site. I was looking through the forums and saw this post. I just had to join to let you know that I have made several tutorial on programming (I am new myself), and I have produced quite a bit. I am using the Maratis3D game engine myself. Anyhow, here are a few links to some tutorial I have written

 

Introduction to Computer Programming

http://snapguide.com/guides/understand-computer-programming/

 

http://forum.maratis3d.com/viewtopic.php?id=793

 

http://forum.maratis3d.com/viewtopic.php?id=830

 

Object Oriented Programming

http://forum.maratis3d.com/viewtopic.php?id=839

 

Boolean

http://forum.maratis3d.com/viewtopic.php?id=840

 

I will be looking through these forums to learn more about game development. If you need any other tutorials (I know of many) let me know. 

Edited by Tutorial Doctor

Share this post


Link to post
Share on other sites
Anri    971

Learning a language is quite a mammoth task, especially if its your first, but I find that continuallly making progress daily is a good thing, even if it is just a small amount of time you dedicate to studying.

 

Here is a great tip I have learned over the years for any kind of studying or task: get to bed earlier than usual - even if its just 30 minutes sooner - and do about 30 minutes the following morning. That way, you can relax safe in the knowledge that you have made an effort. You don't want to drag the day out constantly thinking "sigh, I still haven't done anything...maybe I'll find time tomorrow....".  30 minutes each morning and you'll clock up three and a half hours a week of programming experience.

 

At the moment I am currently working with a friend on a 3D modelling project, and where they(being a professional) will update once every few days, I will update a little on a daily basis. Although I'm not on the same skill level as my friend I am at least keeping up with them, and the project is moving forward on a daily basis.

 

Right, I must get my beauty sleep now or I'll not be thinking straight in the morning! blink.png

Share this post


Link to post
Share on other sites
Tutorial Doctor    2573

Learning a language is quite a mammoth task, especially if its your first, but I find that continuallly making progress daily is a good thing, even if it is just a small amount of time you dedicate to studying.

 

Here is a great tip I have learned over the years for any kind of studying or task: get to bed earlier than usual - even if its just 30 minutes sooner - and do about 30 minutes the following morning. That way, you can relax safe in the knowledge that you have made an effort. You don't want to drag the day out constantly thinking "sigh, I still haven't done anything...maybe I'll find time tomorrow....".  30 minutes each morning and you'll clock up three and a half hours a week of programming experience.

 

At the moment I am currently working with a friend on a 3D modelling project, and where they(being a professional) will update once every few days, I will update a little on a daily basis. Although I'm not on the same skill level as my friend I am at least keeping up with them, and the project is moving forward on a daily basis.

 

Right, I must get my beauty sleep now or I'll not be thinking straight in the morning! blink.png

 

That response is rather profound! I took a screenshot of it. There is a life lesson to be learned in that. I actually did this once, to try to become focused on something. I made it the FIRST priority. At first I only made excuses. But when I started doing it as a FIRST priority then I was able to make progress. And it came to the point where that priority didn't only get 30 minutes, but sometimes whole days. I need to refocus my priorities again this way. 

 

I like how you say you are not on their level, but you make steady progress. Seems to me you are more dedicated. 

Share this post


Link to post
Share on other sites
Anri    971

Thank you, Tutorial Doctor.

 

Yes, I understand how you feel about losing your way. This usually happens when you take on more than 30 minutes a day due to greater expectations of yourself which can lead to giving up or burning yourself out.

 

On the subject of skill level and dedication: Well, I keep in mind that as good as my friend may be, nothing will change the fact that many hands can make light work! biggrin.png So long as I have a useful skill - in this case low-polygon modelling - I can at least make their work lighter...

Share this post


Link to post
Share on other sites
Serapth    6671

I personally learn by osmosis.  Buy a couple programming books, pick one each night and use it as a pillow.  The knowledge is sure to seep in eventually.

 

 

In all honesty, its like any other skill, try fail, iterate, succeed, repeat.

 

I started learning to program before the Internet and to be honest, I think that was probably a good thing.  There were less resources, true, but also less options, less distractions and less porn.  As a result, I spent a lot more time doing instead of thinking about doing.  I think starting out today, you are spoiled for choices... in a bad way.  Just way to easy to get distracted... or spoonfed.

Share this post


Link to post
Share on other sites
Tutorial Doctor    2573

Wow, this is a very interesting topic. You are very right Serapth. The internet can be a big distraction. When I moved, for the first few days I didn't have internet, and guess what? I READ A BOOK! hahaha. We didn't have cable either by the way.

 

I wasn't missing it as much as the rest of my family was. I think we can become anti-social that way. I mean, my brother texts me an imessage in the other room. haha. 

 

Anyhow. I have been into game design for about 2 months (believe me, the time flies really. Seems like only a few weeks) and I have learned so much. And it is just like you say, Try, fail, iterate, succeed, repeat. 

 

Amazing. hehe. 

Share this post


Link to post
Share on other sites
jHaskell    1856

i haven't actually coded a single game yet or a single applicatin yet...

 

 

....

 

 Any suggestions on what I should do next?

 

Writing code is what you need to start doing.  Lots of it.  If you haven't created a single application yet, then you really haven't learned nearly as much as you may think you have.  Reading books/tutorials and watching videos has its value, but it's nowhere near as valuable as writing code.  The only path to becoming a proficient programmer is to write code.  All other activities only provide guidance and structure to that singular critical activity.  For every hour you spend on those supporting activities you should spend an absolute minimum of two hours writing code, 5+ hours would be even better.  The person that spends 90% of their time writing code and 10% of their time 'learning' how to write code will be a far better programmer than the person that spends 10% of their time writing code and 90% of their time 'learning' how to write code.

Share this post


Link to post
Share on other sites
Tutorial Doctor    2573

Yeah, that's true jHaskell. I kept going from video to video for tutorials, and also looking for the best way to learn. From all of those videos I didn't find one person who could make it simple for me. But what I learned bits and pieces from those videos enough to write my own tutorial on programming. And I made it layman's terms. It turns out that programming is not hard at all, and just about anyone can do it. Whether or not you do it well is another story (not everyone perfects their craft).

 

Sitting at a computer and typing code in an IDE and seeing the result in a console window was not the ideal way for me to learn programming (boring), so I searched for a good game engine that would let me type code and test it visually. Was looking at a Unity 3d video when I saw another engine in the playlist. Tried out the video, went to the website, downloaded it, and ever since I have been doing very well as far as programming goes.

 

The engine uses LUA for scripting, but C++ as the engine code. I have not found any good help on C++ yet, but I understand concepts well enough I know I can do it. The syntax just gets me. 

 

I would suggest that a person new to programming games get a good game engine rather than an IDE, and code in that. Even 3D software like Maya or Blender have scripting. Ruby is pretty easy also (used for Google Sketchup). 

 

I started with Python. It is easy to cross to a new language once you have basic programming concepts down. All you have to do next is learn the syntax of the language. 

 

Even then, once you get a language down, you have to learn the API's and stuff (figuring out how someone else's code works) which is the most annoying part for me. 

 

For the original poster: I know I sound like a programmer dude, but I am really new to this, and have been learning a lot in a short amount of time. Just for reference, I found that game engine about 2 months ago (time flies) and so far I have written over 500 lines of code (neat code).

 

It's not hard, and doesn't have to take long. 

Edited by Tutorial Doctor

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this