Programming: once I've started, how do I continue?

Started by
9 comments, last by Spoonbender 17 years, 10 months ago
I've started on Python for my first language (and am slowly developing a list) and I asked my mom whether she'd ever been so fustrated on trying to figure out how to make it (programming) work, she'd wanted to scream the loudest and powerful of obscenities. She said "welcom to programming." So does this mean that I'll just have to stare at my code until one day it works - every time I write a new program? I was hoping my confusion would simply be a noobish quirl, and that this might happen when ever I learn something new, but I'm just trying to make a simple text adventure game. Is programing really the arguous juorny it's shaping out to be? I'm not saying I'll ever give of, I mean I'll be going to college for this stuff in two years (and yes I know I should have maybe started code sooner), but I was just wondering what the vet's opinions on this were, and maybe how other beginers felt.
Advertisement
Well, I'm certainly no veteran but I can help you out with that. Yes, there will always be times when you're thinking "Now why the hell won't this work?", but if you keep it for a little while you'll always find a solution. I've been programming quite a little while now, still come across problems. But like I just said, I always fix 'em and keep going. I still immensely enjoy programming, too. ;)


-Aternus
Programming is relatively "easy", if you've designed your system well and thought of *most* of the things before hand.

Debugging can be a nightmare in some cases, but with experience you'll find it easier.

When the logic of my code doesn't seem to work, I usually end up using pen and paper, tracing out what's happening, what's the results of calculations, what is should be, etc... until I pin point the exact problem.

And there's no problem with the age you've started programming... I mean, I was around 17 when I *seriously* started programming (no, I don't consider copy pasting / messing around code from magazines when I was 5 to be serious coding)... and I don't feel this holds me back. Go outside, play sports, you'll have your entire carreer to program ;)

Cheers

Eric

Bruce Lee became a martial arts expert by constantly getting into fights. He undoubtedly got his ass kicked over and over many times in the beginning. This is just the price for mastering a skill. The only reprieve is that you get to control how fast and frequently the ass kickings happen.
Planning thoroughly will remove most of your problems. It took me a while to learn that, lol. Plan out your program/game on paper before you start writing code, otherwise:

A. Your code will look very messy as you remove and add things to fix problems.

B. You will have lots of problems

C. Planning ahead gives you the ability to make things more efficient, and to think of better ways to do things.

Bottom line, if you plan, you won't be nearly as frustrated in the middle.
OK. Thanks.

xEricX:
You started at 17, that's my age. I guess I could put my fears to rest, although I can't stop being haunted by the idea that when my mom went to college, she was in classes with people who'd been coding since they were eight. And the article I read recently saying how it takes ten years to be good at something, with an emphasis on programming (http://www.norvig.com/21-days.html).

PS: I've found most of my problem in coding to be more related to the http://www.gamedev.net/community/forums/topic.asp?topic_id=397542 From design to implementatio thread.
I'd say the most important thing is to never stop learning. Do not be satisfied with what you know.

There are many programming styles and techniques. You'll find that many of the bugs (and many lines of unclear or inelegant code) you have now just dissappear if you tackle your problems in more appropriate ways. This means you should not be satisfied with your first solution to a problem.

Concentrate on learning concepts; languages are not that important. A corollary to this is: don't be afraid of learning several languages at once. Syntax is easy to learn; how to turn problems into programs is not.

Learn a functional language, like Haskell or Scheme. Python is very powerful and supports a functional style, but it's likely that you only write imperative-style code. Functional languages teach you to use state only when necessary, which helps keep your code clean and bug-free.

Check out Structure and Interpretation of Computer Programs:

http://mitpress.mit.edu/sicp/

It's online in its entirety. I've been programming in various languages since I was 12, and I would have killed for this book at any age. Eight years of teaching myself (in this order) basic, assembly, pascal and C++ taught me less about programming than 3 months of reading SICP and writing Scheme.

So don't worry about those precocious learners; you can catch up if you're willing to tackle the hard questions instead of just sticking to the first few programming tricks you learn.

In any case, you can't be far off track if you're reading Norvig already. :)
You will have to live with it cuz u'll be making mistakes all the time, that's in fact how human beings learn, by making mistakes.

The most important thing is that you like to program. I knew I wanted to program before I even touched a computer or knew how to program.
Quote:Original post by Splinter of Chaos
I've started on Python for my first language (and am slowly developing a list) and I asked my mom whether she'd ever been so fustrated on trying to figure out how to make it (programming) work, she'd wanted to scream the loudest and powerful of obscenities. She said "welcom to programming."

So does this mean that I'll just have to stare at my code until one day it works - every time I write a new program? I was hoping my confusion would simply be a noobish quirl, and that this might happen when ever I learn something new, but I'm just trying to make a simple text adventure game. Is programing really the arguous juorny it's shaping out to be?

I'm not saying I'll ever give of, I mean I'll be going to college for this stuff in two years (and yes I know I should have maybe started code sooner), but I was just wondering what the vet's opinions on this were, and maybe how other beginers felt.



Something they teach you (usually in your first programming class) -- "Divide and Conquer" -- you break large problems into many smaller ones. This goes for debugging as well as design of a program.

Find out what parts of your program do work.
Trace its execution first in large blocks (use print statements to log the programs progress) and then in smaller blocks as you figure out what part of the
program is failing.
If logic isnt doing what you expected print out the variables and the results of your calculations and check that it is really doing what you designed.

If you cant trace your logic, then write it again in a different way and spread it out so that you can follow it easily.

Make sure you check for error cases and have appropriate error messages in your code. Once you can see what is going wrong, it usually takes alot less time to fix it.

After you have fixed the problems, you can comment out the trace (print) code (so it can be quickly reactivated if needed) and later you can remove it.


Over time you will expand your programming skills (and your debugging skills)
and the more ordinary things will become almost automatic. Even after 25 years as a programmer, I still have to look new things up in the manuals. There are so many programming areas that I havent touched in all that time and new projects usually require new learning (I only started looking at Python a few weeks ago for use in a friend's project and I learned the basics in a few days, but still saw alot of things that are done differently than the other dozen languages Ive used over the years).



So shoot strait, fly right, and learn about structured programming. Got it.

This topic is closed to new replies.

Advertisement