Getting Started with Programming

By Shamus Posted Tuesday Jun 2, 2009

Filed under: Programming 84 comments

The procedural city project resulted in a lot of people emailing me who wanted to know how to get into programming. How to learn? What language? What books are most useful? How do you learn about graphics programming, specifically?

Those are all big questions. I guess the first thing I’d do is make sure you know what you’re getting into. Graphics programming is a very specific sub-discipline of general programming, and jumping right to the graphics stuff is a bit like trying to learn heart surgery before becoming a doctor. It can certainly be done if you really want to learn that way. (Unlike heart surgery, you don’t have to worry about being sued by bereaved next-of-kin for your newbie mistakes. You’ll just crash people’s computers. And Microsoft has proven you can’t go broke doing that.) But jumping into “graphics programming” before learning “programming” is probably not the smoothest route to knowledge. Learning programming isn’t quite the mental challenge medicine is (one assumes, judging by their relative salaries) but like any body of knowledge it does take time to acquire.

Aside from a few COBOL courses in school, I’m entirely self-taught. (The one language I was taught – twice – is the one language I don’t know. I couldn’t generate a single valid line of COBOL to this day.) I imagine the self-taught route is what you have in mind if you’re emailing me. If you were looking for formal education then you’d probably see your guidance counselor or shop for a college. Being an autodidact is fine for enriching your knowledge and understanding of the world, but slightly bad if you’re looking for a career. Even at 37, my earning potential is probably lower than someone with the same experience who can wave around a ~4 year degree. Whether or not that increased earning potential of a degree is worth the risk and expense of taking out loans to pay for one is a really complex question. I come down pretty firmly on the “no” side of the argument, but a lot of coders would argue with me. And the successful ones generally make a lot more than I do. QED.

Jumping in and learning a modern professional-grade language can be a bit much. In the 80’s, most kids were introduced to something much simpler, like BASIC, Logo, or (if they’re quite young) Turtle. I don’t know what kids are taught these days. The point of learning one of these simpler languages is to teach you the basic premise behind programming without getting too bogged down with technical details at the outset. Once you have your head around the idea that source code is a list of instructions that the computer will follow unerringly no matter how wrong they are or what you really intended, you have the basic tools to go learn something useful. It’s a bit like learning to play the piano before you learn another instrument. A piano provides an obvious and straightforward expression of the notes at your disposal, and you’ll usually have gotten a head full of music theory by the time you’ve learned to operate the thing. Then you’ll have a nice foundation to work with while you learn something less straightforward, like string instruments or anything powered by your lungs. In any case, this is a tradeoff: You’re reducing the steepness of the learning curve in exchange for making it longer.

So, assuming you want to learn some graphics programming, don’t mind investing time in generalized programming first, aren’t afraid of a steep learning curve, and aren’t looking to score a degree, then my advice may be of some use to you.

C++ is a good starting language, although there are enthusiastic adherents to many other languages. C# and Python are notable in that both of them can be used to write modern graphics programs. I still recommend going for C++, if for no other reason than the network effect will make it easier to find tutorials. Working in C++ also makes it easier to find unhelpful jerks who will offer snarky answers to earnest questions, which is a major improvement over the smaller languages where you won’t be able to find anyone at all.

I suggest starting with Teach Yourself C++ in 21 Days. Partly because it’s a great book (aside from some nitpicks with the way and the rate at which complex concepts are introduced) but mostly because it’s freely available online. You can also get a dead tree copy, which can be handy. Don’t be put off by the “21 days” stuff. You can blow through the first half-dozen lessons in an afternoon. Things will slow down after that, but the “21 days” stuff is by no means a hard figure and can vary a great deal on how much prior knowledge you have going in and how much time you put into it. I’ve purchased a few copies of the book and given them away to aspiring young programmers over the years.

Sadly, I’ve never found good books or tutorials that teach the concepts beyond language syntax. So, after your 21 days you’ll know how to write a program to balance your checkbook or play blackjack, but you’ll still have no idea how to structure your program by breaking it up into different modules. (That’s fancy programmer talk for putting the source code into different text files.) You’ll have learned nothing of the code formatting holy wars or the particulars of the 1,487 different ways to name variables, each of which has their own zealous adherents. You won’t know about LIB files, what they are, or how to use them. You won’t know about development environments, or MAKE files, or how to read a debug stack. You’ll probably have some idea of what a DLL file is (all windows users have those things floating around on their hard drives like so much driftwood) but you won’t know how to link to one. You won’t know how to really debug your program. (Although you’ll think you will.)

That stuff is 90% of the job, and all of the books and tutorials are focused on that first 10% of learning language syntax and knowing what to type. There are books for refining existing skills in some of those areas, but they’re very much deep-end books that will lose a newcomer in a few pages. We have lots of articles for turning people into programmers, but very little for making them any good.

Thankfully, you can pick up most of that higher-level stuff as you go. I did. (Although I still can’t make use of a debug stack, even after all these years. And it’s not for lack of searching for someone who can explain it in English.)

Once you have some basic knowledge of C++ programming, you’re ready for the graphics stuff. At this point, there is no better place to go than NeHe productions. This is where I went to learn OpenGL. The tutorials on NeHe are some of the best programming tutorials you’ll read. It’s true that most tutorials suck, but the ones at NeHe (particularly the early ones) are simple, compact, straightforward, generously documented, and fun. You can simply download the code and make use of it, or you can read through it on the site along with the instructor’s commentary and explanations. (I highly recommend the latter.)

The site will let you learn by reading the commentary. Or you can learn by example through reading the code. Or you can learn by doing by playing around with (say) lesson 3 and seeing what happens when you plug different numbers in. NeHe isn’t just a collection of the best graphics tutorials around, it’s some of the best programming tutorials of any kind, period. It’s a site that focuses on teaching, rather then simply shoveling information in your direction.

Good luck.

 


From The Archives:
 

