{"id":3519,"date":"2009-06-02T07:50:25","date_gmt":"2009-06-02T11:50:25","guid":{"rendered":"http:\/\/www.shamusyoung.com\/twentysidedtale\/?p=3519"},"modified":"2009-08-06T14:12:53","modified_gmt":"2009-08-06T18:12:53","slug":"getting-started-with-programming","status":"publish","type":"post","link":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=3519","title":{"rendered":"Getting Started with Programming"},"content":{"rendered":"<p>The <a href=\"?p=2940\">procedural city project<\/a> 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?<\/p>\n<p>Those are all big questions.  I guess the first thing I&#8217;d do is make sure you know what you&#8217;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&#8217;t have to worry about being sued by bereaved next-of-kin for your newbie mistakes.  You&#8217;ll just crash people&#8217;s computers.  And Microsoft has proven you can&#8217;t go broke doing that.) But jumping into &#8220;graphics programming&#8221; before learning &#8220;programming&#8221; is probably not the smoothest route to knowledge.  Learning programming isn&#8217;t quite the mental challenge medicine is (one assumes, judging by their relative salaries) but like any body of knowledge it <em>does<\/em> take time to acquire.  <\/p>\n<p>Aside from a few COBOL courses in school, I&#8217;m entirely self-taught. (The one language I was taught &#8211; <em>twice<\/em> &#8211; is the one language I don&#8217;t know.  I couldn&#8217;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&#8217;re emailing me.  If you were looking for formal education then you&#8217;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&#8217;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 &#8220;no&#8221; side of the argument, but a lot of coders would argue with me. And the successful ones generally make a <em>lot<\/em> more than I do. QED.<\/p>\n<p>Jumping in and learning a modern professional-grade language can be a bit much.  In the 80&#8217;s, most kids were introduced to something much simpler, like <a href=\"http:\/\/en.wikipedia.org\/wiki\/BASIC\">BASIC<\/a>, <a href=\"http:\/\/en.wikipedia.org\/wiki\/Logo_(programming_language)\">Logo<\/a>, or (if they&#8217;re quite young) <a href=\"http:\/\/en.wikipedia.org\/wiki\/Turtle_graphics\">Turtle<\/a>.  I don&#8217;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&#8217;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&#8217;ll usually have gotten a head full of music theory by the time you&#8217;ve learned to operate the thing.  Then you&#8217;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&#8217;re reducing the steepness of the learning curve in exchange for making it longer. <\/p>\n<p>So, assuming you want to learn some graphics programming, don&#8217;t mind investing time in generalized programming first, aren&#8217;t afraid of a steep learning curve, and aren&#8217;t looking to score a degree, then my advice may be of some use to you.  <\/p>\n<p><a href=\"http:\/\/en.wikipedia.org\/wiki\/C%2B%2B\">C++<\/a> is a good starting language, although there are enthusiastic adherents to many other languages.  <a href=\"http:\/\/en.wikipedia.org\/wiki\/C_Sharp_(programming_language)\">C#<\/a> and <a href=\"http:\/\/en.wikipedia.org\/wiki\/Python_(programming_language)\">Python<\/a> 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&#8217;t be able to find anyone at all.<\/p>\n<p>I suggest starting with <a href=\"http:\/\/newdata.box.sk\/bx\/c\/\">Teach Yourself C++ in 21 Days<\/a>.  Partly because it&#8217;s a great book (aside from some nitpicks with the way and the rate at which complex concepts are introduced) but mostly because it&#8217;s <a href=\"http:\/\/newdata.box.sk\/bx\/c\/\">freely available online<\/a>. You can also get a <a href=\"http:\/\/www.amazon.com\/Sams-Teach-Yourself-Days-5th\/dp\/0672327112\/ref=pd_sim_b_5\">dead tree copy<\/a>, which can be handy. Don&#8217;t be put off by the &#8220;21 days&#8221; stuff.  You can blow through the first half-dozen lessons in an afternoon.  Things will slow down after that, but the &#8220;21 days&#8221; 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&#8217;ve purchased a few copies of the book and given them away to aspiring young programmers over the years. <\/p>\n<p>Sadly, I&#8217;ve never found good books or tutorials that teach the concepts beyond language syntax.  So, after your 21 days you&#8217;ll know how to write a program to balance your checkbook or play blackjack, but you&#8217;ll still have no idea how to structure your program by breaking it up into different modules. (That&#8217;s fancy programmer talk for putting the source code into different text files.)  You&#8217;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&#8217;t know about LIB files, what they are, or how to use them.  You won&#8217;t know about development environments, or MAKE files, or how to read a debug stack.  You&#8217;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&#8217;t know how to link to one.  You won&#8217;t know how to <em>really<\/em> debug your program.  (Although you&#8217;ll think you will.)<\/p>\n<p>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 <a href=\"?p=461\">knowing what to type<\/a>.  There are books for refining existing skills in some of those areas, but they&#8217;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.  <\/p>\n<p>Thankfully, you can pick up most of that higher-level stuff as you go.  I did.  (Although I still can&#8217;t make use of a debug stack, even after all these years. And it&#8217;s not for lack of searching for someone who can explain it in English.) <\/p>\n<p>Once you have some basic knowledge of C++ programming, you&#8217;re ready for the graphics stuff.  At this point, there is no better place to go than <a href=\"http:\/\/nehe.gamedev.net\/\">NeHe productions<\/a>.  This is where I went to learn OpenGL.  The tutorials on NeHe are some of the best programming tutorials you&#8217;ll read.  It&#8217;s true that <a href=\"?p=3521\">most tutorials suck<\/a>, 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&#8217;s commentary and explanations.  (I highly recommend the latter.)  <\/p>\n<p>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) <a href=\"http:\/\/nehe.gamedev.net\/data\/lessons\/lesson.asp?lesson=03\">lesson 3<\/a> and seeing what happens when you plug different numbers in.  NeHe isn&#8217;t just a collection of the best graphics tutorials around, it&#8217;s some of the best programming tutorials of any kind, period.  It&#8217;s a site that focuses on teaching, rather then simply shoveling information in your direction. <\/p>\n<p>Good luck.  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;d do is make sure you [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[66],"tags":[],"class_list":["post-3519","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/3519","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3519"}],"version-history":[{"count":0,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/3519\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3519"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}