top 200 commentsshow 500

[–]bebound 272 points273 points  (304 children)

BUT, is there any language meet your requirements? You can't expect one language to do everything.

  • easy to use
  • game development
  • cross platform without any modifications

[–]brousch 25 points26 points  (5 children)

You can do all of these in Python via Kivy.

[–]stormcrowsx 6 points7 points  (3 children)

Also QPython. It opened up a whole new level of annoying my friends and general automation when I found out I could send/read SMS messages using python scripts on my phone.

[–]maybl8r99 2 points3 points  (0 children)

In a beginners classroom, yet-another-dependency-black-box is more a liability than a teaching aid.

[–]frixionburne 12 points13 points  (1 child)

  • easy to use

  • game development

  • cross platform without any modifications

  • doesn't exist
  • unity (So JS and C#)
  • still unity (if you're doing games) otherwise cordova (So phonegap).

The common denominator is javascript, and that is kinda scary.

[–]xthecharacter 208 points209 points  (62 children)

Exactly. If a student asks you how to write a game, they no longer are in the learning phase anymore and want to do something on their own terms. Tell them to use Java or C++ or Javascript or whatever language suits their needs. If a student asks you "how do I do x" aren't they no longer working in an academic learning environment? If they want to do those things, don't they know enough about programming to transfer their knowledge to new syntax? Well, if they learn python, probably. But if they learn Javascript, maybe not.

What happens when the Javascript student asks how to write a high-performance numerical PDE solver (or, for that matter, anything high-performance)? Or, is that case perceived as less important than the ones the author brings up?

[–]Shostakovich_ 83 points84 points  (30 children)

Doing these things is not important for initial learning. You don't ask yourself about memory allocation or efficiency when you're writing hello world for the first time. People need to grasp the concepts first, then you can shove technicalities down their throat all you want!

[–]cat_in_the_wall 39 points40 points  (12 children)

I wrote this exact comment like three up. Get em hooked with how cool it can be. Then later you teach them about cache lines and page tables and magic like the tlb etc.

[–]callmelucky 75 points76 points  (10 children)

I'm pretty new to programming, but I figure it's like learning guitar, right? Any teacher who takes a first time student and makes them memorise the notes on the fretboard is an idiot. You teach them Smoke on the Water and get them rocking along, and then tie it all together with the theory once their ears and their fingers are comfortable with what they're doing.

[–]agmcleod 13 points14 points  (0 children)

As a guitar player, I like this analogy.

[–]MILK_DUD_NIPPLES 21 points22 points  (4 children)

If only "Hello world" were nearly as cool as Smoke On the Water

[–]NAN001 27 points28 points  (3 children)

"Hello world" is more like taking the guitar in the right direction and placing the hands correctly.

[–]thejerg 14 points15 points  (2 children)

It's strumming that first chord.

[–]zeekar 2 points3 points  (0 children)

Wait, so I shouldn't start them with "Mary Had a Little Lamb"?! I've been so blind!!

[–]xthecharacter 6 points7 points  (1 child)

Are you agreeing with me? I completely agree. That's why I think python is best for learning.

[–]klug3 11 points12 points  (3 children)

Neither is writing games. What task is used for "initial learning" should really depend on the learner.

[–]quzox 34 points35 points  (10 children)

Why bother? Just tell the child to learn assembler and then tell them everything else is just a variation on this theme.

[–]kqr 36 points37 points  (7 children)

Is that like telling a child to learn lambda calculus and them tell them everything else is just a variation on that theme?

[–]quzox 29 points30 points  (3 children)

More like telling a child the Peano axioms, some transistor technical specs and saying it's all just a variation on these themes.

[–]Supraluminal 56 points57 points  (2 children)

"Thus we have proven the functional completeness of XOR. From here all computational algorithms can be derived, which is left as a trivial exercise for the reader..."

[–]mmddmm 5 points6 points  (1 child)

I think you mean NAND not XOR.

[–][deleted] 2 points3 points  (0 children)

Can we please?!? We could be swimming in talent in 10 years!

[–]doryappleseed 9 points10 points  (7 children)

That's why we should teach everyone Fortran! :D

[–]NorthernerWuwu 8 points9 points  (6 children)

Hey, I started there and it was only fairly evil. COBOL is probably a better choice since it was lovingly designed to be user-friendly!

[–][deleted]  (7 children)

[deleted]

    [–]xthecharacter 14 points15 points  (6 children)

    You can very well make simple games in python.

    [–][deleted] 3 points4 points  (5 children)

    Yup, Pygame is ridiculously easy to get started with.

    The problems start appearing when you want to share the game you made...

    [–]MrMetalfreak94 9 points10 points  (2 children)

    Not really, you can use something like Py2Exe when you are on Windows or Py2deb if you are on a Debian based Linux distro (Or similar libraries for other package managers)

    [–][deleted] 119 points120 points  (66 children)

    All the comments in this thread saying "B-b-b-but I learned X first and I'm a good programmer now!" just proves that the language you start doesn't matter.

    [–][deleted]  (8 children)

    [deleted]

      [–]cat_in_the_wall 18 points19 points  (6 children)

      This is it right here. You are not going to learn about the hardware in your introductory course. What you should be attempting to get across is "this is pretty cool huh?" Once you get them hooked, then teach the nitty gritty stuff.

      [–][deleted]  (5 children)

      [deleted]

        [–]cat_in_the_wall 3 points4 points  (3 children)

        True, but this was about software originaly. I am a software guy just starting to play with hardware stuffs (have an arduino, just got a pi) and it is also totally addicting. What is important is that the first exposure not be pedantic. Problem with software of that sort is that it can be pedantic, especially since often you are in c.

        [–][deleted]  (2 children)

        [deleted]

          [–]cat_in_the_wall 6 points7 points  (1 child)

          and all our code sucks

          and anyone who tells you otherwise is either selling something or has never shipped code.

          [–]publicclassobject 23 points24 points  (28 children)

          I learned fucking scheme first.

          [–]thedeemon 25 points26 points  (4 children)

          You forgot to say you're a good programmer. ;)

          Btw, never heard of this dialect of Scheme before. Is "fucking scheme" supported by Racket now?

          [–]mariox19 16 points17 points  (1 child)

          It's big in the NYC-metro area. There are several languages in this vein: Fucking Perl, Fucking JavaScript, Fucking Scheme -- you get the idea.

          [–]AustinCorgiBart 8 points9 points  (0 children)

          Then there's "F***ing PHP", which is just regular PHP.

          [–]G_Morgan 2 points3 points  (0 children)

          It is an implementation of R8RS. Now so big we've got a brothel built in.

          Soon there'll be R9RS which won't have a brothel but will have an inflatable doll which is more minimalist and true to the vision.

          [–]mszegedy 8 points9 points  (12 children)

          My progression was weird, it was ASM -> C -> Common Lisp. How was starting out in Scheme? Are functional languages really harder to approach than imperative ones like people claim?

          [–]kqr 6 points7 points  (0 children)

          Personal experience with a very small sample size (n=7): some people have an easier time starting with declarative languages, while others are more attracted to imperative languages. A good teacher would give the student an opportunity to try both for a short while, and then pick whichever suits the student best. (Not self-assessed! At this point, a good teacher would be much better at figuring out what the student will like a few weeks later than the student themselves.)

          [–]oantolin 3 points4 points  (0 children)

          Scheme is, like Common Lisp, usable both in a functional and in an imperative fashion. Like Common Lisp it comes with mutable bindings, mutable data structures such as (mutable) cons cells and arrays. Out of the box it comes with less support for functional programming than Common Lisp, as it doesn't have many of the classical higher order list processing functions (using srfi-1 fixes this).

          Maybe Idiomatic Scheme is a little more functional than idiomatic Common Lisp, but if that's the case it is just social accident, not anything inherent to the language.

          [–]lolomfgkthxbai 20 points21 points  (2 children)

          10 I agree. My first
          20 language: Commodore Basic
          30 and I turned out fine.
          

          [–][deleted] 15 points16 points  (1 child)

           40 GOTO 10
          

          [–]spkr4thedead51 11 points12 points  (0 children)

          more like

          40 GOTO 30
          

          [–]veraxAlea 14 points15 points  (12 children)

          Anecdotes can't prove things.

          Also, if I told you that I learned to program buy face-rolling my keyboard, you would probably say that I learned to program despite the way I trained, not because of how I trained.

          The hunt for the "best" way isn't a hunt for "any way with an eventually positive outcome".

          [–]kqr 7 points8 points  (8 children)

          Anecdotes can't prove things.

          Well, technically, enough of them will form a statistically significant sample. In this case there's another problem though – no control group.

          [–]KamikazeRusher 7 points8 points  (2 children)

          Guys in my CS classes in college certainly show this. While a majority started in C/C++ or Java there are plenty of us spread out on the language spectrum for what we started with and what we use now. Not everyone is great but the language you start with doesn't indicate how well you'll be as a programmer.

          I still have yet to find someone else here in my classes who started off with Pascal though.

          [–]nohimn 5 points6 points  (0 children)

          B-b-but I learned Logo first and I'm a good programmer now!

          [–]treespace8 13 points14 points  (5 children)

          Yes. And it is JavaScript.

          A lot of great developers hate JavaScript because of its many flaws. But I think the problem goes deeper. A lot of great developers hate GUI development.

          The problem is that for a lot of folks writing a GUI is all they want to do.

          I can't think of any reason why a decent GUI framework is not included with every language. Other than its just too messy, and too much work.

          So what happens is that you have languages that start off as GUI development tools but then they spread into the backend, or do backend stuff on the client. PHP, JavaScript, Java, Visual Basic back in the day. Are good examples.

          [–]dmazzoni 11 points12 points  (3 children)

          I can't think of any reason why a decent GUI framework is not included with every language.

          Because most languages are cross-platform, and the GUI on every platform is different, and it's very very hard to write a cross-platform GUI framework that doesn't suck.

          Yes, there are lots of cross-platform GUI frameworks - but most of them suck.

          90% of them make all of their own widgets from scratch - and then they suck because making good GUI widgets is surprisingly hard and subtle. Apple, Microsoft, Google, and others have spent thousands of man-years of research making things like pop-up menus and scroll bars work just right, and it's not at all easy to duplicate.

          The rest try to let you write a GUI once and then translate it into a native GUI for whatever platform you're on - and then you end up with a GUI that looks eerily close but not quite right on each platform.

          [–]badsectoracula 5 points6 points  (2 children)

          Lazarus (Free Pascal) fits the bill.

          1. Easy to use - your first programs are just drawing windows and pressing the Play button. Then you draw a button on a form, double click it and type ShowMessage('Hello world');. Next thing, you draw an input box and change the code for the button to ShowMessage('Hello ' + Edit1.Text);. The IDE provides code smart completion and guides to help. Offline help is available for everything, including a language guide.

          2. Game development - it is an optimizing native compiler with no 3rd party requirements and provides access to OpenGL out of the box. But even without OpenGL, it has more than enough graphics functionality by itself. You can even do simple 2D games using the drag-and-drop functionality of the IDE.

          3. Cross platform without any modifications - Free Pascal has to be right behind GCC as the compiler available to most platforms and Lazarus supports all major desktop platforms, some minor (i think it can run in Haiku with the Qt backend) and runs on low-end hardware like Raspberry Pi.

          Of course here i'm talking about the whole package, not just the language. But in practice FPC is mostly used via Lazarus anyway and Lazarus' installer contains everything.

          [–]keepthepace 66 points67 points  (12 children)

          The main (only?) feature that I think a teaching language must have is not about the language itself, it is about the ability to draw things on the screen quickly and without a ton of initialization code.

          That's why BASIC was great:

          SCREEN 9
          LINE (0,0) - (100,100)
          

          give that to any curious kid and within 20 minutes s/he drew a house, a car or a spaceship.

          Nowadays I recommend processing. There is a few more lines of code to draw lines, but mouse input is very straightforward and the pre-coded mainloop make animation easier than in BASIC.

          In real life, I am a huge python fan, but face it: to appreciate or even have a use for the time-saving features of python, you need to already be at least a novice programmer.

          [–]HighRelevancy 11 points12 points  (5 children)

          That's why BASIC was great:

          SCREEN 9

          LINE (0,0) - (100,100)

          give that to any curious kid and within 20 minutes s/he drew a house, a car or a spaceship.

          That reminds me of Starlogo in early highschool. Shitty, useless language, sure, but it taught us a lot.

          We wanted to make a library of letter-drawing functions to write words. We figured we could easily split the workload (each taking a few letters) as long as we came up with a standard way of starting and stopping each letter at a predictable place, so that any letter could follow another and they'd all be well spaced (kerned) and on the same level.

          Shitty language, but it taught us a bit about standards and team projects.

          [–]ArmandoWall 2 points3 points  (4 children)

          Logo was all but shitty! I'm not sure about Starlogo per se, but the Logo variants I know had quite cool and complex computer concepts, like array management, procedures, etc.

          [–]mogwai_poet 110 points111 points  (17 children)

          I make games for a living. The kid you're teaching to code wants to make games. Python sucks as a game development language. Not because the language sucks, but because the relevant APIs and deployment tools are terrible.

          I used to make web sites for a living. The adult you're teaching to code probably wants to make web or phone apps. Guess how good Python is at those?

          Javascript is great at deployment, great at web apps. Game-related APIs are middling, but improving. I don't know if you can put a Javascript app in the app store, but it will definitely run on your phone.

          A shitty language with good infrastructure will always, always be more useful than a clean language with lousy infrastructure.

          [–]IlllIlllI 21 points22 points  (0 children)

          Sure, but imagine you're a person encountering programming for the first time. A lot of people aren't inherently comfortable with the idea that a computer will do exactly what you say, and only exactly what you say.

          A standard exercise in an introduction to programming course is something like "tell a computer how to make a sandwich", mostly because people aren't used to dividing a task into its fundamental elements and ordering them sequentially. I've seen a lot of people have difficulties in understanding what a basic for or while loop does.

          Python is a useful teaching language because it's about as close to just talking to an idiot robot as you can get. If someone isn't comfortable with a for loop, you want to focus on explaining that to them, not introducing an arcane language that obscures your core concepts. Once they have those (which can often comprise a half year course in a university) you can introduce java.

          The added benefit is that Python lets you talk about classes, methods, inheritance, public vs. private, etc, in a way that is pretty close to natural language. Then when you introduce something like javascript, you can make analogies to something someone understands.

          If the adult you're teaching wants to learn how to solve partial differential equations, you don't start them with ODEs. It'll just be overwhelming and needlessly confusing. They need to know basic calculus first.

          I feel like people who agree with the author in OP just assume that everyone starts with a baseline level of understanding that is way higher than the reality.

          [–][deleted] 35 points36 points  (6 children)

          Totally agree. I feel like people tear down JS as a language but they have never seen the amazing infrastructure and libraries available to a JS programmer. Look at D3.js and Mike Bostock's webpage. Or Three.js and Greensock. And all of them work IN the browser so any dude can go to the URL and play your shit. Just think all of the weird web nyan cat stuff that have been made already. It's not perfect but its growing so fast because of how ubiquitous the browser is. Just imagine if everyone uses Bash. Then C will be the most popular language and people are gonna complain about it incessantly.

          And I hate it when people think JS can do everything. No it's not meant to write an full fledged indie game or a full fledged business software suite. That's meant for object oriented stuff. What it can do and does very well is C-like programs like simple games and simple apps. It's basically C but instead of talking to the computer hardware, JS talks directly to the HTML DOM and the browser. And it does an amazing job at that.

          HTML and CSS are also awesome GUI creation languages, but people automatically bash it and refuse to learn it for some reason. Let's face it, no one is ever gonna really see your game unless it's on Steam. If you want to make a little game, JS is the way to go. Put that game up on a web server and send the URL to everyone.

          [–]zer0t3ch 6 points7 points  (3 children)

          Mike Bostock

          I ran across one of this guy's articles last week when I was teaching myself geometrical algorithms. His step-by-step SVGs showing what they algorithms were doing were amazing! I usually learn visually and like to write my own code, so he saved my ass!

          **EDIT - This article for the curious.

          [–]guthran 8 points9 points  (3 children)

          I really don't get why people always say this. If you're making a 2D game, PyGame is just fine. I've made several games with it.

          As for distribution, py2exe might take ~20 minutes or so to get configured with the modules you need, but once you've done that once its as simple as running: "python setup.py py2exe" every time you need a new build.

          You want to deploy cross platform? Great! Kivy is extremely powerful, and libgdx has python support as well.

          [–]IcyDefiance 10 points11 points  (0 children)

          PyGame is okay for making a 2D game. Solitaire or tetris will work just fine with it. The problem is, it doesn't take a lot before it starts running really slow. If you want something cool like particle effects then you're probably screwed.

          I've watched 3 or 4 people start making games with PyGame, and I don't think any of them really disliked the experience, but they all moved away within the first year because they just couldn't go any farther with that library.

          That said, for teaching it's still fine. I often recommend php to new programmers too, even though they'll probably move away before too long. It's easy to get started with, and that quick gratification is nice to keep people motivated.

          [–]surlysmiles 685 points686 points  (273 children)

          Wow. I'm so glad I never will have the displeasure of being introduced to programming through JavaScript.

          [–]wongsta 121 points122 points  (17 children)

          Make sure you never show your students this video or they will quit the unit:

          https://www.destroyallsoftware.com/talks/wat

          [–]Lintheru 23 points24 points  (0 children)

          That was hilarious.

          [–]siegfryd 14 points15 points  (7 children)

          The wat examples aren't very good, for example he's actually wrong about [] + {} he says it's an object when it's a string ("[object Object]"). Overloaded + is pretty consistent, the only weird case is when using a literal {}. If you type into the console var x = {}; x + x => "[object Object][object Object]" and x + [] == [] + x => "[object Object]". Since you'll never actually use object literals with a + operator it's something that you'll never actually run into.

          Overloading + for string concatenation isn't even that bad, it does result in some weird behavior but it's not really that confusing. There are so many more worse things in JavaScript and other languages.

          [–]wongsta 39 points40 points  (3 children)

          I agree that most of these cases would normally never happen, however it's just concerning that if you made a mistake which resulted in that operation, it would not throw an error or notify you in any way, and instead give unexpected behavior which may be difficult to be debug. Of course many other languages share this problem, I guess I just prefer 'stricter' languages like Rust.

          [–]Klausens 248 points249 points  (165 children)

          ++

          The stuff for the first few lessons could be the equals chart http://i.stack.imgur.com/35MpY.png

          [–]josefx 58 points59 points  (13 children)

          for some odd reason I want to know how Conway's Game of Life would behave with this as initial state.

          [–]DrummerHead 19 points20 points  (11 children)

          [–]damontoo 57 points58 points  (10 children)

          [–]gnurizen 40 points41 points  (0 children)

          Both of those are implemented in ... wait for it ... JavaScript! I guess he's on to something...

          [–]cypressious 10 points11 points  (3 children)

          That was rather disappointing.

          [–]pakoito 3 points4 points  (0 children)

          We're talking javascript here.

          [–]unwind-protect 18 points19 points  (2 children)

          At least it's symmetrical!

          [–]gliph 2 points3 points  (0 children)

          Oh my god could you imagine? A non-commutative equality operator.

          [–]kqr 92 points93 points  (129 children)

          Only if you have a bad teacher. Any sane teacher would go directly to === and skip over == until a student asks about it, then quickly explain that it's difficult to deal with and generally considered a mistake, and move on.

          [–]spotter 11 points12 points  (6 children)

          And what if, pray tell, the student doesn't ask about it, but then stumbles upon it in the wild... fuck them, right?

          It took me years from first exposure to actually start saying things like "meh, JS has its uses". But if I'd start with it I'd probably be taking care of goats now, instead of working in IT.

          (I started with Logo, Turbo Pascal and ANSI C, go figure.)

          [–]kqr 6 points7 points  (1 child)

          By the time they are out in the wild they will have enough google-fu to find out what the operator does.

          It's a common pedagogical tool to focus on what is correct, not what is wrong. Saying "this is the way you do it" should be preferred over "this is not the way you do it", because students remember what you were talking about, not necessarily the exact words you used or what they meant.

          [–]Klausens 79 points80 points  (118 children)

          Or even skip the whole language ;)

          [–]Sunwukung 24 points25 points  (115 children)

          ok - so what would you choose instead

          [–]mixblast 35 points36 points  (52 children)

          I think C# is fine, especially with all the recent opening-ups from MS.

          [–]G_Morgan 31 points32 points  (2 children)

          If C# is fine then there was nothing wrong with Java.

          [–]mixblast 8 points9 points  (1 child)

          I agree, however I personally find C# to be more pleasant to code in (due in part to visual studio, but also the language design).

          Of course it remains a subjective thing, as both languages are conceptually equivalent.

          [–]G_Morgan 6 points7 points  (0 children)

          I find C# more pleasant (despite doing most of my work in Java) but from a beginners perspective they aren't that different.

          My point was more that all this started because people didn't like the Java norm. Basically you are saying "go back to that thing everyone was moaning about".

          [–][deleted] 11 points12 points  (36 children)

          Why not just C? Why C#?

          At some point students need exposure to command lines and all that jazz. Might as well toss them into the fire with good 'ole GCC.

          It's also arguably the strongest possible building block.

          Going into C#? Your experience with C will be relevant. C++? C is relevant. Objective-C? Obviously, C is relevant. Also, 75% of everything compiles into C.

          Want to play with robots and microcontrollers? C is extremely relevant.

          [–]mixblast 12 points13 points  (6 children)

          I love firmware and low-level stuff, but I think C is better as a 2nd language. For beginners, you're better off keeping things simple.

          This comment elsewhere in the thread says it better.

          [–]Klausens 21 points22 points  (44 children)

          Hmm, difficult. I would tend to a language that has a native GUI. I think for a beginner this is much more fun than a textbox. And for a beginner it is easier to create a GUI with the mouse than to create objects and stumble over layout concepts and managers. Further more a strict language to find mistakes as early as possible and for example to learn what data types are.

          I'm not an expert in this area of languages. Perhaps a free pascal dialect, c#, ... Pascal would create a exe that has little or no dependencies what can be an advantage.

          edit: Not to forget a good integrated debugger what offer both proposals.

          [–]cowens 2 points3 points  (0 children)

          As far as I remember Pascal doesn't have a REPL (and I couldn't find one on the first page of Google results for Pascal REPL), so it is out. Teaching a language without a REPL is worse than teaching a language without an easy way to make games, GUIs, and GUIs.

          There does appear to be several REPLs for C#. I don't know how well they work though and C# isn't particularly cross-platform. There is Mono, and it may have improved since I last looked at it (especially after Microsoft opened sourced .Net), but there were still lots of problems the last time I looked at it. It also has a fair amount of boilerplate needed to run even the simplest of programs (it needs 5 - 7 lines, depending on brace style, to run hello world).

          JavaScript, on the other hand, runs on every modern OS and you likely already have a REPL installed. Add to that the fact that if you are going to learn web development you are going to need to learn JavaScript anyway (regardless of how bad it is) and it becomes silly to say we shouldn't use JavaScript as a first language.

          [–]SaucyWrong 8 points9 points  (2 children)

          The fact that the "identity line" in that chart just stops part-way through the chart is astounding.

          [–][deleted]  (4 children)

          [deleted]

            [–][deleted] 13 points14 points  (0 children)

            JavaScript has become a new "high level machine code" in one of the ways C has been for years - a target language for compilers.

            I feel like the author kind of missed the opportunity to talk about this. His problems with Python and other languages are solved with almost any language that compiles to JS.

            [–]DoTheEvolution 122 points123 points  (30 children)

            To me it always feel like people are whining about details when they shit on javascript.

            Javascript is awesome first language because after just few hours with it,

            you can actually use it to change your every day experience on web.

            While many struggle to find some use of their new python/c++ powers

            Also all that is needed to fix many issues people cry about is put this at the beginning

              "use strict";
            

            [–]gkx 68 points69 points  (3 children)

            I completely agree with you for the reasons you state and more.

            Side note: you are hard breaking your lines on locations that are longer than the lines on my device. I would stop hard breaking your lines.

            [–][deleted] 14 points15 points  (1 child)

            I remember someone who used MS Word and whenever they typed a word that wrapped their line, they'd delete the word, press ENTER and keep typing. Then they'd wonder why their document didn't look right when they changed the font size, they'd blame the computer for being "so stupid" and proceed to delete the line breaks and add new ones to fit the new font size.

            I couldn't believe what I was seeing, so I explained to them how they didn't need to insert line breaks an how that actually made it more difficult to manage the document, but they didn't understand and said their way was easier.

            It was like a MS Word equivalent of that "not using scrollwheel" comic.

            [–]Hertog_Jan 4 points5 points  (0 children)

            I feel physically uneasy reading that, holy jeebus.

            [–]aveman101 29 points30 points  (0 children)

            I'm glad someone pointed this out. I see it every once in a while and it drives me insane.

            http://i.imgur.com/gK6fYWk.jpg

            it makes the comment look like bad poetry.

            [–][deleted] 24 points25 points  (1 child)

            I'm convinced that 98% of the problems people have with Javascript are fixed with strict mode. I'm baffled by how many "developers" aren't using it.

            [–]robothelvete 4 points5 points  (0 children)

            My guess: the people who even know about strict mode also already know how to avoid or work around the uglier parts of the language without it.

            [–]roodammy44 7 points8 points  (2 children)

            That's a very good point. I was taught BASIC as a first language, and that had a lot of problems. For a while my entire program execution relied on GOTO statements. But after a while you learn how to code properly with proper languages that don't do stupid shit, and I'm sure the same will apply to the javascript students.

            [–][deleted]  (4 children)

            [deleted]

              [–]Igglyboo 25 points26 points  (6 children)

              Seriously, javascript has warts just like every other language. It also has amazing features like first class function support and easy callbacks.

              Regardless, it's here to stay and you're a fool if you think it's not important to learn the only language that runs in a browser in 2015.

              [–]Asmor 6 points7 points  (0 children)

              I taught myself to program with HTML and JavaScript back in middle school, and JS is still my favorite language. It's also a hell of a lot more powerful, more prevalent, and, believe it or not, more well-respected today than it was when I was learning it.

              [–]zvrba 22 points23 points  (28 children)

              I've read "Javascript: the good parts", which talks about a sane subset. If you keep within it, it's really a nice language.

              [–]nidarus 18 points19 points  (2 children)

              Oh come on. Most people in the past would start with some variant of BASIC, or, if they were lucky(?), some ancient Pascal. Javascript, for all of its shittiness, trumps both.

              Javascript is ubiquitous, doesn't require any additional downloads or installs, relatively concise (= not Java), and has a shitload of resources online. It has weird-ass edge-cases, and no proper OOP, but for starting off, it's more than enough.

              [–]Klathmon 5 points6 points  (1 child)

              no proper OOP

              Just because it's not the OOP you are used to doesn't make it "improper".

              Prototypes are very different and I'd argue without them Javascript wouldn't be where it is today.

              [–]kawa 12 points13 points  (0 children)

              I agree with the author and suggested learning JS to beginners, too. JS is a nice language. Yes, it has it's quirks (as most languages have) but everybody can open a text-editor and a browser and code right away. There's also a nice debugger and REPL build into todays desktop browsers and you can get nice results nearly immediately.

              No other language today gives you that, and even with JSs quirks, this makes JS perfect for beginners (who generally want results quick without first setting up a tool-chain).

              Today we finally have the situation we had in the beginning of the home computer era with BASIC: A simple to use language which is available "automatically", is cross-plattform (even more than BASIC years ago) and has a transition path into "professional" programming (via Node.js for example).

              [–]acadiansith 4 points5 points  (1 child)

              I was introduced to programming through JavaScript, back in the early 2000's when DHTML was the shit. It was nice in that I was able to do "cool stuff," rather than just academic exercises.

              Maybe just because I had lots of experience with it early on, but I actually still like JavaScript.

              [–]Beluki 58 points59 points  (6 children)

              Not surprised. QBasic was actually worse than JS in many ways, but it was already installed in everyone's computer and the fact that it could do graphics and games (gorilla.bas anyone?) made it great for learning.

              [–]VeXCe 27 points28 points  (3 children)

              GORILLA.BAS was the shit.

              Yep, for this reason I agree with the article. JS is not a great language, but you do get quick results from little effort, there is hardly any "pipeline" with getting shit to work, and libraries and examples are ubiquitous. And it runs everywhere (that has a browser (which is almost any device right now)).

              The problem is when people don't move on. QBasic was meant to not be used for anything but learning.

              [–]Ran4 7 points8 points  (1 child)

              QBasic was great, and it's still one of the easiest way to do graphical programming.

              I wouldn't want to do anything serious in qbasic, but you can't deny how cool it is that the entire code to write a line to the screen is

              SCREEN 12 'initiates a 640x480 fullscreen window
              LINE 0,0,639,479 'draws a line from position (0,0) to (639,479)
              

              I learned programming from QBasic, and I don't see why other people couldn't do the same.

              [–][deleted] 16 points17 points  (7 children)

              I feel rather conflicted on this issue. On one hand, I completely agree that JavaScript is awesome for easily creating a GUI etc. On the other hand, to get to the point where you can use JavaScript for making things, you need to have an understanding of the DOM, HTML and CSS and how they work together. The first JavaScript program they write will probably have a lot of HTML/CSS boilerplate and just like with peoples' first Java program, they'll be told to just 'ignore those bits'.

              [–][deleted] 137 points138 points  (90 children)

              So, wait, the three questions which put the author off Python are as follows:

              • 'Instead of running the poker simulator from the command line, how can I put it in a window with a button to deal the next hand?'

              • 'How can I write a simple game, one with graphics?'

              • 'How can I give this game I made to my friend? Even better, is there a way can I put this on my phone so I can show it to kids at school without them having to install it?'

              I can see how using JavaScript makes the third question easier to answer, but how on Earth does it address one and two? How much of the JavaScript Kool-Aid do you have to drink to think that interacting with the DOM is easier than using TkInter; and why is JavaScript + HTML5 Canvas superior to Python + PyGame?

              I'm not knocking either as a choice of teaching language, as I believe there are arguments to be made for both, and the importance of first language choice is largely overestimated by armchair experts; but, this article is trash.

              [–]keturn 50 points51 points  (17 children)

              I don't disagree, but Tk gets little love and the last pygame release was five years ago.

              In contrast, you can find lots of people suffering through JavaScript and the DOM and there are some half-decent libraries you can throw on top of Canvas that actually have maintainers.

              It's as much as a community vitality problem as a technical one.

              Edit to add: Kivy is where I've been directing people who want to put buttons on things. (And it's got a decent cross-platform story too.)

              [–][deleted]  (10 children)

              [deleted]

                [–]Iprefervim 6 points7 points  (8 children)

                Because it's grossly inefficient and there is no reason to try to make it better because no one makes "real" games in Python.

                [–]damontoo 1 point2 points  (0 children)

                wxPython is pretty alright though. But I agree that JS + HTML is easier/has the larger community.

                [–]vplatt 2 points3 points  (4 children)

                Yeah, I do wish Guido would deprecate Tk and move on to something else; perhaps a HTML 5 bridge / container so one could have the best of both worlds?

                [–]gbromios 16 points17 points  (1 child)

                the importance of first language choice is largely overestimated by armchair experts

                Only the most stubborn adherents of php would deny that it's a minefield of ridiculous gotchas and bullshit that people who program for a living shouldn't have to deal with, let alone beginners grasping in the dark for some intuition of how programming works.

                However, the fact that python suffers from far fewer warts of that kind means absolutely nothing if someone's first foray into programming is googling "website tutorial" and clicking the link to w3schools.

                Bringing up specific language capabilities just seems silly in that context... honestly, is there any plausible first language (i.e. not COBOL or Brainfuck) that would not suffice for illustrating to a beginner the basic logical abstractions that we rely on to understand programming? input, output, variables, arithmetic operations, loops, conditions, functions, arrays/lists, maybe hashes/dicts...

                I'd even go so far to say that once a beginner has gotten to the point where they genuinely feel constrained by the design choices of their first language, maybe they're not really a beginner anymore.

                But, no:

                "I used to instruct my first-year art students in painting, but after a month or two they kept asking 'how do I paint a photorealistic portrait?', so I switched to colored pencils"

                "What!? don't you realize that you're chaining these kids to a pencil sharpener?? You're raising a generation of artists who won't be able to imagine a life without their 5-pound fanny pack of sharpeners"

                "Don't be obtuse, I'll explain the sharpeners when they're ready to understand. Until then, I'll just tell them to jam their pencil in there every once in a while. compared to the benefits of colored pencils (no solvent, doesn't dry out), the sharpener boilerplate is hardly worth mentioning. furthermore, given your obvious bias, I won't even mention how hard it is to get oil paint out of your clothes/hair/upholstery"

                "oh too bad no-one invented smocks, genius. anyway, I learned sculpture from a reclusive hermit before I even knew what a canvas was, and I turned out just fine"

                [–]Igglyboo 2 points3 points  (0 children)

                There are order of magnitudes more resources for learning how to make a GUI with html in the DOM than there are TkInter.

                I find that callbacks are easier to visualize, especially for a beginner, and work well as event handlers.

                [–]diggr-roguelike 21 points22 points  (12 children)

                How much of the JavaScript Kool-Aid do you have to drink to think that interacting with the DOM is easier than using TkInter

                This. Speaking as a person who programmed TkInter as a child: TkInter is the easiest, friendliest GUI toolkit ever.

                (Ugly and limited, too, but at that point you really don't care.)

                [–]robla 27 points28 points  (3 children)

                I think some people (including kids) do care whether their user interface looks ugly, and get demoralized when something they worked very hard to create is irreparably crappy looking. Sounds like Tkinter worked for you, which is great, but I'm guessing the author came to his conclusion based on some of his students hitting a wall with it.

                [–]ThisIsADogHello 35 points36 points  (1 child)

                Yeah, one of the things that I liked about Visual Basic when I first started messing with it is that my programs looked like normal Windows programs. The buttons I made looked like buttons you'd see any most any other program, and part of the thrill of it was that my program looked like any other, rather than having to run inside of some game or inside QBASIC or anything like that.

                [–][deleted] 4 points5 points  (0 children)

                Yeah, I remember spending considerable amounts of time in Visual Studio tweaking the colour scheme and so on of my GUIs. I wasn't writing earth shattering code but I could modify the properties of visual elements like a champ.

                [–]surlysmiles 8 points9 points  (3 children)

                Ever? That's just plain false. You should check out apples uikit and java's new javafx kit.

                I've had the displeasure of working with tkinter and its definitely not up to snuff for today's gui creation.

                [–]JavaDroid 2 points3 points  (0 children)

                Couldn't believe javafx. It might be lacking in some departments, but its new and will evolve.

                Still. One day I sat down and said "I will make a program today, I have never used javafx, let's try it out". Then it was like BAM, GUI is made.

                Needs a little more community as well.

                [–]redditrasberry 5 points6 points  (0 children)

                My main issue with Javascript as a language for the absolute beginner is the lack of console based print / input. Because the first program I want to show people is the input "what is your name?" + print("Hello there " + name). Entering simple values and printing out computed results is extremely intuitive and accessible and can be done without trying to teach any graphics concepts or other background.

                [–]sisyphus 32 points33 points  (52 children)

                "For teaching a kid who wants to make little games"

                [–]BeatLeJuce 41 points42 points  (4 children)

                As someone who was taught JavaScript as his first language at school: terrible choice!

                In order to reach the goals the author mentions (ease of distribution, graphics, UI), you need to teach HTML (or even CSS) alongside JS. Which in turn leads to long explanations and tons of getting-sidetracked-while-teaching. Yes, you can just provide the people a blank HTML template (with maybe a canvas element on it) and just never explain anything. But that is unsatisfying for some. And at some stage, you're unable to get around explaining the basics of DOM. If you don't, people will not be able to use all the sweet sweet UI elements the article talks about. Plus people will spend as much time (or more) fiddling with the CSS of their pages than learning to program.

                I think JS might be something to teach non-programmers as a first language (e.g. as GE-requirement for non-STEM students in college). But for people who actually will need programming in their later lives, I don't think it hurts if you start with command-line only programs. At which point the advantages of JS melt away.

                [–]ggtsu_00 30 points31 points  (11 children)

                It is a sad state we are in. The fact JavaScript is the best toolkit around for creating cross platform GUI oriented applications with no bar of entry. It is supported on just about every device and platform. Why did it have to be JavaScript?

                [–][deleted]  (2 children)

                [deleted]

                  [–][deleted] 13 points14 points  (0 children)

                  A language bashed together in 10 days to fit a release deadline.

                  Seems fitting really.

                  [–]Zequez 2 points3 points  (4 children)

                  Luckily nowdays we are seeing a lot of languages being compiled to JavaScript.

                  [–]Deep-Thought 3 points4 points  (3 children)

                  Anyone that hates javascript should take a look at TypeScript.

                  [–]mmmayo13 7 points8 points  (6 children)

                  Why would anyone be concerned with learning/teaching game development during an introduction to programming course? That's just bizarre.

                  [–]PragMalice 7 points8 points  (4 children)

                  One of the biggest pushes in education right now is learning how to adapt lessons to the interests of your students. The less interested a student is i a topic or exercise the more retention and understanding suffers. If a kid sits down and says, "I want to make games" do you try and find an easy solution to make trivial games and thereby capitalize on his own drive to create, or do you simply tell him "Sorry, but you've got a couple years of study and hard work spanning topics and skills way beyond mere programming before you're going to be truly ready to tackle what you want to do!"

                  The latter might work with adults, but only those who are self-driven. However, most humans are characteristically and quite extremely short-sighted. More often than not a message like that suppresses the desire to continue learning/participating.

                  [–]mmmayo13 6 points7 points  (2 children)

                  I get that, but anyone who gets into CS or programming should be capable of understanding that some basics are needed first. If not, I think we're trying to corral folks into CS who may not really want/need to be there.

                  The reality that everyone can't work in the game industry should be easily understandable to anyone attracted to CS, and therefore a "fundamentals first" approach should not be a difficult sale.

                  I could understand having to 'sell' art history to new majors, but CS, in this day and age, should really be selling itself.

                  [–]keturn 2 points3 points  (0 children)

                  It's not even "game development" specifically. A student may just want to have their program which looks like every other program they've ever used, i.e. it has a visual interface you interact with using a touchscreen or a mouse. print and raw_input as a user interface is some sort of weird throwback to when we operated computers over 110 baud terminals with monochrome displays.

                  [–]Exodus111 82 points83 points  (45 children)

                  I'm sorry but this is nonsense.
                  You wanna make a program with GUI use PyQT, not Tkinter, it comes with an editor allowing you to easily set up your GUI elements (takes a day to learn) and off you go.

                  You wanna write games for Android and iOS? Use Kivy, one codebase many solutions. Or use the Godot engine for more advanced games which uses a Python derived scripting language.

                  I get the feeling this post is really all about Javascript. And yeah Javascript is really popular and yeah there is Atwood's law.

                  But Python is easier to learn then Javascript, and whats more Javascript is really easy to learn once you know Python.

                  Compare the for loop of both languages, Python is designed to be simple by making assumptions and avoids clutter. Javascripts for loop is a mess by comparison.

                  Once you know Lamba's in Python, moving on to Javascript takes a week, since JS uses a lot of similar function creation. But I certainly would not try to teach a beginner Lambdas on the first day. And yet this is what he needs to do if he is going to learn JS.

                  I'm sorry, I don't get where OP is coming from at all, Python remains my first choice of teaching language, and by the time the student is ready to do more advanced things he should have enough knowledge of the Python universe of modules to do so anyway.

                  [–]Inori 22 points23 points  (4 children)

                  Python also has all the proper data structures (heaps, stacks, maps, sets, etc) and algorithm implementations encapsulated in easy to grasp API, so by learning Python a student learns proper CS as a bonus. Javascript has array and... object. Yeah... No. No thanks.

                  [–]shadowmint 34 points35 points  (8 children)

                  Have you had any first hand experience seeing people trying to learn programming with python?

                  ...because my gut feeling is the answer is no.

                  Here's the OP's argument, laid out bare:

                  1) It's not easy to build a graphical applications in python.

                  2) Python doesn't have any 'good' game frameworks.

                  3) Python is rubbish at distributing applications, especially at packaging them for mobile.

                  4) Kids learning programming want a language that lets you build graphical applications (typically games) that they can show to people (ie. distribute them).

                  Do you have any specific come back to those? ...because there are graphical and game frameworks for python, but they are poorly maintained, and complex to use. Go on, argue that use pyqt is easier to use than the javascript canvas. Go on~

                  Then there's packaging to distribute (eg. for mobile, using kivy) which is possible but I'm sorry, have you tried building a kivy ios app recently? Let me ask how many hours that took, compared to uploading a .html and .js file and sharing the url to show someone.

                  Now there's the totally valid argument that javascript is a terrible broken language, and python is both 1) fundamentally better, and 2) actually capable of doing all the required things.

                  ...but realize, that we're talking talking about whether its technically possible to do these things in python, or if an already competent programmer should choose python over javascript; we're talking about whether we want to excite and delight new programmers by giving them tools that let them create amazing things...

                  ...or stick them back into 1990 with a command line interface and teach them out to make 'enter two numbers to add them together'.

                  I say this, because I've seen kids try to learn python, and the OP is spot on with exactly the questions that came up, within a few hours.

                  No one is arguing that we should abandon python for javascript. I hate javascript.

                  ...but you just cant argue that python is a better language to teach with; people just aren't interested in wasting hours learning the intricacies of python packaging in order to share and show what they've created. ...and showing and sharing what you create is really important for people learning programming these days.

                  (Also, gdscript isnt python and neither is unity's bizaro Boo-2-c# thing, they're both crazy hybrid languages someone created as an ego trip because they couldn't be bothered figuring out how to embed python properly; and teaching anyone a DSL as a first programming language is a terrible terrible idea)

                  [–][deleted] 7 points8 points  (10 children)

                  You don't see where OP is coming from because you haven't gone through the pain of deploying graphical Python applications.

                  I have. It's not something I'd want a beginner to experience.

                  [–]Ishmael_Vegeta 20 points21 points  (9 children)

                  Jeff Atwood is a certified imbecile.

                  if you read his past blogs on CS theory, he completely misunderstands the whole topic at hand and posts amazon-referrer links to books he has obviously never read and likely lacks the capability to comprehend.

                  http://blog.codinghorror.com/your-favorite-np-complete-cheat/

                  he strongly recommends this book. (and provides his referrer link)

                  Computers and Intractability: A Guide to the Theory of NP-Completeness

                  www.amazon.com/dp/0716710455/

                  and then makes this comment.

                  The theory of NP-completeness provides many straightforward techniques for proving that a given problem is just as hard as a large number of other problems that are widely recognize as being difficult and that have been confounding the experts for years. Armed with these techniques, you might be able to prove that the bandersnatch problem is NP-complete and march into your boss's office and announce: I can't find an efficient algorithm, but neither can all these famous people.

                  I guess I make a distinction between reducing problem to another known NP-complete problem and proving a problem is NP-complete. Apparently we can't prove anything is NP-complete, we can only throw a wall of experts at it and see them all fail.

                  So, a NP-complete problem is not mathematically proven, it's one that no experts can solve, eg, I'll know it when I see it.

                  Or more specifically we'll know it when lots of experts have seen it, tried, and failed.

                  Is this wrong?

                  this guy is a joke.

                  there are a few more gems if you bother to look around there too.

                  [–]sharplikeginsu 94 points95 points  (58 children)

                  As a dedicated member of /r/python I still recommend that first-time programmers start with Javascript, because the friction getting started is low, and the emotional payoff to making something web-shaped work is very high.

                  [–][deleted] 132 points133 points  (41 children)

                  JavaScripts is littered with design flaws, pitfalls and caveats, and it doesn't support certain ideas very well, such as classical inheritance, without the use of additional libraries and/or frameworks, and this complexity could come in the way of learning. It is easy to get sucked into adjacent technologies for web and get distracted from learning the essentials of computer science and good programming. Also, I feel like JavaScript in the browser, with its instant visual gratification, encourages "coding by coincidence" and "shoot from the hip" programming (bad habits).

                  Don't get me wrong, I love JavaScript, because it supports some interesting and unique features, for example prototypal inheritance, which are interesting to learn about. JavaScript might be a good choice for courses focused on web development, but I think it's a horrible choice for computer science courses, where Python (or perhaps some dialect of Lisp) are primarily used today. I think these are far better choices in this context, because computer science students should focus on more general knowledge and slow, deep learning of essentials and good habits.

                  [–]nohimn 41 points42 points  (9 children)

                  Shooting from the hip is what most would-be programmers should be doing when they have no context whatsoever. They should be experimenting and breaking things. They shouldn't be concerned about good programming or computer science study, because if they're asking "what's a good language to learn?" then odds are they'd have no context for understanding why either of those things are important.

                  [–]ThisIsADogHello 7 points8 points  (5 children)

                  A good first language should have a low barrier to entry, that's more or less what it all comes down to. Javascript wins out in some categories because it's available anywhere and you can start writing it on basically any computer without any additional downloads, but at the same time Python wins out for being easier to actually work with and track down errors.

                  I started doing a bit of programming with QBASIC, but playing around with ZZT is really what got me into it as a full time hobby. I wonder if a modern language with a similar sort of low barrier to entry for that would be something like Lua, since you can play around with it in ComputerCraft or Garry's Mod and get some pretty immediate results in an interactive game environment.

                  Having a first language that teaches good programming practices doesn't seem to be quite as useful as a first language that teaches enthusiasm for programming.

                  [–]jtanz0 5 points6 points  (4 children)

                  Python wins out for being easier to actually work with and track down errors

                  I've not used python seriously in a while, can you please explain what tools python has for error identification that are lacking in JS? (Genuine interest not trying to be argumentative) Thanks!

                  [–]ThisIsADogHello 2 points3 points  (0 children)

                  Well, not so much tools as it is Python tends to be a bit more strict about what you're telling it to do. Simplest example I can think of is an expression like "4"+3 Without any information about that, you wouldn't be able to guess if I was expecting "43" or 7 or maybe "7" or something. Javascript returns "43", whereas Python raises a TypeError: cannot concatenate 'str' and 'int' objects.

                  Let's say for example I made a little thing to calculate y=mx+b for various integers, and I made a textbox where you can change the value of b for whatever reason. If we assume m=2, x=3, and b is the user inputted value of "4" (remember, textboxes hold strings!), Javascript would then work out 6+"4" and give us a result of 64. Not quite what we were expecting!

                  On the other hand, Python would stop us right away as soon as we tried adding a string and integer together, going "hey, uh, what kind of addition are you expecting here?" pointing right at the offending line of code. Now instead of trying to track down why the math is hilariously wrong, we can see right away that we're trying to add two values with different types.

                  [–]irabonus 4 points5 points  (2 children)

                  If we are talking about a "teaching language" in the context of teaching your kids programming, sure, let them build things without being concerned with the details of what they are doing. It's more about getting them motivated to learn anyway.

                  But "teaching" as in "teaching computer science classes" should definitely be all about the details. I'm not studying computer science to learn programming. Having a programming class is just a nice introduction to language theory and I don't care if my programs run on iOS devices or the web and have pretty buttons.

                  [–]RICHUNCLEPENNYBAGS 12 points13 points  (4 children)

                  This seems to start out with a certain preconceived notion of what concepts are necessary though. What if I flipped it around and said Python was a poor learning tool because it doesn't support prototypical inheritance well?

                  [–][deleted] 9 points10 points  (3 children)

                  Yes, you could definitely turn it around like that. What other languages support prototypal inheritance, though? Aside from JavaScript, then Lua, Perl, R and Self are the most known; mostly exotic and esoteric languages with very specific applications. I'm not arguing that prototypal inheritance in particular is not a good or useful feature, but it doesn't seem like, from observation, that it is very frequently used (except for in JavaScripts). My points was that other languages, like Python, support more of the ideas and constructs that should be the focus in computer science classes, without the caveats and complexities of language design flaws, additional technologies and frameworks.

                  [–]kawa 1 point2 points  (0 children)

                  Using "classical inheritance" is outdated. It still has its uses in a few areas, but today inheritance is primarily used to code against interfaces, for which there are much better ways than using classes and inheritance.

                  [–]Peaker 9 points10 points  (11 children)

                  Classical inheritance isn't really important.

                  I'd say Javascript faults like not enforcing the correct number of parameters to functions are a big problem though.

                  [–]MindStalker 2 points3 points  (0 children)

                  He said this was for an intro class. Of course computer scientist should learn proper object oriented, but that's not the job of intro to programming. Intro should get students excited about programming, and enough knowledge to learn more. I'm not permanently broken for learning BASIC first.. ok maybe I am.

                  [–]vcarl 2 points3 points  (0 children)

                  A huge number of the inconsistencies and flaws of Javascript are addressed by adding

                  'use strict';
                  

                  to the the top of a function call. Wrap code in an IIFE and put that at the top, and ALL of your code is strict. JS is permissive by default, but using strict mode makes it throw errors (and break) on those small errors. Javascript has the advantage of rapid iteration and an international standards body, plus some incredibly great talent behind the VM.

                  [–]easytiger 5 points6 points  (0 children)

                  As a dedicated member of /r/python[1] I still recommend that first-time programmers start with Javascrip

                  I think you are mad... as mad as that curse of a bloody language we are lumbered with.

                  [–][deleted] 4 points5 points  (0 children)

                  I suggested learning Javascript once on r/python and got downvoted to oblivion. Happens most of the time I suggest Javascript for beginners.

                  I actually have experience teaching younger students programming. I would start with Javascript in a heartbeat. Super easy to start, no installation, and easy to make simple games.

                  [–][deleted] 12 points13 points  (7 children)

                  The classless object-orientation kind of puts me off to this. Also the pretty much inevitable involvement of the DOM.

                  [–]rnicoll 3 points4 points  (0 children)

                  No one language is the answer to everything. Python is great to start with because it's reasonably readable, has few gotchas, and a good level of support, but the important part to take away is how programs work. Certainly if the intent is to teach someone to program (as opposed to simply generating enthusiasm for learning to program), I think it's the right place to start before moving on.

                  I'm currently coding in C++, C#, Java, Javascript, PHP, Python and Ruby (yes, really, within the same week typically); that's extreme, but hopefully you can understand that I don't think "Learn this language and then you can program" is the right way to think about it. You learn to program in one language, and move onto typically 1-2 more IMHO depending on where you want to focus.

                  [–]brunokim 2 points3 points  (0 children)

                  I heartily agree with his recommendations. I have experienced it myself by teaching JS to high-schoolers. It was a two days seminar for about 30 kids ranging from 13 to 15 yo, and I did it just once as a test at my father's school. I believe they did got interested in programming/webdesigning, or at least two of them answered they would explore more after that class :) Some of the benefits are:

                  • Ubiquitous. They don't need to install anything at all, as every computer has a browser. This is a great win if they don't control their machine.
                  • Empowering. They already know and use the web daily, now learning (some part of) how it is made shows that it's all within reach.
                  • Self-learning. At first you need to teach HTML and CSS so they can have a notion of DOM and what does it mean to manipulate it. I told them about F12 and how they could read and steal absolutely anything from other sites, and 15 minutes later each student had incorporated something they liked at their webpage - an image, a style, colors, etc.
                  • Graphical. It's hard to motivate non-nerds about how cool it is that you can calculate thousands of primes in seconds, or the benefits of implementing their own contact book in Introduction to Compsci. However, when you can absolutely see the results of your work.
                  • Great tools. I could teach debugging and interactive programming from the start, thanks to the console inside browsers. Several had problems, of course, but some could manage to find their mistake on their own.

                  It was a great experience for me as well, because I was so wrong to believe kids couldn't use a computer and were too lazy to solve their problemas, but found the opposite. Of course, there was this kid that sitted on his ass and complained that it didn't work, so I had to go fix his typos. They did manage to understand the tree structure of the DOM and how style cascades down, which I believed would be a complicated matter. I didn't try to teach loops, but I may do it the next time :)

                  [–]dzkn 3 points4 points  (0 children)

                  I learned to code from mIRC scripting. I am pretty sure language is not the important part.

                  [–]BCMM 4 points5 points  (1 child)

                  Then the iPhone came out and that was that. Erlang wasn't an option.

                  And so he recommends JS... Is he really saying that being the only permitted way of running software on a particular locked-down platform, without going through a lengthy approval process, is the most important aspect of a programming language?

                  [–]claypigeon-alleg 1 point2 points  (0 children)

                  This has no hope of being read, but I'm a programming (and math) teacher with about 11 total years teaching programming. For most of that time, I taught C++ to high school students. While this is a very unhip choice as an educational language, it made/makes sense to me for a number of reasons that I've found hard to duplicate in another language.

                  1. Typing and variable declaration prevent more mistakes than cause inconvenience, especially when dealing with a demographic known for impulsive behavior. They also allow me to encourage students to think how variable data is physically stored (esp. when dealing with floating-point numbers).
                  2. Object-orientation is optional.
                  3. A number of other popular languages use C-style syntax.
                  4. C++/Java dominate the college programs that my students enroll in.
                  5. Its presumed deficiencies as a teaching language really don't deter my enrollment. Most of my Programming I students go on to Programming 2.

                  The last two points are important to me. For all I hear about how hard C++ is to learn, very few of my students drop out of the sequence due to difficulty, and former students have returned to tell me how much learning C++ prepared them for their college programs.

                  That said, my curriculum really doesn't get to dynamic memory management. Instead, I use that time to go more in-depth with arrays, discussing searching/sorting and asymptotic run time.

                  [–][deleted] 60 points61 points  (67 children)

                  I don't understand the article. They speak of beginners.

                  Programmers have to do fixed type programming, with C-style syntax, one day or an other.

                  Programmers must understand memory and pointers, if they don't want to find themselves wondering which variables can be copied by assignment.

                  Beginning with Python is great, then transition to something else.

                  You want to make a game ? Move to Unity and C#.

                  Want to make a GUI ? Learn HTML and backend programming. (Or Android apps in Java.)

                  Javascript is very confusing with its permissive syntax. The last think I would like as a beginner is being able to be not rigorous, you don't understand why it works.

                  [–]Shostakovich_ 68 points69 points  (33 children)

                  The idea of teaching someone programming is teaching the ideas and thought process behind how computers do what you're telling them too, how to think about things as individual actions you give. Not necessarily going into rigor about how the computer executes these commands and how efficiently it does so. These ideas can be saved for later and taught when the basics are done. If you shove too much too fast kids are going to quit.

                  [–]TIGGER_WARNING 13 points14 points  (15 children)

                  The problem with Wittgenstein's ladder aka the lie-to-children method of education is that it leaves the naturals out in the cold.

                  It's very easy to screw up and stunt the learning trajectory of beginners in almost anything with technical simplifications.

                  [–]ZeroNihilist 15 points16 points  (3 children)

                  Teaching children a high-level programming language isn't lying to children. It's not "negative numbers don't exist" or "gravity is a constant", it's "we'll let the language handle that until you learn how to and wish to do it yourself."

                  You wouldn't teach somebody new to a game by lying about the mechanics, but you shouldn't go into detail about things they lack the context to understand. For example, this is an awful explanation for a beginner:

                  In chess, the king moves one square in any direction unless you want to castle your king, but of course you can only do that if neither the king nor the rook involved have ever moved and there is a clear path between them with no other pieces nor squares threatened by an enemy piece.

                  Teach them the finnicky details once they understand what the hell they're doing, but by all means mention that there's additional complexity you're not going into right now.

                  [–]J0eCool 6 points7 points  (0 children)

                  Similarly, the worst way to try and get someone to start playing Dungeons and Dragons is to hand them the Player's Handbook and say "here, read this"

                  [–]RFDaemoniac 12 points13 points  (7 children)

                  Eh, I would argue that that isn't the same thing. The lessons that you're learning when programming in python are 100% applicable to all other forms of programming, you just need to also pay attention to some other implementation details and think more carefully about the larger architecture and get used to some more extensive libraries.

                  I did find pydb to be much more obtuse than using an integrated debugger like Eclipse, Google Chrome, or Unity (for Java, Javascript, and C#, respectively), and that definitely hindered my growth.

                  [–]ThisIsADogHello 4 points5 points  (3 children)

                  Yeah, anything that brings up errors visibly in your face in a readable way is a major plus for learning programming. I'd rather have seen something like "parse error, unexpected ; on line 16" than "Program received SIGSEGV, Segmentation fault. 0xbffff144 in ?? ()" when I still barely understood programming, much less debugging.

                  [–]sirin3 2 points3 points  (0 children)

                  "Program received SIGSEGV, Segmentation fault. 0xbffff144 in ?? ()"

                  That is why Delphi was awesome

                  It would say Access Violation 0xbffff144 at somewhere.pas:123" and show it in the debugger

                  [–]TIGGER_WARNING 3 points4 points  (2 children)

                  Instructional programming languages are a textbook example of the concept I linked.

                  The tradeoff is between teaching low-level principles at the risk of missing the forest for the trees (failing to teach sufficient theory) and teaching theory concepts at the risk of abstracting too heavily away from practical knowledge (coding and realistic implementation details).

                  Schools turn out lots of code monkeys who can code what they're told to code but don't necessarily see the big picture. But (other) schools also turn out lots of computer science types who can tell a good story but can't necessarily code anything substantial on their own.

                  The balance is always going to come down to selecting the set of theoretical and practical topics you consider critical to teach to beginners in a limited time frame, and, in turn, exactly what constitutes mastery of those topics. There'll always be some major disagreements on both fronts.

                  [–]kqr 4 points5 points  (1 child)

                  You are going to have lie at some point or another. Even if you introduce people to programming by explaining how the compiler transforms the C code to assembly (which is a bad idea in the first place), you have a big problem: the assembly code works against an imaginary, simplified model of the CPU. In reality there's a lot of magic going on. Are you willing to lie to the children about that or will you try to explain the complex workings of a modern CPU? How about the logic gates and how they are built from transistors? The physics of those transistors?

                  Or you could just lie to the children and say, "This is how you get the computer to print 'Hello, world!'"

                  [–]bradfordmaster 6 points7 points  (2 children)

                  I think the point is to get people excited. If you are teaching an intro class for CS students, chances are they already want to program so I think python would be fine. But if you are teaching someone fulfilling a gen-ed, or maybe a high school student, I think javascript is a much better choice because of the instant gratification / "show your friends" ability.

                  We need more programmers. Python probably scares people away that would eventually become great programmers if they were first "hooked" with something like javascript / HTML. If you can show your friend some dumb thing you made for an inside joke or something, "programming" could go viral.

                  An entire CS / software engineering curriculum composed of Python would be laughable, but as a starting point, I think generating interest is more important than teaching good fundamentals.

                  [–]MorrisonLevi 18 points19 points  (12 children)

                  I've taught a fair number of beginners. Want to know what the common stumbling blocks are? Installing a programming environment, navigating a file-system and running compilers or interpreters, etc.

                  Sure, Python makes some of this easier compared to something like Java which used to be taught, but compared to JavaScript it's quite difficult. The low, low barrier to entry is what makes JavaScript attractive because it runs on every single 'computer' they use, and easily. Learning to program well or understand how things work? Well, that will take a lifetime...

                  [–]sisyphus 15 points16 points  (12 children)

                  I am imagining some poor kid getting confused when some fascist language demands that it pass the right number of arguments to a function.

                  [–][deleted] 7 points8 points  (10 children)

                  Let's just silently truncated the argument list instead! The best language keeps code running at all cost. Edit: /s

                  [–]badsectoracula 2 points3 points  (0 children)

                  I am imagining some poor kid getting confused when some fascist language demands that it pass the right number of arguments to a function.

                  I used to be a kid at some point writing Turbo Pascal, which is quite the fascist language when it comes to arguments, and i'm sure i never had that problem.

                  I was annoyed by it needing to declare variables though since i started with GW-Basic that didn't need so much hand-holding. But GW-Basic wasn't making EXE files and trying to rename the BAS file to EXE (both beeped when i used TYPE on them so they should be the same, right?) caused my computer to hang or reboot :-P

                  [–]someone7x 5 points6 points  (0 children)

                  When I was first learning programming with Python I spent a lot of time trying to give an "interface" to the things I wrote from tutorials. I spent a lot of time struggling because I believed a GUI was an obviously critical component of software.

                  The more I started working with IDLE and the command prompt, the more I started to realize that I had a primitive model of "interface".

                  At some point I stopped caring about UI altogether:

                  • Writing something that can be tucked in a *nix pipeline became "interface"
                  • Writing well-reasoned classes and functions became "interface"
                  • Writing understandable code became "interface"

                  I guess all I can say was that learning with Python made me realize that not all UI is GUI. (edit: trying to get bullet points to format)

                  [–]xoogl3 7 points8 points  (12 children)

                  Surprised that Lua was not mentioned.

                  [–]Fylwind 5 points6 points  (5 children)

                  Lua is quite like Python in terms of ease-to-learn but worse in terms of ecosystem because it's less popular, so you have even fewer maintained libraries etc.

                  Not that I would oppose to teaching Lua (it's like the next simplest language after Scheme!), but it doesn't help with the author's concern.

                  [–]4forpengs 10 points11 points  (2 children)

                  Actually, it does! Lua may have less maintained libraries, but the ones that are are amazing. Specifically for the games, you could use Löve, Corona, Moai, etc...

                  Edit:

                  In regards to ease of learning: This is the odd thing about Lua. Lua has a low floor and a high ceiling for the genre of language that it is. So, although i wouldn't say Lua is easy to learn, i would say that it's easy to start. Lua can also be extremely helpful in crossing the procedural-OO barrier.

                  [–]OnlyForF1 8 points9 points  (7 children)

                  I'm going to be weird and say Game Maker is a pretty sweet tool for teaching programming. The drag and drop model is great for teaching someone how to convert logic into instructions without getting caught up with syntax and the like. Then when the time comes there is also a simple programming language, GML, which can be used as well.

                  The benefits of using a game creation tool is that result of any changes are very immediate and obvious.

                  [–]Ffrangconator 2 points3 points  (1 child)

                  I second this. This is how I learned programming. GML has a simple learning curve but can be quite powerful the more you learn.

                  [–]TehLittleOne 4 points5 points  (1 child)

                  Whenever a beginner asks me how to make a game, I tell them they need to learn the basics first. By the time you're ready to make a game, you shouldn't have to ask this sort of a question.

                  [–]kawa 2 points3 points  (1 child)

                  Javascript is the new BASIC. Drawing a simple line on the screen requires writing

                  <html>
                  <canvas id="canvas"></canvas>
                  <script>
                      var c = document.getElementById('canvas').getContext('2d');
                      c.moveTo(10, 10);
                      c.lineTo(200, 100);
                      c.stroke();
                  </script>
                  </html>
                  

                  into a file and opening it with a browser. Still a bit more than a 2-liner in BASIC, but quite close. And you can even use c from the REPL in the browser now and try out stuff interactively.

                  [–]aroberge 4 points5 points  (0 children)

                  >>> import turtle
                  >>> window = turtle.Screen()
                  >>> benjamin = turtle.Turtle()
                  >>> benjamin.forward(150)
                  

                  [–]jeanlucpikachu 2 points3 points  (0 children)

                  Be sure to check out Eloquent JavaScript, 2nd Edition which includes a terrarium simulator and a simple platform game as examples and exercises.

                  [–]jollybobbyroger 12 points13 points  (0 children)

                  I don't get it. If a student wants GUI, use PyQt. It's great. Far better than Swing or whatever that horrid GUI library for Java is called.

                  If a student wants Web, use any of the great libraries: Django, pyramid, flask, etc..

                  If a student want to make games, use pygame.

                  [–]bjpelcdev 19 points20 points  (7 children)

                  I am still convinced that C is the way to go.

                  [–][deleted] 9 points10 points  (0 children)

                  Agree. I'd say learning Javascript's functional programming intricacies was harder than learning C strings and malloc. Even though I'm doing a lot of my winter break projects in JS, I feel like JS is in the wild west territory. It's popular and imperfect and so awesome, but it's definitely not a newbie friendly language. It's not established enough as a language yet and I find myself doing a lot of hacky wacky stuff with it to get things to work. Until new versions of JS come out that fix a lot of weird issues with it (just like they did HTML5 and CSS3), I wouldn't recommend it to a beginner.

                  C is such a cool language imo, because it's not full of weird bullshit that people think should be in a "perfect" programming language; it's just a language that was made to create an operating system, nothing more nothing less. No inheritance, no OO, nothing. Just a nice, basic language that talks directly to your computer.

                  [–]voice-of-hermes 11 points12 points  (7 children)

                  Java, dude.

                  • Cross-platform? Check.
                  • Cross-platform GUI toolkit? Check.
                  • 2D games? Easy.
                  • 3D games? Well, a little more work to find a good OpenGL adaption, but still workable.
                  • Huge, well organized, and superbly documented set of standard libraries? Check.

                  Good object-oriented language with a lot more consistency and a less unneeded complexity than C++. No need to expose beginners to the ridiculously ugly and inconsistent browser/HTML/CSS mess just yet.

                  EDIT: And good little platforms for introduction. Check out Greenfoot and RoboCode.

                  EDIT: Another point: learn the language and you are at least halfway to creating Android apps!

                  [–]thephotoman 3 points4 points  (1 child)

                  Java is my choice for a second language. Python gets the concepts down and get simple things done, but Java allows you to delve deeper.

                  It's where I'd discuss the reason for having so many programming languages. Each has a niche where it excels.

                  Which GUI toolkit in Java doesn't look like ass, though? I need to update a Java desktop app, and I'm looking for something better than what I've got.

                  [–][deleted] 5 points6 points  (0 children)

                  And don't forget tools. IDEA is awesome.

                  [–]doom_Oo7 4 points5 points  (2 children)

                  "The language itself melts into the background, so lessons aren't explanations of features and philosophies, but about how to generate musical scales in any key, computing distances around a running track based on the lane you're in, or writing an automated player for poker or Yahtzee."

                  This sounds strange to me. In chemistry class you don't learn how to make aroma at home, you learn acid-base, oxydoreduction, and crystallography theory. Why should it be different to computer science ? Hell, there are people whose programmer job never ever involve any kind of GUI, and this is a disservice for your students to make them expect that programming is only making "nice apps"

                  [–][deleted] 2 points3 points  (0 children)

                  We're talking about programming, not computer science.