84 thoughts on “Getting Started with Programming

  1. Many thanks for the link to NeHe, I’m an experienced programmer and have worked for several years as the technical director for a large HL2:DM mod; I’ve just always stuck with gameplay programming. There is a serious lack of decent material for learning graphics programming, so it’s good to get your recommendation.

    I’d recommend either Python or C# for learning, C# has grown on me considerably in the last couple of months, as it’s well designed, clear and fairly simple to understand. It also makes a great springboard into C-like languages.

    I’d suggest learning both C# and Python to give a broad covering of the two main styles of language.

    I already have a large stack of crap graphics programming books that I’ve never read more than a chapter of.

  2. Samopsa says:

    Nice linkage. Might pick up programming again! I studied a year of computer science on a Dutch university, but didn’t like the crowd or the way the study was going, so I quit and decided to major in Chemical Engineering instead (yeah, quite a change huh?). But I still like programming/logic problems, and it also comes in handy for simulations of chemical processes.

    I learned OO programming using Java, and the thing that helped me the most were Class Diagrams. Just the fact that you can distill a large assignment in a simple, easy to read diagram, which can be turned into the framework for your program, helped me loads.

  3. Primogenitor says:

    Game mods can be a good way to learn (Neverwinter Nights, Civilization, Unreal Tournament, etc). You can get a nice visual payback for small efforts, and you don’t have to start from scratch. Sure, its not “proper” programming, but you can begin to understand how things work. Its particularly good for gamers that want something more than playing, as you start editing something you already know, and you can begin to understand by looking at examples of things your already used to.

  4. Corruptor says:

    These days Flash is the go-to language for teaching the basics. They switched over about seven years ago (when I just got out of highschool). Ironically, it’s the first language I wanted to learn and the last one I did.

    Also ironically, as soon as I got a handle on higher level languages I got a job that was basically all flash. Ain’t life crazy sometimes?

  5. SireCh says:

    I think that python, or some other high level language is a better point to start learning about programming, as you can start doing things right away without needing to worry about memory allocation and other nuances of c++.

    As for books, I think you have to factor which kind of programming you want to do. For “casual” programming you can pick up some books from O’Reilly. They have pretty much every language and technology covered, and their books are usually fairly easy to follow. If you want to do something more ambitious, it might pay off to read something about practices and “industrial” programming (Code Complete comes to mind), and if you are really nuts about it, you can try some heavyweights like SICP (which is actually more about theory of computation AND very dense. Don’t try without some years of exp and a big interest in that stuff).

  6. Jericho says:

    Agree with starting with C++. Starting on BASIC will give you bad habits, and C++ is closer to VB then BASIC anyways.

    And COBOL is hilariously impractical yet hilariously still in use.

    Damn mainframes.

  7. AceCalhoon says:

    Code Complete by Steve McConnell is a good, language-agnostic book covering most of the “other 90%” of programming. Worth checking out, once you have the basics down.

    It’s also worth noting that C# has a certain amount of community built up around the XNA game programming framework. Not nearly as much as is available via C++, but on the other hand you don’t have to mess around with pointers.

  8. Kdansky says:

    I would also highly recommend /not/ starting with C++. It’s a really complex language where you have to do a lot of difficult things yourself (memory management, type conversions, references/pointers). I’d rather go the Flash/Java road. Also, you don’t have to bother with make files or somesuch, as you can just download eclipse (or their adobe version) and press to Run button when you want to. The amount of java-based tutorials and examples is incredibly vast, and getting OpenGL to run in it is comparatively easy (and due to the similarity of the source, oftentimes you can just copypaste C++ code snippets and they run).

    Lastly, I think learning from the high level first makes a lot of sense. After you understand how a car drives, building one becomes easier as you know what to look for. Trying to start with the differential is harder.
    C# is certainly also a good beginner’s choice, as you can get a free Visual Studio version from MS I believe. Just don’t go the Command Line + Make file route, it takes a long while to figure out while adding absolutely no practical knowledge, as long as you don’t need to debug something on a remote machine. Leave that to us ;)

  9. T-Boy says:

    Good god, kids. Don’t listen to that man. Learn Python.

    I wish I had that language when I was learning. :-(

  10. MikeElkins says:

    A great deal of the “deep stuff” is hard to teach because it only makes sense once you’ve seen it done wrong. Once you’ve grown a little program from 200 lines to 5000 lines, and then start thinking of how to get it to 100k lines you’ll be aware that the typing isn’t the issue. You’ll know that you aren’t actually smart enough to keep 100k lines written is the nice simple style you wrote those 200 lines in working nicely. You’ve got to learn that humility before you can look at a large example of well structured, object oriented, thought out architecture and have a light bulb go on over your head and say “Yes! it can be done!”

    To sum up, the “deep stuff” is unintuitive to almost everyone until you prove to yourself the “obvious” way to do things won’t take you all the way to your goal.

  11. Suraj says:

    There is also pygame if you want to quickly start programming simple games. Python is easier to learn & many basic programming concepts can be learned by quickly building games using it.

  12. Pickly says:

    It's There are adherents to many other languages.

    Small nitpick, but what is this sentence supposed ot say?

    (Also, how do you use the smaller, quoted type of paragraph in these posts, as opposed ot italics like I’m doing?)

  13. Pickly, use blockquote. (I tried to demonstrate how to, but WordPress is being stubborn and keeps converting it into the proper tags, however wildly I deform them.)

    How to Think Like a Programmer is a good language agnostic book that teaches programming concepts through the medium of interpretive dance problem solving.

  14. Tim Perry says:

    I’m doing a computer science degree at Oxford, UK as we speak (almost literally, the exams start tuesday =/), and I’d put in another vote for not starting with C++.

    Slightly from the left field, we start on Haskell (functional programming), and it actual works surprisingly well to learn from!
    I could program in Java before I started, but once you spend some time on functional stuff there’s a noticeable improvement in your code simply because of the different way you have to think about things. A fair few people on the course didn’t have my experience, and they seemed to catch onto functional programming pretty quick. If you’re spending any time writing anything even slightly complex it’s a good path to go down, leaves you with an inclination towards nice clean algorithmic stuff. Worth noting you can do most of this in python, and do normal stuff as well, so that could be worth playing with.

    From there I’d do Java, and move from clean algorithms to properly structured code. If you can get hold of a copy of Head First Java, it’s by far the best programming book I’ve ever read, and well worth looking at, just to learn the basics of OOP, java or not. OOP is definitely a skill to learn if you want to code anything larger than a calculator!

    After that, if you still want C++, do C++. You’ll be well set up for it, and it is a language you’ll need if you want to do anything serious (up to a point, no flames please), but it’s not an easy place to start; I think starting in languages that build useful fundamentals and good ways of thinking about code really helps once you get onto bigger stuff.

    In other news, that procedural city was awesome!

  15. Neil says:

    I don’t really have a suggestion for what is a GOOD program to learn on, but I can name a bad one.
    When I was in aero engineering school (only 2 years ago), our first programming course was in FORTRAN.
    Yes, FORTRAN. In 2007.

  16. Tim, one of my housemates loves Haskell so I’ve been meaning to try it. Will probably take a crack at it in the next couple of days as you’ve reminded me.

  17. stringycustard says:

    @Corruptor I did the same route (high level to Flash, and working in the industry). Although flash is an easy language to pick up (especially AS2, AS3 requires a decent knowledge of object orientation) the IDE, player and compiler (or semi-compiler) is so poorly coded that sometimes absolutely accurate code will fail to run correctly, if at all. I would suggest that newbies steer clear of it as anything that broaches something more complex in Flash will be debugging hell – something a beginner who is struggling with new concepts will not know how to tackle well.

    I’ve heard good things about Python, though (never used it). Starting with script-like languages (javascript) is also a bad idea. It may be easier to use but you have to unlearn a vast amount bad concepts (like dynamic variables – fun for coding, bad for memory and speed – and not having to initialise or even declare variables).

    I see learning to code and writing useful programs (games, graphics, etc) as needing 2 separate altogether: learning to code in a simple language and then advancing onto something like C++ for actual programming once the core concepts are understood.

    Perhaps a good starting point is Ruby as it tends towards english style constructions.

  18. stringycustard says:

    @Tim Perry Haskell is pretty complex to get started in. Recursion is in itself horribly tricky to get your head around. We only started Haskell in 3rd year and sometimes less than 10 lines of code would take hours to work out. It’s pretty daunting. On top of that there is no graphical representation besides text (I did once build an animation system in it using ascii art, though but that took ages to perfect). I was thinking of Java, too, but some of it can become quite a headache (I’m looking at you Casting). However it is certainly easier to use than C++ and at least it has a decent amount of libraries right there for you (I hate Swing but, hey, I guess some people like to use it).

  19. Nathon says:

    Seconded, T-Boy! Python is a great way to start and there are many good books (Learning Python is excellent for brand new programmers) on it. It also has a vibrant community of (sometimes) helpful Pythonistas.

    The reason I’ve stayed away from C# is its roots in Microsoftland, but I hear the Mono project is doing well, so it might not be as big an anchor as it once was.

    I haven’t done much with graphics, and work mostly in C on embedded stuff, but I can’t stand C++. They took a very clean and concise language and added a bunch of complexity that makes it hard to debug and hard to learn. I guess I’m outvoted on that one though. Anyway, new programmers should not worry about performance, since nobody really knows what will improve performance without profiling and profiling. (Incidentally, profiling is trivially simple in Python) so C++ and C really are not appropriate.

    Oh, and a special added bonus: stack traces in Python are incredibly easy to interpret. I’ve had to manually walk a few C and assembly stacks and that’s something you never need to do in Python.

  20. SireCh says:

    if you want to try a functional language, I would suggest trying F# (for .Net, based on OCaml I think) or Scala (for Java), as they have support for their respective IDE’s (VS and Eclipse), which as far as I know is a problem for other languages. That is, unless you are an Emacs freak like me. Then you can go for Lisp then and die from parens overdose…

  21. Joshua Tompkins says:

    “Code Complete by Steve McConnell is a good, language-agnostic book covering most of the “other 90%” of programming. Worth checking out, once you have the basics down.”

    This, a thousand times this. All those “Learn X in Y time” books will teach you syntax – Code Complete will teach you to be a programmer.

    I’d also recommend starting with something a little less complex than C++ – Python is a good one to start with because there are a lot of books out there that teach basic programming ideas using Python, so you’ll get high level concepts mixed in with the syntax stuff.

  22. Deoxy says:

    The C language family is AWFUL. It’s powerful, yes, but so is a 24″ handsaw with no guard. For goodness sake, DO NOT START WITH C. C++ is really only the slightest bit better.

    For those of you who are already programmers and know what I will mean, you can do POINTER ARITHMETIC in C. Bloody crap, people, that’s what third generation programming languages were designed for, to do all the stuff for you! There is NEVER a reason to do many of the terrible and likely-to-end-painfully things that C will let you do. It’s glorified ASSEMBLER. Ever heard of the annual Obfuscated C contest? Nothing else comes close to the awfulness that is C. The ongoing C fad needs to die.

    And Java is essentially a C++ ripoff. ALMOST the same syntax, some of the same problems. Eh.

    VB is a fairly good place to start. It has the bonus of being the most easily available (sort of), in that it is already on your computer (most likely) inside MS Excel (and Access, if you have it). Yes, it’s slightly altered and customized for Excel, but it’s almost immediately useful, too.

    Pascal isn’t bad, either, but it really isn’t used for anything, so it would be a learning exercise only.

    FORTRAN is actually still in use, and still NECESSARY: its does things no one has written a replacement for yet… primarily for physicists and engineers, so that makes sense, Neil. What does it do? It lets you define the size of your numeric variables. You can have a decimal number with 17 zillion digits, if you like, and the only limit that I know of is the memory on your machine. No other language (that I know of) lets you do that. When you need more precision than any standard data type gives, Fortran is there for you. (Yes, they did finally change the name from FORTRAN to Fortran. I forget when (87 maybe?), but they were still making revisions of the language as late as the 90s – it’s still a “live” language.)

    C#, mentioned by a few people here, actually has little to do with other C, from what I’ve seen, other than the style and some syntax. It’s really more “C-styled .NET” than a stand-alone language (at least, in practice). The real language in use there is really .NET, in a lot of ways, and which “flavor” of it you use is almost immaterial (again, from what I’ve seen of it).

    Also, I would agree that graphics programming is its own thing, and much more difficult and specialized than “normal” programming. I’ve never gotten into it myself – tried a little, some time ago, and found it really hard to break into. I think the availability of tools has improved since then, though, so good luck.

  23. Volatar says:

    Thank you for this Shamus. I only recently began programming myself.

    My first taste of programming was Java, many years ago. I only got a couple chapters into the book before I gave up, I just didn’t get programming. I touched pearl also, but less so, still didn’t get it.

    Then finally I decided I really did want to go into the computer field, and programming sounded good.

    I then signed up for the computer science course at my high school (that was 2nd semester of Junior year). I walked into the class, ready to learn from some good programmer.

    I was however, wary, as my dad had told me of a professor in college who he once had, who said: “So many students come to my class” (a 101 level class) “having learned Basic, or Visual Basic, in high school. These students minds, the way they approach programming, the way they try to logically break down a process into a program, is totally, completely destroyed. I would have that none of them have any experience in programming, rather than have learned Basic.”

    I was just a little turned off by this, knowing that a super majority of high school programming classes learn Basic (or Visual Basic).

    The class began, and the teacher announced “Hi, my name is Mr. B______. I am not the computer science teacher. She quit last week. I will teach your class this year, even though I have not programmed since college, and little even then” (He was a math teacher)

    I was oh so very disappointed. Luckily he did announce that we would be learning C++. He did however, have to learn it himself at the same time. This, and the several good friends I had in the class (including one of my two best friends), were the only redeeming factors of that day.

    I went home and told my dad of my disappointment. I however, at that moment, decided I would not lose the opportunity to focus and learn programming just because the teacher would not be able to teach me.

    My dad and I search through (more like trashed really :P ) the garage, and found all his old programming textbooks. Several C++ ones among them, including your recommended “Learn C++ in 21 days” book. I found that this one was the best of the lot, and began to teach myself, and my friend Micah, C++.

    I informed that teacher of this, and he was elated. He required us to continue doing the work he assigned, but this was not much, only labs every few weeks. I actually learned all that I needed to do the whole semester of labs within my first week of self teaching.

    I spent all the time in that class (and hour and a half a day, every weekday) learning. Well, maybe not all the time. I guess I screwed around a little more than that :)

    I did many projects of my own in that time. I even made a game.

    About the middle of the class I got another book, given to me by one of my fathers coworkers. I found that the book was even better than Learn C++ in 21 days. This is it (though I have an older edition) http://www.amazon.com/Introduction-Programming-C-Diane-Zak/dp/1418836184

    I recommend that book if you can. It covers less, but in much more detail and quality. If you have trouble with Learn C++ in 21 days, I recommend that one.

    Anyways, I continued to code over that summer, and learned I could sign up for a C++ class at the local tech college as a “dual enrolled” student, and my high school would pay for the class (not the textbook though). I took this offer, and took the once a week, night class of CSC 134 during the first semester of my senior year. I highly impressed the teacher by my ability to get into the class at all. I enjoyed it greatly.

    The class started with the basics (of C++, not programming. There was a prerequisite I had waived that taught really basic programming and the techniques behind it.), but quickly progressed into Object Oriented Programming. I tried to figure OOP out, but it baffled me for a long while. I even tried to go the “do it to learn it” approach, and converted my game to Object based code.

    I FUBARed the thing. Totally and completely broke my code (though I had backups, the above version is only one version earlier than my latest working one (the one right before I went OO with it).

    Though I think I finally figured out OOP at the end of the class, I had been dealt a severe blow. I took the classes final, and did not program again for months. I only recently found out that all college classes are curved. I then finally checked what grade I had gotten, and found I had recived a C. I was elated, thinking I had aced the final (though I was unsure how) but then realized that by the end, all but 4 (including me) of the original 24 students had dropped or given up the class.

    Oh well I guess on the class, but programming started to return to my mind.

    Though I did not program at all the entire second semester of my senior year, I had not given up, just paused.

    4 days ago I took my last exam, and passed high school. 3 days ago I completed my Eagle Project. Yesterday, the first day of summer, I spent 12 hours returning myself to programming.

    Though a lot of that time was spent deciding what compiler to choose (I had used DevC++ in my high school computer science class, and Microsoft Visual C++ in my college course.), and then getting the one I picked working (I picked Code::Blocks, though I fussed with it until I got it using the Microsoft C++ compiler and debugger), and then scanning through my books, relearning a lot of the things I had forgotten, I can say I have started coding again. This time, I will do it right!

    Thank you Shamus, I am glad you are here helping newbie's like me. We need all the help we can get.

    EDIT: Oh my, I have been typing this for 2 hours. When I refreshed this page it went from 1 comment to 16

    @everyone else: I think that C++ is just great to start with. Memory management? Pssh, who needs to do that? Its not like anyone else needs to actually use any of your code. :P Its also not complexity that is a problem, unless you start wavering from what your really need to learn.

    EDIT 2: 21 comments now, I better post this!

  24. Volatar says:

    My stupid link broke. Here is the game I mention:

    http://www.beyondorion.com/files/arena2_1.rar

  25. If someone was really serious about learning programming, a great book to go through would be Structure and Interpretation of Computer Programs (SICP), the introductory computer science textbook at MIT. It can be read online for free at the link. It’s a very excellent book, and someone who manages to make it through the whole thing will have learned most of what most students learn in an entire 4-year computer science degree.

    It is taught in Scheme, a lisp dialect, so a Scheme environment would need to be set up. The language’s entire syntax can be learned inside of a few minutes, so one can get right away to doing some programming. Many people also find Scheme to be a little “weird” compared to more common programming languages, as it’s a functional language and much more powerful. Also, lisp isn’t seen much in the “real world”. And it won’t get into any graphics programming, just theoretical, computation stuff. So, as I said, it’s for someone who is very serious about learning computer science or programming.

    As for learning C++ as a first language? Well, C++ is probably the most complex language in use today. Since some much simpler languages (and simpler != less powerful) are available and in wide use, starting with something like Python would probably be a better idea (I say this and I don’t even like coding Python :-P). And Python could still do a lot of the graphics stuff.

    I also believe C++ is on its way to becoming a legacy language, and little new C++ code will be written in the not-so-distant future. With some exceptions, a lot of places seem to be moving towards higher order languages running on VMs, which can now be run “fast enough”.

  26. Nathon says:

    Deoxy: Python lets you have variables whose precision is constrained only by your memory. In fact, Python3.0’s integers are all of this type (I think…haven’t used it for much yet).

  27. rtm says:

    Learn pure lazy functional Haskell using Real World Haskell. And if you really must learn imperative/object oriented lang. then stay away from c++ — it’s design is one of the worst.

  28. Another good way to learn through trial is with an application like Robocode. In Robocode you use Java to right simple (or incredibly complex) AI for robots, who will then battle against eachother. It’s really worth checking out, as the examples can teach quite a bit, and it’s entertaining to see what works.

  29. toasty says:

    *sigh* programming…

    I took a course this year with my school learning Visual Basic. At first, it was rather easy, as time went on it became harder though. I think, for me, the hardest part of the class was because I’m homeschooled (and do lots of courses via the online school http://www.thepottersschool.org) I was without a lot of help from classmates.

    On my final, after getting some help from my teacher I managed to grab one of my friends on google talk and we spent like 2 hours figuring out how to fix my code. To be honest, some of this was the fact that my organization was crap… but the end result was I did finish the class.

    Sadly though, this class taught me that programming is going to be a challenge for me. Which is sad because I do want to work in the world of software… I was considering taking C++ this year, but I decided to instead take a logic course (primarily because I’m gonna have a pretty busy Senior year between pre-calc, literature, Latin II and Physics). Depending on how my schooling goes in College I might try to take some programming then. Or I might drop the software idea all together and just go with that nagging thought in my head that I should do something with an English degree of some sort…

    gah! I hate making life changing decisions…

  30. Galenor says:

    “I don't know what kids are taught these days.”

    20 year old University student calling in! :)

    The ‘cool’ language for most beginners nowadays to learn is definitely C++. I just spent an academic year learning it.
    The tutors also bundled in a program called ‘Gwin’, that allows the coding to be even simpler. For example, to write text, you merely have to type ‘Gwin.writeText ([X Co-ord], [Y Co-ord], “[Text]”)’. So, Gwin.writeText (10,10,”Hello World”) would produce ‘Hello World’ at the coords 10,10 of the Gwin window. It had other neat features like easy font changes (Gwin.fontcolour), easy shape drawing (Gwin.circle), and even layers to aid animation and game making. The tutors did advise us to pick up a book called ‘C++ How to Program’ by Deitel (http://www.deitel.com/Books/CPlusPlus/CPlusPlusHowtoProgram6e/tabid/2046/Default.aspx), so that when we’re ready to take the stabilizers off and use the big scary cout>>, we could be ready for it.

    I reckon if you got a head for logic, C++ is a pretty cool language to start off in!

  31. Deoxy: That sort of functionality is only available in Fortran through external libraries, which is pretty much the worst situation. Most modern languages have no numerical limitations (i.e. arbitrary precision) transparently by default. The only people I know who still write any Fortran are old engineers who don’t know anything else. It’s really not a very good language.

    It is said, “A computer without COBOL and FORTRAN is like a piece of chocolate cake without ketchup or mustard.”

  32. Neil says:

    @ Deoxy
    Yeah, I realize now that Fortran has its advantages in certain places, but that seems to be the case because no one ever wanted to spend the money to make a replacement. Our textbooks were for Fortran 94 with a 2003 update, if I remeber correctly.
    Besides, is it appropriate for a bunch of students who have never programed in anything before, and to expect them to code a 100% functioning RSA decrypter and grade it pass/fail?
    I suppose the inadequacies of the instruction left me bitter moreso than the difficulies of the language.
    Ok, here’s some adivice to new programmers: Find a good instructor if you can.

  33. LintMan says:

    I’ll third “Code Complete” by Steve McConnell. I found much of the stuff in it to be common-sense and best-practice stuff I already knew, but I’ve had a good formal programming education. Another self-taught blogger, Jeff Atwood over at Coding Horror (whose site I recommend) swears by this book, and even took his blog’s name from a sidebar title in it.

    Most programmers will tell you that once you know how to program in general, learning a new programming language is generally pretty easy. The broad concepts of programming are pretty universal. Different languages make different tasks harder or easier – some are more automated and do a lot more for you but sometimes the tradeoff there is that it is harder to do other things, or there is a performance cost. Certainly everyone has preferences, but there is no one “best” language for all purposes. Try to keep some healthy skepticism for anyone telling you some set of languages sucks or is the best thing ever. Except for COBOL – that just sucks. :-)

    My personal preference is C++, but as others have said, C++ gives you more than enough rope to hang yourself. Other languages automate and conceal things that C++ requires you to handle yourself, and if you mishandle them bad things happen. But it’s not nearly as hard or unmanageable to deal with as some make it out to be, and there’s something good to be said for being able to understand and control the underlying mechanisms of your program.

    For whatever language you pick, I’d recommend buying 2 language-specific books for it: a dedicated teaching/guide book and a dedicated reference book. Don’t cheap out and try to get an “all-in-one” programming book that has a few programming chapters puffed up with a weak reference section.

    I actually teach the after-hours Intro to C++ class for my employer. The class textbook I picked out was C++ How To Program by Deitel & Dietel. I taught myself C++ with an earlier edition of this book. For a reference, I recommended my class get the C+ “bible”: The C++ Programming Language by Bjarne Stroustrup, the creator of C++.

  34. Brandon says:

    I am not a programmer by any stretch, but the best learning experience I had with a programming language was Java. People complain about Java’s performance, but compared to other easy languages like Python it’s actually quite fast. Also, Java is great for introducing modern programming concepts without bogging people down too much. Not only that, but what you end up with is rather portable code.

  35. Groboclown says:

    If you’re looking for a good introduction to graphics programming, my favorite to this day is still Michael Abrash’s “Zen of Graphics Programming.” I don’t know if you can still find it, but it’s one I keep going back to.

    A side note – it gets very, very low level, and teaches how to draw the graphic primitives, eventually leading up to rendering 3d textured models by the pixel. Note that it leaves a lot out (such as clipping objects to the display).

  36. Galenor says:

    Just a quick note, because my ‘edit post’ timer has run out.

    Thanks for the link to those OpenGL lessons! I was skeptical that I’d make much progress, but I just managed to burn through the first five lessons, and built a rotating 3D trapezium from scratch. Awesome!

  37. Hotsauce says:

    Interesting timing on this one, as I just exchanged dead trees with green ink for dead trees with black ink and picked up a copy of Teach Yourself Java 6 in 21 Days (which appears to be a more recent book than the version at newdata.box.sk). I ditched Java for Dummies because I got tired of, well, being treated like a dummy.

  38. Ysabel says:

    I love Python and would totally recommend it as a starting language over C++, even though C++ is by far my favorite language for many practical things.

    That said, Why’s (Poignant) Guide to Ruby actually makes a remarkably good introduction to programming, and Ruby works well as a starting language too.

    My biggest advice to someone wanting to learn programming is “learn more than one langauge”. Preferably more than one type of language. Learning only one language really limits your thinking.

  39. Zolthanite says:

    Completely biased, but I semi-second the Haskell notion, but raise it by saying learn Scheme using How To Design Programs for a few reasons:

    1) HTDP is taught with Scheme, but the concepts are all language agnostic. IT focuses on program design and how to SOLVE problems, not simply a few cookbook recipes on how to DO something specific

    2) It’s used as the first CS course at Northeastern University and has been for some time. The book is due for an update in another year or so.

    3) Scheme is far easier to understand than Haskell’s pattern matching. It still uses the same input model as C-styled languages without getting too weird.

    4) I’ve taught intro CS in Scheme, Python, Java, and Jython, and by far the programmers that gained the most lasting mileage were the Scheme ones.

    5) How To Design Programs is free at http://www.htdp.org/.

    6) The IDE is really simple and newbie friendly, designed by educators not industry. I tell my Java kids to use Emacs and learn Eclipse in later classes where it’s useful to integrate CVS and all the project stuff makes sense.

    After you get comfortable with that, switch into either Python or Java depending on how far down the OO rabbit hole you want to go.

    As a shameless plug to my alma mater, the College of Computing at Georgia Tech has archives of all of their old course websites (edit: Or did, a lot seem to be broken now). If you want the GT lecture slides on Scheme (And Java, which are equally sexy and well-designed for reading), you’ll want CS1321 and CS1322 from the 2002-2003 academic year.

    http://www.cc.gatech.edu/classes/AY2003/cs1321_spring/
    http://www.cc.gatech.edu/classes/AY2003/cs1322_spring/

  40. edcalaban says:

    I took a class in Visual Basic in high school, and while it’s an easy language to learn a large amount of the formatting taught by our teacher is… well, completely obfuscating and she wasn’t the brightest programmer I’ve seen. The real advantage I got from learning basic was getting an understanding of the basic concepts and having someone I could go to for ideas on WHAT to program.

    My personal recommendation is to take a class if your high school offers it – this is a great way to be able to get the basic concepts down, even if your teacher isn’t the best. Keep exploring outside of class in whichever language you feel is best.
    If you go the entirely self-taught route, find someone to help when you hit a sticking point. Having someone who can look over your shoulder and explain why what you did isn’t/shouldn’t work is incredibly helpful. Don’t go to them for every little thing or you’ll become too dependent on their assistance, but if you just can’t figure out how to do something they might have a trick or two that’ll help smooth things out.

  41. Alan De Smet says:

    While I agree that C++ is a scary beast of a language, it’s also the most common language for 3d graphics these days. You’ll have a bigger community, more tutorials, and the like. If you want to work with other people on 3d software, either as a hobby or professionally, you’ll probably be working in C++ or more rarely C. (Moving between C and C++ is relatively straightforward.)

    Now, if you’re willing to live without 3d, well, you can still make lots of fun games (see also: the internet.). I’d suggest Flash, whose programming language is essentially Javascript. A case could be made for more structured languages, especially Python with PyGame, but Flash lets you make shiny stuff fast, and just about anyone can play your game online with trivial effort. If you go this route, I liked Beginning Flash Game Programming For Dummies as an intro because it skipped the “how to make a non-interactive movie” and got right to the programming. However, I have over a decade of professional experience, so it’s possible that the book won’t work so well in a new programmers hands. It claims to; I just don’t know.

    If one is interested in dabbling in programming in general, Python (again, possibly with PyGame) is straightforward. Many programmers, myself included, find it overly restrictive, but this is a benefit as a teaching language. And many serious programmers swear by it as a day-to-day language.

    If you’re seriously interested in programming, well, back to C++ or C. The very thing that drives people away: pointers and memory management, are the very reason a serious programmer should know these languages. If you can’t do your own memory management you’ll always be blocked from some areas of programming. If you can handle C++ or C, you should be able to handle any other language you want. But if you start with, say Java, you might be pretty good at Java, but be unable to make the jump to C++/C. I’ve unfortunately seen this too often.

    (It could be argued that a serious programmer should also be fluent with functional programming. While arguably true, you can get much further in the field without really getting functional programming than you can without really getting pointers and memory management.)

    For a new user interested in programming in general or graphics work, I would recommend against Ruby. It’s a fine language, and Why’s Poignant Guide is quite good. But it’s less mature and has a smaller community.

    Similarly, I would recommend against Java unless your goal is to learn to program and get a job as quickly as possible. Java is a fine language, but nothing really leaps out as attractive to a dabbler.

    Note that in every case there are legal, free tools for developing in these languages; you don’t need to spend money on new software. For the specific case of Flash, it’s not quite as obvious where to get it, so here is the free software.

  42. Colonel Slate says:

    Whoa, whoa, ok, so from a guy that knows lots of coding, and I’m sure you guys do to, but also a guy that is having to take an “Intro to Computer Programming” class in College at the moment, let me tell you that, they don’t even bring up Visual BASIC or BASIC anymore, if you wanted to learn that, you had to learn it in high school, PYTHON is taught with the people that are learning HTML, and isn’t considered a real programing language, C++ was what the intro was, but now it’s Java.

    My real advice, learn one, get good at it, then learn another, there is no true “easy” language if you ask me, the first is, and always will be the hardest, after you learn one, you can go and find out all about all the other things that you want your programming language to do, and see if it can do it, otherwise, learn another one, learning a programming language after your first is actually quite easy.

    TLDR:Pick one, learn it, they’ll all be hard cause it’s your first, but you’ll know how to program.

  43. Sheer_FALACY says:

    Python is a beautiful language in many ways, and it will teach you some good habits (IE indentation). On the other hand, it’s loosely typed and doesn’t require variable declaration. Transitioning from, say, Java to Python is glorious and freeing. Going the other way, not so much.

    Probably the best way to learn Java would be to just get a boilerplate file and copy that rather than making new ones. It’s incredibly unfriendly to make someone new type out public static void main(String[] args) every time they’re writing a program, but once you’re past that it’s much easier to proceed.

  44. Alan says:

    This is relevant to my interests.

    I have been pondering about taking up programming for a while now, although I was thinking about doing some Internet language such as PHP or asp.net.

    Cheers.

  45. asterismW says:

    I’m surprised no one else has commented about NeHe. I used that site almost exclusively when I was learning OpenGL. It’s a great site, and as Shamus said, very easy to follow and learn from.

    I’m also surprised there are so many naysayers about C++. I started with C++ (granted, I learned it from classes in college), and it’s provided a very solid basis for learning other languages (Java, OpenGL, Ruby, VBScript). I would recommend starting there too, though having started there myself, I’m probably biased.

  46. food4worms says:

    One of the coolest experiences of my programming life was discovering unit testing and test-driven development. Nothing I have ever read about object oriented programming came anywhere close to focussing my understanding of what an object should be than the act of writing unit tests for one. When you are writing a collection of tests for an object, it becomes very easy to see what belongs (e.g., that which is easy to write a test for) from what doesn’t (e.g., any test that requires you to write exceptions in your setup code).

    Get yourself a copy of Test Driven Development (http://www.amazon.com/Test-Driven-Development-Addison-Wesley-Signature/dp/0321146530/ref=sr_1_1?ie=UTF8&s=books&qid=1243968694&sr=8-1) and a unit testing framework for your language (there’s tons on the Extreme Programming site’s software page: http://xprogramming.com/software).

  47. Feste says:

    The first language I learned was Python and I found it great fun. Aside from all the in-depth Computer Science discussion, the simple fact that Python has such a minimalist syntax allows you to concentrate on learning how to programme rather than the correct use of braces and semi-colons.

    Object Orientation and programme design can come later. It’s important to show how much fun programming can be than how complex it often can be.

  48. wumpus says:

    Howdy,

    Caveat: As someone who traversed the BASIC, FORTRAN, C, C++ pathway (and who has poked around a bit in Objective C and Java and worked extensively in various assemblers) I can’t really comment on the higher level languages.

    But, as an embedded systems programmer, I would point out to those waving and shouting about not starting with C that if you are intending to work in any way close to the hardware, in real time, etc. – as with, say, graphics programming – then you are going to need to know how the hardware works, and the furthest you can stand from it and still make efficient code, is, in my experience, C (or possibly C++). As soon as you try to move to higher level languages, you are at the mercy of Other People’s Code (TM), often without even realizing it. And you still need to know the low level anyway, for when things go wrong.

    Further – and this is relevant to the docs & tutorial thread as well – good ol’ Kernighan & Ritchie is actually quite readable, both as an introduction to the language, and as an introduction to standard usage and libraries. (And, of course, as a reference as well.) Lots of good example code in the right size chunks, plus a good index, and highly detailed reference(s) hidden in the back.

    Hope that helps,
    Alex

    PS – My other bit of advice to newbies: Learn not just to write code, but to read code. Many programmers have only vestigial abilities in the latter area, to their detriment.

  49. gorthol says:

    Even though my favorite language is C++, I don’t recommend starting with it. What I would recommend is starting with another language, such as Java or Python, and then moving on to C++ after having learned the basics. Once you know C++, the transition to any other language should be relatively easy.

    I personally took a horrible path to learning to program. I started by learning QBASIC (it was available on my computer…so sue me), then moving on to TI BASIC (because I wanted to program my calculator), one summer of Java, and then a year of C++, followed by some scheme. I think working in C++ did the most good for me, but having a taste of Java/BASIC to start with was definitely helpful.

  50. wererogue says:

    Like many above, I’d say Java and C# are better languages to start with than C++ – they’ll get you into some Object Orientation habits that C++ doesn’t enforce, but are really good practice. C# has a little more of C++’s style than Java, but it’s really easy to pick up either if you know the other. They also provide a whole bunch of libraries so that you can get started without having to learn everything from scratch. Finally, they’re both dead simple to compile and debug, and there’s no messing around with the preprocessor or linker.

    That said, I’d fully recommend learning C++ if you’re looking for a career. I’ve gotten one job in the games industry for my Java experience, and that one was a real outlier. While C# is a really viable games language nowadays, I’ve never seen it on a list of job requirements – the industry really isn’t ready to commit to it. Also, there’s a real C++ culture going on – even if they need C#, a lot of people hiring are going to want to know that you can do it “the hard way” if you need to.

    Having just read the thread, I’d take some issue with the bile against C++ above. I agree that C++ isn’t inherently elegant, but it does allow you to use C in elegant ways, while retaining the ability to use some screamingly fast global functions, or even dip into assembler with most compilers. Those are features not to discard lightly with games, unless you’re willing to say “my feature isn’t fast enough, so I’ll drop it”.

  51. Carra says:

    America, the land where you have to take a loan to pay for your studies… I paid about €100 for the entry fee and let’s say €150 for the books each year. That got me a masters degree.

    But anyway, I’ll also put in a vote for Code Complete. Great book that will learn you the basics you need to know. One of these wisdoms being that you shouldn’t get yourself dragged into code standard wars.

  52. Johannes says:

    @Chris Wellons:

    As I was reading your story about the SICP book, I was like “hm, I didn’t do that back in the days” – and then I remembered: oh shoot, I actually DID start with such a book! The thing was, I didn’t have access to the ‘internet’ (which barely existed back then), much less to a decent library. So while I was practicing QBasic (got a reader from one teacher of mine), I was searching for all kinds of books on how to learn to program.

    And dang, I lost the title of the book I had found back then… It did discuss algorithms, and more of what I’ve seen from SICP at a quick glance.

    Oh, another fun night time story for those interested: after QBasic I wanted to learn a ‘real’ language. The one other language we had at school was Turbo Pascal (and maybe even C, but I probably found that way too user unfriendly, spoiled brat as I was). I didn’t find a decent book on it though; all I could find was a book named “IDE Design in Turbo Vision” (or something like that).

    And there I was, trying to learn a programming language by figuring out all kinds of advanced OO code listings, the basics of which weren’t even explained because the writers fully expected the reader to have passed that station a looong time ago. I mean, what the heck does ‘MyApp.HandleEvent’ do and why doesn’t the program do anything anymore when I remove it, when all you have to write in Basic is two lines of code and voila, you have a screen filled with playfully coloured wobbly strings of text?

    Oh, eventually I didn’t learn the language, by the way. I discovered that Pascal (even Borlands variety of it) didn’t suit my needs (which were to make a Doom level designer operating in SVGA color mode). So I started to learn C++.

    That was years ago. Now I’m a Java-programmer.

    I found re-creating the Turbo Vision environment in C++ a great way to get some basic understanding of OO, though, even if programming the whole thing to work using SVGA was way too much asked; trying to get it all to work in DOS text mode was challenging and fun enough. And so were the occasional bright coloured screens when I had messed up once again and some pointer had exploded, or something like that, and I had to restart my PC once again.

  53. Blake says:

    Where I studied we did a year of Java before moving onto C++.
    I found this worked quite well as the Java documentation is very easy to read, the compiler errors are quite human friendly and I could focus on learning about OO programming without having the insane amount of options available in C.

    Once I got onto C++ they basically only needed to teach us memory management and templates and then I had a pretty solid foundation to work off.

    I’ve been working in a games studio for a bit over a year now and haven’t had a problem so I think people should start with Java (or even Flash Actionscript can be quite good) and then if they want to get into game development they can learn C.

  54. ngthagg says:

    I learned java first, before moving onto C and then C++. Java is much friendlier (as Blake #53 mentions) and will ease the debugging side of things.

    I would recommend skipping C, because it is far too close to C++. When I made the switch, I discovered that I was misusing some parts of the language because of subtle changes.

    When working with openGL, use GLUT to get started. That’s my only problem with the NeHe tutorials. And put a bookmark on this page. This site has saved me a ton of headaches, trying to remember symbolic constants and the like.

    Finally, especially if you’re new to coding: don’t be afraid to reuse code. If you find yourself typing the same stuff during different projects, ask yourself if it would be faster to copy, paste, and modify the old code. Or to make up a template (templates are great once you get past one-file projects!).

    Er . . . and finally finally, don’t compare your graphics programs to the stuff that comes out now. Instead compare them to PSX/Saturn era games. You’ll likely be amazed at how similar the results are.

  55. Ganon42 says:

    So far, I’ve done a half year of Visual Basic, which was pretty good for introducing basic programming concepts (if statements, loops), but I’ve forgotten the actual language specific stuff I learned.
    This year I’ve been taking Java, and it seems like its pretty good for learning a lot of stuff, as long as you can figure out objects (which took me a while, but I’ve pretty well since then).

  56. grep says:

    It’s really the way you’re taught the language rather than the language itself, to a certain extent. I’d recommend picking a good book, and going through it. Java is used commonly, partially because you don’t have to understand pointers. Anyways, I’ve heard SICP being thrown around, that’s a good book, assuming you can wrap your head around recursion. Scheme is a good language, but might not be the best if you want to dive right into C++ style graphics. I’d recommend a good Java book, followed by a good C++ book. Here’s the website for the book used in the intro class @ University of Washington: http://www.buildingjavaprograms.com/

  57. Mistwraithe says:

    Someone mentioned Pascal as a good learning language (that was afterall what it was designed for) but pointed out it wasn’t used for anything these days.

    The modern equivalent is of course Delphi (from Embarcadero after divesting from Borland). I learnt Pascal, VB and C as my first languages and then moved to Delphi from there. It was billed as the power of C with the simplicity of VB which still holds true today.

  58. wumpus says:

    Howdy,

    Not to start a flamewar or anything, but I think it’s worth pointing out that Object Oriented coding is not actually terribly well suited to many programming tasks. It’s great for, for instance GUIs; it’s nowhere near so great for, say, signal processing. (It’s rather unintuitive to model processes as objects.)

    Not having done much graphics coding (though I did work extensively on one of the early MPEG video encoding chips), I can’t say for sure how useful OO is for attacking it, but the audio coding I work on is much, much more intuitively handled using non-OO methods (in general). (I mostly do what used to be called ‘structured programming’.) Some of the most broken and unreadable code I’ve had to deal with was ‘C++’ code for doing audio DSP.

    So it seems odd to me that many of the posters above take it as a given that anyone who is learning a programming language will need to learn OO. While most languages become associated with a design paradigm, they aren’t the same thing, and while OO has been in fashion for at least 15 years, there were all sorts of things written before it came around, and there continue to be many things written without it. (Can I get a shout out from the functional programmers? Any other structural/procedural curmudgeons out there?) It’s really a case of choosing the right tools for the job, as usual.

    Hope that helps,
    Alex

    1. Shamus says:

      wumpus: When I made the jump from C to C++ (ten-ish years ago) I made the mistake for over-objectifying stuff. EVERYTHING must be a class, with private variables, a constructor, deconstructor, a class interface, etc etc.

      I finally got the hang of it, but it took a while. Thankfully most of these blunders were in side projects and not my pro work. It turns out very little of the code I write needs to be OO.

  59. Apologista says:

    The procedural content city made me go look into machine languages, and the one I picked up on was C++. It is definitely horses for courses. I know a programmer who wrote me out a project to do in three phases, and I’m now on phase 3, and have only just had to ask for help.

    There are three main problems with teaching yourself. The rate at which you learn is limited not just by how much you study, but also by how much you can use it. So I read up on pointers and then had no use for them, and so I’ve forgotten most of what I read about them. Related to that, but part two of the problem; as mentioned in the main post, you have no innate way of ordering a language you have learned by yourself. I had lots of code that worked until I started trying to split it up, and I couldn’t find a tutorial for that at all. It took a friend of mine to take me through his habits of naming variables, to get me on what I figure is the right track.

    Third, when you only have a jawbone, everything looks like a Philistine. You can do a lot of work in C++ with very few methods, as long as you don’t mind the fact you are being inefficient. Getting to the stage where you know what your tools are while not losing track of what you want to do is crucial.

    Most of that has been said already, but if there are people reading this who are learning, there’s one piece of advice I can give you: do not even try starting on your mega project until you have more than a jawbone and a bad haircut to your name. You will have to re-write it later to make it efficient, and you’ll come to hate the re-writes.

    I couldn’t find a site with suggested short projects to help a newbie learn, but I was lucky to have a friend who could provide. If anyone does know of a site like that, please say. It’s the most useful thing I could think of having.

  60. Johan says:

    Hey, this is sort of exactly the kind of advice I was looking for! Thanks!

  61. Cuthalion says:

    I learned using a game editor that was basically C++ with most of the background stuff handled for you and a bunch of game-related functions prewritten for you. Or at least, that’s what I think it was. It was called ProjectFUN. It was in a high school class that was apparently run or overseen by a nearby university called The DigiPen Institute of Technology. I also learned Java more or less simultaneously at a community college. The only thing I learned before that was a programming logic class (quite helpful) and a day or two of php in high school that convinced me that programming actually made some sense.

    So I say Java for starters, or C++, which seems a bit harder. Both are widely used and quite similar in what you type, if not necessarily in how they work.

    Right now I’m using RPGCode, which is sort of in between a scripting language and a programming language. I think. I know it’s compiled, but it’s also interpreted. Or something like that. I guess it’s halfway compiled. Anyway, it’s specifically designed for making RPG’s, though action games are not unheard of (and are actually more popular on its web site than the RPG’s). It use dynamic typing and declaring variables explicitly is recommended to help avoid memory leaks caused by defaulting to global scope, but is done implicitly for you if you don’t. Terminators (;) are optional. It looks like C++ and Java as far as syntax and () [] {} goes.

    Check out toolkitzone.com if you want an easy language and an editor designed for RPG’s. But be warned, RPGCode does a lot of work for you in the background that you’ll have to learn to do yourself if you want to use C++ or Java or most “real” langauges later.

  62. Mayhem says:

    I want to echo the comments from LintMan @33

    Deitel and Deitel’s How To Program books are very very good once you know the basics of syntax. There are books covering Java, C++, Visual C# and most other popular languages even probably by now a how to visually program C#!%% visually with visual concepts for the advanced visualiser.

    Ahem. Anyway, the books are superb for teaching everything you need to know to actually USE a given language as opposed to just constructing sentences. Being quite readable instead of dry is a definite bonus.
    Once you understand how your chosen language works, you can pick up a book like Code Complete and it will teach you language independant best practice, but I’d recommend against starting with it somply because you need to make mistakes first to understand *why* best practice becomes important, and also because Code Complete also inherently assumes a basic knowledge of programming concepts which you can’t know without knowing at least one language to start with.

    I’d also second the benefits of knowing a non-object oriented language, as that makes you realise there is more than just a hammer in your tool box and you might not need to hit the problem to get the same result.

    As an afterthought I’d mention learning SQL because of how fundamental databases are becoming now although that draws in the problem of making the tools that make the tools that do something useful and lots of messy issues of where exactly to start in a home setting (My efforts at learning VB.net fell over when to do anything I needed a database to pull from which needed sql server which needed a server which needed my bucket which had a hole etc etc).

    Possibly thats more for the advanced student ;)

  63. Mayhem says:

    Hmm, thinking about the advanced student, a couple of other very good books to make you think outside what you are doing are User Interface Design For Programmers by Joel Spolsky, which while a bit heavy on why something is wrong and light on how to do it right at least makes you think about the poor person who has to actually USE your funky new app.

    The Mythical Man Month by Frederick P. Brooks Jr. The programming side may be dated, but the ideas on communication, division of labor, and scheduling are completely timeless.

    Finally, Security Engineering: A Guide to Building Dependable Distributed Systems by Ross J. Anderson is one of the best books for understanding how and why you need to engineer your creations with underlying security concepts, whether it be software or hardware you create. It ranges from computing and banks through how truckers would cheat their mileage via cold war nukes and art theft. You may not think about security in your current role, but with all the variety of threats in todays world, a little thought goes a long way.

    The first edition of his book can be read entirely free here

  64. LintMan says:

    @wumpus: I started out with Apple/Commodore 64 BASIC in high school, then Pascal in college as my first “real” language. I taught myself C while still in school, and then did mainly embedded C programming after graduation. I was familiar with C++, but never *really* used it, so about 10 years ago I decided to take a formal course to force me to get practice with it. It paid off because my current job is much more C++ focused.

    So I’m very familiar with structured programming, and still probably revert to it more than I should, but I don’t feel quite so curmudgeon-ly about OO. Even when the “object” model doesn’t really map well to what I’m doing, I find that OO’s other benefits, such as inheritance and polymorphism still are quite beneficial. For example, I wrote a “thread” class such that I can easily turn ANY class derived from it into its own thread (such as for a data processing stream), with an interface to start and stop it and get performance statistics. The derived class’s interface then provides a convenient way to give controlled access to the thread, and put in synchronization mechanisms, etc as necessary.

    On the other hand, I do agree with you that structured programming should be another tool in a programmer’s toolbox, and it is definitely possible to go overboard with the OO.

    Lastly, I’ll also second your recommendation of Kernighan & Ritchie’s “The C Programming Language”. While’s it’s not written for real beginners, it’s an excellent introduction to C and very readable. I think I read the entire book in a day or two. Even for a C++ programmer, it might be worth reading – probably 90+% of the material is still apt for C++, and K&R is much easier/shorter to read than Stroustrup.

  65. Adamantyr says:

    I’m an old-school programmer myself, I learned BASIC on my trusty (and still firing up like a champ!) TI-99/4a back in the mid-80’s. For me, learning assembly was the prime goal, because once you knew that you could do anything. Unfortunately, the line-by-line assembler I had on cassette was a total bitch to use… it actually overwrote itself as you typed in programs. :S

    Anyway, as one of the “programming OS” era types, I do wonder how kids can even get interested in programming at all these days, since they’re so far removed from what happens. BASIC had its limits and poor structure, but it was usable, not difficult to learn, pretty powerful, and very imperative. Perfect for a kid. Most guys I meet don’t even see a line of code until they hit college… maybe a little in high school, depends on how backwards your county education is.

    C++ is powerful, but the C family is literally just an English parser on top of an assembler… but if you need power, it’s the way to go. I wrote a mapping program in C# and was disgusted when I hit the limit of what the graphics libraries could do in terms of speed.

    Also, yeah, I agree about college being useless for showing you “work code” and all the little work things you need to know, like doing builds, source management, file structuring, library creation, and so forth. I wrote a nice little Star Trek game in C++ using the GLUT engine, but I ended up making one massive file. Fortunately the professor knew next to nothing about it and still gave me an A for the graphics work.

  66. I’d have to agree with Mayhem about the Mythical Man Month, definitely worth a read for anyone planning to work in the industry.

    A fantastic introduction to C can be found in Hacking: The Art of Exploitation (it’s often praised for it’s section on C). Because of the subject matter it covers how the programs execute and function in memory and how to write much stronger and more secure code.

    Well worth the read.

  67. DaveMc says:

    This seems like a good crowd to ask something I’ve been wondering about: Are there applications that automate the process of user-interface building? It seems like it ought to be possible to set up a system where you can drag and drop buttons and menu items around, and then open up each one to say “Execute this code when this thing is clicked”. I haven’t looked into this for a long time, but when I last checked, everything I looked at still wanted me to do a lot of interrupt checking and mechanics of dealing with window movements, and all that sort of guff. These seem like standard operations, is it possible to have them handled in a standard way? Maybe there’s no such standard way, and you have to get involved in the details because otherwise it’s not obvious where variables are going to reside, which bits are going to be able to see them, etc. Still, it’s a dream I’ve had for a long time, and it doesn’t seem completely beyond the realm of possibility . . .

    Example: say you know how to write scientific computations, but have no idea how to run a user interface with windows and menus, and learning about that stuff is not really your goal. (This describes many grad students in the physical sciences.) It would be handy to be able to link your computational code to some sliders and menus for user interface purposes, to make it “prettier”, without investing huge amounts of time. Right now, the default solution in my group is to do things in some scripted environment like MATLAB, where there are some simple UI tools, or you can just type things into a script and run it from there. It’s not ideal in terms of efficiency, compared to executing compiled code.

    1. WJS says:

      Someone in that situation would probably be better off learning how to use a terminal. If your UI needs are as simple as you suggest, you probably don’t need a graphical one. The fad for mouse-driven GUI for programs that don’t need them (which is most, I find) needs to die already. For many programs, mouse-driven is the way to go, and I certainly won’t begrudge that to ones it’s actually the case for, but I’ve come across so many programs whose GUI consists of nothing more than a file selection box and a couple of buttons.

  68. Johan says:

    DaveMc: Heh, you basically just described Flash, complete with all the headache-inducing ambiguities of what is programming and what is interface design :)

  69. LintMan says:

    @DaveMc: I’ve been wishing for something along those lines myself for quite a while, but never had the time/energy to really dig into any of the possibilities. Eventually, I bit the bullet this past winter and learned MFC. Why MFC, which Microsoft is busily replacing with .NET? I supposed it’s because I’m a dinosaur. :-)

    But MFC is still a fair bit of effort and learning curve. There are easier methods out there, especially if you don’t need your program to have elaborate controls. Some possibilities:
    TCL/TK – Pretty easy to use scripting language (TCL) paired with GUI toolkit (TK). I believe it can be extended with C/C++ function calls. It’s pretty popular and cross-platform.
    Qt – powerful cross-platorm application framework (UI and more). Linux’s KDE GUI environment uses Qt.

    I’m not sure if the development tools for either of these would give you the fully automated GUI-builder you’re looking for, but I think with either of them, it’d be pretty easy for someone to take a simple bare-bones or template-type app and modify it to their own needs.

    That can also probably be said even for MFC or .NET, though. Once you see how a button or menu needs to work, it’s fairly easy to add or change them around.

    Speaking of .NET, MS seems to have made some things more automated and simpler to use compared to MFC, but I think it also uses managed code, which I think can be a headache if you want to integrate it with your own unmanaged code. But I haven’t really looked much at .NET, so I could be wrong.

    Lastly, if you’re doing things like plotting of data, the MATLAB Engine might be ideal for your purposes: MATLAB has a C or C++ interface library that allows you to directly call into MATLAB to do it. You can pass data variables back and forth to MATLAB, run math functions there, call up MATLAB plot or UI windows, etc, all from your C++ program – no scripts required. MATLAB Engine reference. I’ve used this a fair bit for data plotting, and it’s easy to use, and far quicker than trying to write my own graphics plot routines.

  70. KarmaDoor says:

    I have all but completely given up on programming. My start was with the various iterations of BASIC. Atari, Apple, and GW. The latter I got fairly far with to the point of programming direct pokes to video memory. That was after many lines of typing in already written code from magazines and books. Following that I tried just writing my games without so much as a plan, including hard-coded data. That quickly became disheartening.

    Years later I ended up learning QBasic as part of introductory college classes. Not surprisingly, I aced the grade. So I tried to take up the then new and trendy Java without any OO (read C++) background. That quickly became confusing.

    A few years later, I tried C++. That quickly slammed into my brain like a brick wall.

    The worst part is I can’t even pin-down what made everything seem insurmountable after a while. I did pick up another Java book recently, on recommendation, and started plodding along. I became fed-up rapidly with the code examples that didn’t really seem to be teaching me syntax any better than my pre-existing poor grasp on it.

    So, here’s a question. If everything is graphical these days, why are there so few graphical interfaces for coding? Alice is the sole example that comes to mind, and that’s still fairly linear. I have found other examples; not one of them is current or still maintained. Will “real coding” remain a long string of code, or can it actually develop into something that can at least be loosely grasped by a layperson?

  71. Mayhem says:

    If everything is graphical these days, why are there so few graphical interfaces for coding?

    I don’t quite understand where you are coming from here, but I believe you are talking about abstracting away coding through using a GUI interface?
    The problem with that is that to write a successful program, you generally want to do something that isn’t widely done. After all, thats why you are writing the program instead of using someone else’s.
    A GUI tool has to have predefined code for each action you might undertake (say, click the create new button and it will create a new file with a basic level of function) and because the code must be predefined by the GUI creator, usage of such tools tends to be restricted to entry level tasks.

    A good example for these would be web design tools, where most people with a few hours time to spare can knock up a webpage for their own use, but the underlying code created tends to be decidedly .. average .. and the resultant pages are only suitable for simple tasks, not usually for commercial purposes.

  72. Slithe says:

    C++ is okay, but it certainly has its detractors. I usually use C unless I absolutely have to use C++.

    RE:NEHE
    I am still learning graphics programming, so I may not be the best to judge, but I think the nehe tutorials are overrated. Two very important tutorials, Loading and Moving Through a 3D World and Collision Detection feature many of the problems you mentioned.

    Since moving through a 3D world will be the closest the tutorials get to a game engine (well, at least a one for noncasual games), it is quite important. In this tutorial, they not only show you how to move the camera through a 3D world, they also show you how to load the data from a file into sectors, triangles and vertices; they also show you how to load a bitmap texture and checker it all over the walls; they even include a walkbias! It seemed way too much information for a first demo.

    The tutorial for Collision Detection contained a bunch of help files and even sound code!! NeHe may be the best free source of OpenGL tutorials on the web, but it is not good.

  73. AlfieUK says:

    If you want to learn game programming then C, or more likely nowadays C++, is your only realistic option at the moment.

    C++ is used by pretty much all modern day (non-browser) games (alongside DirectX or OpenGL), can be platform-independent (depending upon API/library usage), and is one of the key languages looked for outside game programming as well.

    I’m a long time Visual Basic user (Classic v4-v6), but even I’ve started moving to C++ (since .NET came along) otherwise I can’t migrate my DirectX code above DX8 (VB.NET is not a realistic option).

    I started on C64 Basic, then GFA Basic, then moved to VB, and whilst VB is an easy to learn language it does teach bad habits (memory management, pointers, and garbage collection are key things VB handles for you and hence doesn’t teach you). There’s also no guarantee that MS won’t abandon C# like they did with VB, but because C++ is primarily platform-agnostic you won’t lose your codebase because the supplier decides to change tack.

    There are many C and C++ e-books, tutorials and compilers available for free on the net, so it can be a zero-cost way to find out if you have any programming aptitude before embarking on more complex training.

    C++/DirectX and C++/OpenGL tutorials are ten-a-penny on the web, with some good ones like NeHe, so it’s very easy to go through 2 or 3 tutorials and see how people set up the basics and where they differ in approach to the more complex aspects.

    Something I was going to say in response to the ‘Example Code’ post here was the MS DirectX tutorials do seem to be better at explaining the basics now, even if their code isn’t very efficient :)

  74. Amazon warrior says:

    Heh. I remember BASIC. And Turtle! I used to be able to program our C64 and Spectrum. The Speccie’s BASIC was a weird perversion of “regular” BASIC, as I recall. Happy days! I’ve been thinking about learning something a bit more current (I feel like I can speak Latin but not Italian!), so thanks for the tips on getting started – much ‘preciated! :)

  75. Miako says:

    I loathe basic, mainly due to a teacher who expected us to “already know the language”. ugh.

    Java’s great for a three week course, no more. Once you get the very basics (not multiple inheritance), it’s time to hop over to C++. If you spend ANY longer on Java, it WILL teach you bad habits. Memory management is GOD, and until you learn good habits there, you’re at the level of codemonkey. Hi! I write image processing software, and each frame that I want to store is 900K TIMES the amount of data per pixel-channel (HSV, RGB). And that’s if I pack it into chars. ints run faster.

    If you think that pointer arithmetic is hard, you don’t have the math background to be programming. Drop down and learn some assembly, then come back up for air.

    someone above:
    All my image processing runs on the filter principle, which seems applicable to any sort of signal processing. Each filter (each transformation) is it’s own happy little class.

    Then you get the fun of creating a completely reorderable system — using method pointers to create a linked list (umm… this is what happens when you’re learning a programming language. WHEN do you need a linked list? filterchains! If you ARENT busy creating uses for each thing that you learn, you aren’t learning)

  76. lflcorreia says:

    May I recomend Processing. It’s JAVA simplified making it easy to create graphics apps, with already a lot of libraries developed for sound processing, webcam support, video creation, various file formats reading, etc. And has the bonus of being cross platform (Window$, Linux, MacOSX). It can run in a standalone application or embedded on a webpage.
    For starting to learn programming I suggest BASIC (I’ve learned to program with the Sinclair ZX Spectrum BASIC on the 80’s).
    Then you can try FreeBASIC. It even has a graphics library with OpenGL support.
    But for serious programming then C/C++ is the way to go!
    By the way: the NEHE tutorials are the best we can find on the subject.

  77. Chris says:

    NeHe OpenGL Tutorials +1

  78. Xxaxx says:

    I’d suggest starting out on C++ or a similar language, but only so that when you try out Python, you will be appropriately blown away. Don’t start on Python though, or it will be quite a lot harder to switch over to C++ with all its awkward syntax, and unfortunately sometimes some knowledge of C++ is important.

  79. EMK says:

    thanks! i wanted to be a programmer from when i was 10 years old! I already poked around the internet and read a couple of tutorials. I have very basic c++ knowledge, and some python knowledge.

  80. EMK says:

    i have found a good language for 2d graphic programming. It’s a variation of Basic so it’s very simple yet powerful. It’s called Playbasic and there’s a free learning edition. The engine comes with a lot of example code and is very easy to use. So everyone who wants to do some actual graphic PROGRAMMING, not just muck about with game makers, try it out! It would be awesome if you could post on the frontpage about this, Shamus, so more people have the chance to try it out. :)

  81. Pingback: emotibase » thwas
  82. WarbrightMD says:

    On a different note, medicine does not require whole lots of brain power. Really its about time, effort, and resistance to fatigue. I can diagnose people fairly quickly unless they have something very uncommon (because I understand how bodies work, and I’ve seen a variety of stuff). On the other hand I’m hard pressed when even attempting to make a web page. In fact, this post will probably be messed up.

    p.s. I’m at work right now…gotta love residency.
    p.p.s. Fan of the site never posted before, figured I’d post about something completely unimportant and see if I get burned by these clever posters.

Thanks for joining the discussion. Be nice, don't post angry, and enjoy yourself. This is supposed to be fun. Your email address will not be published. Required fields are marked*

You can enclose spoilers in <strike> tags like so:
<strike>Darth Vader is Luke's father!</strike>

You can make things italics like this:
Can you imagine having Darth Vader as your <i>father</i>?

You can make things bold like this:
I'm <b>very</b> glad Darth Vader isn't my father.

You can make links like this:
I'm reading about <a href="http://en.wikipedia.org/wiki/Darth_Vader">Darth Vader</a> on Wikipedia!

You can quote someone like this:
Darth Vader said <blockquote>Luke, I am your father.</blockquote>

Leave a Reply

Your email address will not be published. Required fields are marked *