-
-
Save ar5had/dd1a4d4925489833cc48f00dfb1e9c2a to your computer and use it in GitHub Desktop.
Revisions
-
rtoal revised this gist
May 10, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -83,4 +83,4 @@ Again, there _are_ other choices besides JavaScript for CS1. While you may have  (Image credit: Brendan Eich, creator of JavaScript, who often ends talks with this slide.) -
rtoal revised this gist
May 10, 2017 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -81,4 +81,6 @@ It doesn’t have to. I’m suggesting only that JavaScript is, IMHO, a good veh Again, there _are_ other choices besides JavaScript for CS1. While you may have a different favorite, make sure it is for the right reasons. Because if your argument is that your students are so weak that the first language they see will be forever burned into their mind, that all the bad habits and weaknesses of that first language will instill in them bad habits for the rest of their lives, then ask yourself or your colleagues how you might serve your students by preventing such a poor approach to lifelong learning taking hold in them.  (Image credit: Brendan Eich, creator of JavaScript, who often ends talks with this slice.) -
rtoal revised this gist
May 10, 2017 . 1 changed file with 14 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # JS First ## About This Manifesto @@ -12,11 +12,11 @@ I've taught introductory programming courses at the university level on and off ## Why JavaScript FIRST? We want students to learn and love computer science. Acquiring programming skills helps the field become alive for them, and allows them to make their own contributions to the wealth of human knowledge. To give them this enjoyment, we have to kindle their interest early and keep them from getting discouraged. I’ve found that starting with JavaScript (at least as opposed to Java or C++) helps. In no particular order, here are things I consider to be in JavaScript’s favor as a _first_ (CS1) language: * **No batteries required**. There’s nothing to install to write JavaScript: no compilers, no IDEs. Visit [CodePen](http://codepen.io/) or [JSFiddle](https://jsfiddle.net/), or even open up a browser’s console, and _just start programming_! * **Students can follow along with you**. On sites like JSFiddle you can code a little and share a URL, then students can add their own changes at a fresh URL which you can then project to the class. When a nice solution to a seemingly hard problem comes up, students have been known to clap for each other. * **You can write “fun” code, with graphics and animation, on day one** (with no special tooling). In my own CS1 course, we make simple pictures and animations with [Khan Academy Computer Programming](https://www.khanacademy.org/computing/computer-programming). Students grow the examples into a solution to their first assignment that says only "Make the plane land." I’m often amazed with students’ creativity here. Sometimes the plane comes in from the side, sometimes head on, and once the plane looked like a character from a Mario Brothers game. But _everyone solves the problem_. And they feel good for doing something interesting on their very first day of class. Confidence! @@ -33,13 +33,13 @@ We want students to learn and love computer science. Acquiring programming skill `${locale}: ${date.toLocaleString(locale)}`).join('\n')); ``` * **No(t much) magic to hand-wave away**. Here I am picking on Java again, because Python and Ruby can do a nice `Hello World`, but really, what beginner wants to look at `public static void main(String[] args)`? * **It is one of the most popular programming languages in the world**, and it runs on every device: laptop, Android, iOS. You can write lovely JavaScript programs on Android (you don’t _need_ Java) and lovely JavaScript programs on iOS (you don’t _need_ Swift). Will the native programs look better? Uh, have you remmbered that we are only talking about a _first_ language? You can learn plenty of other languages soon enough. With JavaScript, though, students will know they are learning a real-world language, which often makes their parents happy. It’s one of those languages that helps them get a job. * **It has first-class functions and closures** for Chrissake. No explanation needed for this one! (Of course, you need to know how to teach this stuff to beginners, so use care if you take a recursion-first approach). With a little practice, you can learn to program (and teach) JavaScript in a predominately immutable way. Do you think that languages-that-help-you-get-a-job are mutually exclusive from languages-that-provide-a-good-CS-foundation? Provided you stick to the good parts of JavaScript, you get some good overlap. * **Asynchronicity and Events!** Back to putting all students on a somewhat equal footing in CS1: My favorite first-week experience is when, introducing animation, I ask the students “how do we move this airplane (or balloon) across the screen?” and some will shout out “For loop” or “While loop” and I get to say ”Actually, that’s a nice idea, but that’s not how we do it.” This is one of the hot shots’ first experiences in things being done in a radically different way from what they were previously taught. In JavaScript the system (the animation engine) _calls your code_ at the right times. This mindblowing insight (for many students) is just beautifully, natively, wired into JavaScript. No listener or observer interfaces required. * **It’s Flexible**. Just write array literals and object literals; you don’t need a schema. Did I just say I prefer dynamic typing? Of course not. What am I getting at? _I want the static things to come later_! I want them to experience the fun of making an object or a list (and perhaps animating something), and only after they have done that, generalize. Where is the fun of building, or designing, up-front, a class (with getters and setters, ugh!) before being able to do anything? Doing such a design first does a disservice to the bricoleurs in your class. What is a bricoleur? You need to read Turkle and Papert’s [Epistemological Plurarlism](http://www.papert.org/articles/EpistemologicalPluralism.html) to find out. @@ -67,16 +67,18 @@ Of course, language-flaws-as-teaching-moments are not unique to JavaScript. You In 2006, Joel Spolsky wrote [Can Your Programming Language do This?](https://www.joelonsoftware.com/2006/08/01/can-your-programming-language-do-this/) While certainly not intended as a treatise in favor of JavaScript for CS1, he does use JavaScript as an example of a language in which functional abstraction is easy to do (not to mention important), and links to another article of his on the danger of “Java schools” so he’s got a couple thoughts on education here: (1) A given language might make some things much easier to express than in others, and (2) Please don’t box students in with a single language. What about JavaScript’s competitors? If you want simplicity and ubiquity, and ease of expression, Python can assist you. It’s not a bad CS1 language. But we don’t quite get the HTML and the CSS separation of concerns, we don’t get the just-get-started-in-the-browswer (Tk isn’t quite the same). We get `async` and `await` and other goodies but we need Python 3.5 and up, not to mention a bit of Python preparation. Python gives us ubuiquity on the server side, but not the client side. If we want safety and security, we have Java and C#, but these are a bit verbose: some students will not mind this but others might get overwhelmed (remember, we are talking about an intro language). Type inference to the rescue? Haskell, Standard ML, OCaml? I think we lost ubiquity. JavaScript has a lot in its favor. ## We’ll Never All Agree I’ve just laid out a few things I _like_ about JavaScript as a CS1 language. I’m not trying to convince anyone that it’s the _best_ language for this purpose. I don’t even want to convince you of anything, really. Some people will agree with me and some will not. Speaking of agreement, even if we _all_ agree that setting a good foundation for further study is a good CS1 goal, some people will say that foundation is the lambda calculus and functional abstraction (a la SICP), and others might say it is an appreciation for memory management and the connection to the underlying machine. Some will want students to learn design-first, abstraction-first; others will want students to prototype first, and work from the concrete to the abstract. Should we design experiments (with control groups) to see which of these is best? Have such experiments been done? Here’s what we will find: that some students prefer prototyping to planning, while others prefer the exact opposite. Some students will gravitate to and love functional programming; others will prefer state-based imperative computation. One size does not, and never will, fit all. It doesn’t have to. I’m suggesting only that JavaScript is, IMHO, a good vehicle for CS1---JavaScript + HTML + CSS, setting students on the road to becoming polygot computer scientists. Teaching JavaScript FIRST or Python FIRST or Java FIRST or OCaml FIRST or Racket FIRST or Scratch FIRST does not mean we ignore other languages. We want to choose a first language that gets students hooked rather than discouraged. We’ve seen this happen in the past with Smalltalk, LOGO, and eToys. It happens today with JavaScript: I’ve had students tell me they were glad to see JavaScript first because the early animated programs and the in-browser feedback was helpful. Again, there _are_ other choices besides JavaScript for CS1. While you may have a different favorite, make sure it is for the right reasons. Because if your argument is that your students are so weak that the first language they see will be forever burned into their mind, that all the bad habits and weaknesses of that first language will instill in them bad habits for the rest of their lives, then ask yourself or your colleagues how you might serve your students by preventing such a poor approach to lifelong learning taking hold in them.  -
rtoal revised this gist
Apr 23, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,7 +22,7 @@ We want students to learn and love computer science. Acquiring programming skill * **It’s NOT the language of high school AP Computer Science**. A Java-based introductory computer science course with a mix of first-time programmers and AP CS veterans risks some of the first-timers feeling intimidated by the veterans, and risks veterans being overconfident. Granted, a JS first class may have incoming freshmen with previous JavaScript experience; if so, you might want to take an approach like [Harvey Mudd College’s Green-Gold-Black courses](https://www.cs.hmc.edu/csplacement/). * **You can show localized numbers and dates with one line of code, also on day one!**. Here’s something I’ve shown in class, that had the nice effect of giving Arabic, Chinese, and Hindi speakers, as well as students from countries with differing date formats, warm feelings of familiarity. Run this in a browser: ```javascript const x = 16529385600.75; -
rtoal revised this gist
Apr 23, 2017 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,25 +2,25 @@ ## About This Manifesto Have you ever argued for or against teaching language X as the first language in a university computer science curriculum? If so, I hope that your arguments: * were first and foremost about _students_, not about your personal _language preferences_ (in other words, you should answer the question “What do we want students to gain from their experience with a first language?”, _not_ “Is language X better than language Y?” because people hate that latter question); * kept in mind that ultimately we want to train polyglots, so the first language is never the _only_ language; and * took into account previous work from computing educators, and education theorists and practitioners in general. I've taught introductory programming courses at the university level on and off since 1986 and have used Pascal, Modula 2, Ada, C++, Java, and, since 2009, JavaScript. Colleagues at my university have also used Python, Racket, and MATLAB as first languages. My first programming language was HP-65 machine language (I was 11 years old and didn’t know any better); as far as I know it did not cause me [brain damage](http://wiki.c2.com/?BrainDamage). ## Why JavaScript FIRST? We want students to learn and love computer science. Acquiring programming skills helps the field become alive for them, and allows them to make their own contributions to the wealth of human knowledge. To give them this enjoyment, we have to kindle their interest early and keep them from getting discouraged. I’ve found that starting with JavaScript helps! In no particular order, here are things I consider to be in JavaScript’s favor as a _first_ (CS1) language: * **No batteries required**. There’s nothing to install to write JavaScript: no compilers, no IDEs. Visit [CodePen](http://codepen.io/) or [JSFiddle](https://jsfiddle.net/) and just start programming! * **Students can follow along with you**. On sites like JSFiddle you can code a little, share a URL, and students can add their own changes at a fresh URL, which you can then project to the class. When a nice solution to a seemingly hard problem comes up, students have been known to clap for each other. * **You can write “fun” code, with graphics and animation, on day one** (with no special tooling). In my own CS1 course, we make simple pictures and animations with [Khan Academy Computer Programming](https://www.khanacademy.org/computing/computer-programming). Students grow the examples into a solution to their first assignment that says only "Make the plane land." I’m often amazed with students’ creativity here. Sometimes the plane comes in from the side, sometimes head on, and once the plane looked like a character from a Mario Brothers game. But _everyone solves the problem_. And they feel good for doing something interesting on their very first day of class. Confidence! * **It’s NOT the language of high school AP Computer Science**. A Java-based introductory computer science course with a mix of first-time programmers and AP CS veterans risks some of the first-timers feeling intimidated by the veterans, and risks veterans being overconfident. Granted, a JS first class may have incoming freshmen with previous JavaScript experience; if so, you might want to take an approach like [Harvey Mudd College’s Green-Gold-Black courses](https://www.cs.hmc.edu/csplacement/). * **You can do internationalization with one line of code, also on day one!**. Here’s something I’ve shown in class, that had the nice effect of giving Arabic, Chinese, and Hindi speakers, as well as students from countries with differing date formats, warm feelings of familiarity. Run this in a browser: -
rtoal revised this gist
Apr 23, 2017 . 1 changed file with 3 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,7 +22,7 @@ We want students to learn and love computer science, and acquiring programming s * **It’s NOT the language of high school AP Computer Science**. An introductory computer science course in Java with a mix of first-time programmers and AP CS veterans risks some of the first-timers feeling intimidated by the veterans, and risks veterans being overconfident. Granted, a JS first class may have incoming freshmen with previous JavaScript experience; if so, you might want to take an approach like [Harvey Mudd College’s Green-Gold-Black courses](https://www.cs.hmc.edu/csplacement/). * **You can do internationalization with one line of code, also on day one!**. Here’s something I’ve shown in class, that had the nice effect of giving Arabic, Chinese, and Hindi speakers, as well as students from countries with differing date formats, warm feelings of familiarity. Run this in a browser: ```javascript const x = 16529385600.75; @@ -32,9 +32,7 @@ We want students to learn and love computer science, and acquiring programming s alert(["en-US", "zh-SG", "en-GB", "zh-CN", "ar-EG", "hi-IN"].map(locale => `${locale}: ${date.toLocaleString(locale)}`).join('\n')); ``` * **No(t much) magic to hand-wave away**. Well this is picking on Java again, because Python and Ruby can do a nice Hello World, but really, what beginner wants to look at `public static void main(String[] args)`? * **It is one of the most popular programming languages in the world**, and it runs on every device: laptop, Android, iOS. You can write lovely JavaScript programs on Android (you don’t _need_ Java) and lovely JavaScript programs on iOS (you don’t _need_ Swift). Will the native programs look better? Uh, have you remmbered that we are only talking about a _first_ language? You can learn plenty of other languages soon enough. With JavaScript, though, students will know they are learning a real-world language, which often makes their parents happy. Yes, it’s one of those languages that helps them get a job. @@ -73,7 +71,7 @@ What about JavaScript’s competitors? If you want simplicity and ubiquity, and JavaScript has a lot in its favor. ## We’ll Never All Agree I’ve just laid out a few things I _like_ about JavaScript as a CS1 language. I’m not trying to convince anyone that it’s the _best_ language for this purpose. I don’t even want to convince you of anything, really. Some people will agree with me and some will not. Speaking of agreement, even if we _all_ agree that setting a good foundation for further study is a good CS1 goal, some people will say that foundation is the lambda calculus and functional abstraction (a la SICP), and others might say it as an appreciation for memory management and the connection to the underlying machine. Some will want students to learn design-first, abstraction-first; others will want students to prototype first, and work from the concrete to the abstract. Should we design experiments (with control groups) to see which of these is best? Have such experiments been done? -
rtoal revised this gist
Apr 23, 2017 . 1 changed file with 11 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -23,14 +23,16 @@ We want students to learn and love computer science, and acquiring programming s * **It’s NOT the language of high school AP Computer Science**. An introductory computer science course in Java with a mix of first-time programmers and AP CS veterans risks some of the first-timers feeling intimidated by the veterans, and risks veterans being overconfident. Granted, a JS first class may have incoming freshmen with previous JavaScript experience; if so, you might want to take an approach like [Harvey Mudd College’s Green-Gold-Black courses](https://www.cs.hmc.edu/csplacement/). * **You can do internationalization with one line of code, also on day one!**. Run this in a browser: ```javascript const x = 16529385600.75; alert(["en-US", "es-ES", "es-MX", "ar-EG", "hi-IN"].map(locale => `${locale}: ${x.toLocaleString(locale)}`).join('\n')); const date = new Date(2016, 08, 15); alert(["en-US", "zh-SG", "en-GB", "zh-CN", "ar-EG", "hi-IN"].map(locale => `${locale}: ${date.toLocaleString(locale)}`).join('\n')); ``` I’ve shown these programs in class, and students who speak Arabic, Hindi, Chinese, or come from countries with different date formats experience a very pleasant sense of recognition and begin shedding misconceptions of programming being somehow exclusive. * **No(t much) magic to hand-wave away**. Well this is picking on Java again, because Python and Ruby can do a nice Hello World, but really, what beginner wants to look at `public static void main(String[] args)`? @@ -47,7 +49,7 @@ We want students to learn and love computer science, and acquiring programming s * **It naturally teaches separation of concerns**. Computing educators know about [computing principles](http://denninginstitute.com/pjd/GP/gp_overview.html). One is separation of concerns. When you do JavaScript in the browser, you naturally, almost necessarily, show students how to _separate_ content (HTML), presentation (CSS), and interactivity (JavaScript). And oh guess what, the first two are declarative. How nice to teach beginners the ease and importance of what is essentially modeling. ## But What About...? As one of the most popular programming languages in the world, JavaScript has passionate lovers and haters. Its creator, Brendan Eich, freely admits some [less-than-good design choices](https://youtu.be/1EyRscXrehw#t=04m57s). There is much to poke fun at. Yes, JavaScript is featured in the famous [WAT Video](https://www.destroyallsoftware.com/talks/wat). Douglas Crockford’s [JavaScript: The Good Parts](http://shop.oreilly.com/product/9780596517748.do) has sections of JavaScript’s Bad Parts and Awful Parts. You can take a rigid, intolerant view and claim the language’s shortcomings disqualify it from consideration for your curriculum lest it poison your young student’s minds. Or you can be a reasonable, pragmatic, citizen of the world, and use these flaws as teaching moments. Consider: -
rtoal revised this gist
Apr 23, 2017 . 1 changed file with 19 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,25 +4,25 @@ Have you ever argued for or against teaching language X as the first language in a university computer science curriculum? I hope that your arguments: * were first and foremost about _students_, not about your personal _language preferences_ (in other words, you should answer the question “What do we want to students to gain from their experience with a first language?”, NOT “Is language X better than language Y?” because people hate that latter question); * kept in mind that ultimately we want to train polyglots, so the first language is never the _only_ language; and * took into account previous work from computing educators, and education theorists and practitioners in general. I've taught introductory programming courses at the university level on and off since 1986 and have used Pascal, Modula 2, Ada, C++, Java, and, since 2009, JavaScript. Colleagues at my university have also used Python, Racket, and MATLAB as first languages. My first programming language was HP-65 machine language (hey, I was 11 years old and didn’t know any better) and as far as I know it did not cause me [brain damage](http://wiki.c2.com/?BrainDamage). ## Why JavaScript FIRST? We want students to learn and love computer science, and acquiring programming skils helps the field become alive to them, and allows them to make their own contributions to the wealth of human knowledge. To give them this enjoyment, we have to kindle their interest early and keep them from getting discouraged. I’ve found that starting with JavaScript helps! In no particular order, here are things I consider to be in JavaScript’s favor as a _first_ (CS1) language: * **No batteries required**. There’s nothing to install to write JavaScript: no compilers, no IDEs. Visit [CodePen](http://codepen.io/) or [JSFiddle](https://jsfiddle.net/) and just start programming! * **Students can follow along with you**. On sites like JSFiddle you can code a little, share a URL, and students can add their own changes at a fresh URL, which you can then project to the class. When a nice solution to a seemingly hard problem comes up, students have been known to clap for each other. * **You can write “fun” code, with graphics and animation, on day one** (with no special tooling). In my own CS1 course, we make simple pictures and animations with [Khan Academy Computer Programming](https://www.khanacademy.org/computing/computer-programming). Students grow the examples into a solution to their first assignment that says only "Make the plane land." I’m so pleased with students’ creativity here. Sometimes the plane comes in from the side, sometimes head on, and once the plane looked like a character from a Mario Brothers game. But _everyone solves the problem_. And they feel good for doing something interesting on their very first day of class. Confidence! * **It’s NOT the language of high school AP Computer Science**. An introductory computer science course in Java with a mix of first-time programmers and AP CS veterans risks some of the first-timers feeling intimidated by the veterans, and risks veterans being overconfident. Granted, a JS first class may have incoming freshmen with previous JavaScript experience; if so, you might want to take an approach like [Harvey Mudd College’s Green-Gold-Black courses](https://www.cs.hmc.edu/csplacement/). * **You can do internationalization with one line of code, also on day one!**. Run this in a browser: ```javascript const x = 16529385600.75; alert(["en-US", "es-ES", "es-MX", "ar-EG", "hi-IN"].map(locale => @@ -31,15 +31,15 @@ We want students to learn and love computer science, and acquiring programming s alert(["en-US", "zh-SG", "en-GB", "zh-CN", "ar-EG", "hi-IN"].map(locale => `${locale}: ${date.toLocaleString(locale)}`).join('\n')); ``` I’ve shown these programs in class, and students who speak Arabic, Hindi, Chinese, or come from countries with different date formats experience a very pleasant sense of recognition and begin shedding misconceptions of programming being somehow exclusive. * **No(t much) magic to hand-wave away**. Well this is picking on Java again, because Python and Ruby can do a nice Hello World, but really, what beginner wants to look at `public static void main(String[] args)`? * **It is one of the most popular programming languages in the world**, and it runs on every device: laptop, Android, iOS. You can write lovely JavaScript programs on Android (you don’t _need_ Java) and lovely JavaScript programs on iOS (you don’t _need_ Swift). Will the native programs look better? Uh, have you remmbered that we are only talking about a _first_ language? You can learn plenty of other languages soon enough. With JavaScript, though, students will know they are learning a real-world language, which often makes their parents happy. Yes, it’s one of those languages that helps them get a job. * **It has first-class functions and closures** for Chrissake. No explanation needed for this one! (Of course, you need to know how to teach this stuff to beginners, so use care if you take a recursion-first approach). With a little practice, you can learn to program (and teach) JavaScript in a predominately immutable way. Do you think that languages-that-help-you-get-a-job are mutually exclusive from languages-that-provide-a-good-CS-foundation? Provided you stick to the good parts of JavaScript, you get some good overlap. * **Asynchronicity and Events!** Back to putting all students on a somewhat equal footing in CS1: My favorite first-week experience is when, introducing animation, I ask the students “how do we move this airplane (or balloon) across the screen?” and some will shout out “For loop” or “While loop” and I get to say ”Actually, that’s a nice idea, but that’s not how we do it.” This is one of the hot shots’ first experience in things being done in a radically different way from what they were previously taught. Imagine: just draw the frame in response to a clock. The system (the animation engine) _calls your code_ at the right times. This mindblowing insight (for many students) is just beautifully, natively, wired into JavaScript. No listener or observer interfaces required. * **It’s Flexible**. Just write array literals and object literals; you don’t need a schema. Did I just say I prefer dynamic typing? Of course not. What am I getting at? _I want the static things to come later_! I want them to experience the fun of making an object or a list (and perhaps animating something), and only after they have done that, generalize. Where is the fun of building, or designing, up-front, a class (with getters and setters, ugh!) before being able to do anything? Doing such a design first does a disservice to the bricoleurs in your class. What is a bricoleur? You need to read Turkle and Papert’s [Epistemological Plurarlism](http://www.papert.org/articles/EpistemologicalPluralism.html) to find out. @@ -49,23 +49,25 @@ We want students to learn and love computer science, and acquiring programming s ## But “What About....?” As one of the most popular programming languages in the world, JavaScript has passionate lovers and haters. Its creator, Brendan Eich, freely admits some [less-than-good design choices](https://youtu.be/1EyRscXrehw#t=04m57s). There is much to poke fun at. Yes, JavaScript is featured in the famous [WAT Video](https://www.destroyallsoftware.com/talks/wat). Douglas Crockford’s [JavaScript: The Good Parts](http://shop.oreilly.com/product/9780596517748.do) has sections of JavaScript’s Bad Parts and Awful Parts. You can take a rigid, intolerant view and claim the language’s shortcomings disqualify it from consideration for your curriculum lest it poison your young student’s minds. Or you can be a reasonable, pragmatic, citizen of the world, and use these flaws as teaching moments. Consider: * Weak typing is error prone, yes, but use its potential pitfalls to talk about implicit conversion, and its dangers. * Dynamic langauge flexibility comes with serious tradeoffs. I’ve seen multiple students misspell `constructor` (as `contructor`) and somewhere down the line they see `undefined`. Have a discussion with the students to see how to prevent these errors. (Unit testing will come up!) * Yeah, yeah `"2" + "2" === "22"`. Hang on, why are you concatenating strings anyway? Protip: students don’t mind string interpolation. This brings up a general point. The students will be ready, at some point, for a linter. Most of the silly WAT stuff can be caught by a linter. * The `with` statement? `eval`? Types-as-strings? `==` vs. `===`? You can avoid the first three in normal code. As far as the last one goes, you can call `==` the similarity operator, and `===` the equality operator. `a == b` means `a` and `b` are similar to each other, not necessarily equal. Again, a good place to talk about types. * Speaking of types, have you heard of TypeScript? Of course, language-flaws-as-teaching-moments are not unique to JavaScript. You would bring these up with your students in other langauges, too. But ask yourself: are any of these flaws so severe they are unable to be adressed at all? Can you not help your students recognize and address them? Are you giving up too easily? ## Can’t Other Languages Do What JavaScript Can Do? In 2006, Joel Spolsky wrote [Can Your Programming Language do This?](https://www.joelonsoftware.com/2006/08/01/can-your-programming-language-do-this/) While certainly not intended as a treatise in favor of JavaScript for CS1, he does use JavaScript as an example of a language in which functional abstraction is easy to do (not to mention important), and links to another article of his on the danger of “Java schools” so he’s got a couple thoughts on education here: (1) A given language might make some things much easier to express than in others, and (2) Please don’t box students in with a single language. What about JavaScript’s competitors? If you want simplicity and ubiquity, and ease of expression, Python can assist you. It’s not a bad CS1 language. But we don’t quite get the HTML and the CSS, we don’t get the just-get-started-in-the-browswer (Tk isn’t quite the same). We get `async` and `await` and other goodies but we need Python 3.5 and up. We have ubuiquity on the server side, but not the client side. If we want safety and security, we have Java and C#, but these are a bit verbose. Some students will not mind this; others might get overwhelmed (remember, we are talking about an intro language). Type inference to the rescue? Haskell, Standard ML, OCaml? I think we lost ubiquity. JavaScript has a lot in its favor. -
rtoal revised this gist
Apr 23, 2017 . 1 changed file with 19 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,8 +22,14 @@ We want students to learn and love computer science, and acquiring programming s * **It’s NOT the language of high school AP Computer Science**. An introductory computer science course in Java with a mix of first-time programmers and AP CS veterans risks some of the first-timers feeling intimidation when seeing the veterans, and risks veterans being overconfident. Granted, you may have incoming freshmen with previous JavaScript experience, and if so, you might want to take an approach like [Harvey Mudd College’s Green-Gold-Black courses](https://www.cs.hmc.edu/csplacement/). * **You can do internationalization with one line of code, also on day one!**. Show this in a browser console: ```javascript const x = 16529385600.75; alert(["en-US", "es-ES", "es-MX", "ar-EG", "hi-IN"].map(locale => `${locale}: ${x.toLocaleString(locale)}`).join('\n')); const date = new Date(2016, 08, 15); alert(["en-US", "zh-SG", "en-GB", "zh-CN", "ar-EG", "hi-IN"].map(locale => `${locale}: ${date.toLocaleString(locale)}`).join('\n')); ``` I’ve done these programs before and students who speak Arabic, Hindi, Chinese, or come from countries with different date formats experience a very pleasant sense of recognition and start shedding their misconceptions of programming being an American thing. @@ -37,23 +43,23 @@ We want students to learn and love computer science, and acquiring programming s * **It’s Flexible**. Just write array literals and object literals; you don’t need a schema. Did I just say I prefer dynamic typing? Of course not. What am I getting at? _I want the static things to come later_! I want them to experience the fun of making an object or a list (and perhaps animating something), and only after they have done that, generalize. Where is the fun of building, or designing, up-front, a class (with getters and setters, ugh!) before being able to do anything? Doing such a design first does a disservice to the bricoleurs in your class. What is a bricoleur? You need to read Turkle and Papert’s [Epistemological Plurarlism](http://www.papert.org/articles/EpistemologicalPluralism.html) to find out. * **Unit Testing is Probably Much Easier to do than You Think**. Check out what I did [here](http://jsfiddle.net/rtoal/ooasyj2w/)? * **It naturally teaches separation of concerns**. Computing educators know about [computing principles](http://denninginstitute.com/pjd/GP/gp_overview.html). One is separation of concerns. When you do JavaScript in the browser, you naturally, almost necessarily, show students how to _separate_ content (HTML), presentation (CSS), and interactivity (JavaScript). And oh guess what, the first two are declarative. How nice to teach beginners the ease and importance of what is essentially modeling. ## But “What About....?” As one of the most popular programming languages in the world, JavaScript has passionate lovers and haters. Its creator, Brendan Eich, freely admits some [less-than-good design choices](https://youtu.be/1EyRscXrehw#t=04m57s). There is much to poke fun at. Yes, JavaScript is featured in the famous [WAT Video](https://www.destroyallsoftware.com/talks/wat). Douglas Crockford’s [JavaScript: The Good Parts](http://shop.oreilly.com/product/9780596517748.do) has sections of JavaScript’s Bad Parts and Awful Parts. You can take a rigid, intolerant view and claim the language’s shortcomings disqualify it from consideration for your curriculum lest it poison your young student’s minds. Or you can be a reasonable, pragmatic, citizen of the world, and use these flaws as teaching moments. * Weak typing is error prone, yes, but use the potential pitfalls to talk about implicit conversion, and its dangers. * Is the language too dyanmic? Flexibility comes with serious tradeoffs. I’ve seen multiple students misspell `constructor` (as `contructor`) and somewhere down the line they see `undefined`. Start a discussion with the students to see how to prevent these errors. (Unit testing will come up!) * That string concatenation tho! Yeah, yeah `"2" + "2" === "22"`. Hang on, why are you concatenating strings anyway? Protip: students don’t mind string interpolation. This brings up a general point. The students will be ready, at some point, for a linter. Most of the silly WAT stuff can be caught by a linter. * The `with` statement? `eval`? Types-as-strings? `==` vs. `===`? You can avoid the first three in normal code. As far as the last one goes, you can call `==` the similarity operator, and `===` the equality operator. `a == b` means `a` and `b` are similar to each other, not necessarily equal. Again, a good place to talk about types. Of course, language-flaws-as-teaching-moments are not unique to JavaScript. You would do the same for your students in other langauges, too. But ask yourself: are any of these flaws so severe they are unable to be adressed at all? Can you not help your students recognize and address them? Are you giving up too easily? ## Can’t Other Languages Do What JavaScript Can Do? @@ -65,8 +71,10 @@ JavaScript has a lot in its favor. ## We’ll never all agree I’ve just laid out a few things I _like_ about JavaScript as a CS1 language. I’m not trying to convince anyone that it’s the _best_ language for this purpose. I don’t even want to convince you of anything, really. Some people will agree with me and some will not. Speaking of agreement, even if we _all_ agree that setting a good foundation for further study is a good CS1 goal, some people will say that foundation is the lambda calculus and functional abstraction (a la SICP), and others might say it as an appreciation for memory management and the connection to the underlying machine. Some will want students to learn design-first, abstraction-first; others will want students to prototype first, and work from the concrete to the abstract. Should we design experiments (with control groups) to see which of these is best? Have such experiments been done? You know what we might find, right? That some students prefer prototyping to planning, while others prefer the exact opposite. Some students will gravitate to and love functional programming; others will prefer state-based imperative computation. One size does not fit all. It doesn’t have to. I’m suggesting only that JavaScript is, IMHO, a good vehicle for CS1---JavaScript + HTML + CSS, setting students on the road to becoming polygot computer scientists. Teaching JavaScript FIRST or Python FIRST or Java FIRST or OCaml FIRST or Racket FIRST or Scratch FIRST does not mean we ignore other languages. We want to choose a first language that gets students hooked rather than discouraged. We’ve seen this happen with Smalltalk, LOGO, and eToys; I’ve had students tell me they were glad to see JavaScript first because the early animated programs and the in-browser feedback was helpful. And again, there _are_ other choices besides JavaScript for CS1. While you may have a different favorite, make sure it is for the right reasons. Because if your argument is that your students are so weak that the first language they see will be forever burned into their mind, that all the bad habits and weaknesses of that first language will instill in them bad habits for the rest of their lives, then ask yourself or your colleagues how you might serve your students by preventing such a poor approach to lifelong learning taking hold in them. -
rtoal revised this gist
Apr 23, 2017 . 1 changed file with 13 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ ## About This Manifesto Have you ever argued for or against teaching language X as the first language in a university computer science curriculum? I hope that your arguments: * were first and foremost about _students_, not about your pithy _language preferences_ (in other words, you should answer the question “What do we want to students to gain from their experience with a first language?”, NOT “Is language X better than language Y?” because people hate that latter question); * kept in mind that ultimately we want to train polyglots, so the first language is never the _only_ language; and @@ -12,7 +12,7 @@ I've taught introductory programming courses at the university level on and off ## Why JavaScript FIRST? We want students to learn and love computer science, and acquiring programming skils helps the field become alive to them, and allows them to make their own contributions to the wealth of human knowledge. To give them this enjoyment, we have to kindle their interest early and keep them from getting discouraged. I’ve found that starting with JavaScript helps! In no particular order, here are things I consider to be in JavaScript’s favor for a _first_ (CS1) language: * **No batteries required**. There’s nothing to install to write JavaScript: no compilers, no IDEs. Visit [CodePen](http://codepen.io/) or [JSFiddle](https://jsfiddle.net/) and just start programming! @@ -45,26 +45,28 @@ We want students to learn and love computer science, and acquiring programming s As one of the most popular programming languages in the world, JavaScript has passionate lovers and haters. Its creator, Brendan Eich, freely admits some less-than-good design choices (https://youtu.be/1EyRscXrehw#t=04m57s). There is much to poke fun at. Yes, JavaScript is featured in the famous [WAT Video](https://www.destroyallsoftware.com/talks/wat). Douglas Crockford’s [JavaScript: The Good Parts](http://shop.oreilly.com/product/9780596517748.do) has sections of JavaScript’s Bad Parts and Awful Parts. You can take a rigid, intolerant view and claim the language’s shortcomings disqualify it from consideration for your curriculum lest it poison your young student’s minds. Or you can be a reasonable, pragmatic, citizen of the world, and use these flaws as teaching moments. * Weak typing is error prone, yes, but use the potential pitfalls to talk about implicit conversion, and its dangers. * Is the language too dyanmic? Flexibility comes with serious tradeoffs. I’ve seen multiple students misspell `constructor` (as `contructor`) and somewhere down the line they see `undefined`. Start a discussion with the students to see how to prevent these errors. (That’s right: unit testing will come up!) * That string concatenation tho! Yeah, yeah `"2" + "2" === "22"`. Hang on, why are you concatenating strings anyway? Protip: students don’t mind string interpolation. This brings up a general point. The students will be ready, at some point, for a linter. Most of the silly WAT stuff can be caught by a linter. * Too high-level. Too far removed from the machine. JavaScript is not the only language with flaws. ## Can’t Other Languages Do What JavaScript Can Do? In 2006, Joel Spolsky wrote [Can Your Programming Language do This?](https://www.joelonsoftware.com/2006/08/01/can-your-programming-language-do-this/) While certainly not a treatise in favor of JavaScript for CS1, he does use JavaScript as an example of a language in which functional abstraction is easy to do (not to mention important), and links to another article of his on the danger of “Java schools” so he’s got some thoughts on education. What about its competitors? If you want simplicity and ubiquity, and ease of expression, Python is ready. It’s not a bad CS1 language. But we don’t quite get the HTML and the CSS, we don’t get the just-get-started-in-the-browswer. We get `async` and `await` and other goodies but we need Python 3.5 and up. We have ubuiquity on the server side, but not the client side. If we want safety and security, we have Java and C#, but these are a bit verbose. Some students will not mind this; others might get overwhelmed (remember, we are talking about an intro language). Type inference to the rescue? Haskell, Standard ML, OCaml? I think we lost ubiquity. JavaScript has a lot in its favor. ## We’ll never all agree I’ve just laid out a few things I _like_ about JavaScript as a CS1 language. I’m not trying to convince anyone that it’s the _best_ language for this purpose. I don’t even want to convince you of anything, really. Some people will agree with me and some will not. Speaking of agreement, even if we _all_ agree that setting a good foundation for further study is a good CS1 goal, some people will see that foundation as the lambda calculus and functional abstraction (a la SICP), and others might see it as an appreciation for memory management and the connection to the underlying machine. Some will want students to learn design-first, abstraction-first; others will want students to prototype first, and work from the concrete to the abstract. Should we design experiments (with control groups) to see which of these is best? Have such experiments been done? You know what we might find, right? That some students prefer learning one way over another, while other students prefer the exact opposite. Some students will gravitate to and love functional programming; others will prefer state-based imperative computation. One size does not fit all. It doesn’t have to. All I want to say is JavaScript is, IMHO, a good vehicle for CS1. JavaScript + HTML + CSS, setting students on the road to becoming polygot computer scientists. Teaching JavaScript FIRST or Python FIRST or Java FIRST or OCaml FIRST or Racket FIRST does not mean we ignore other languages. We want to choose a first language that gets students hooked rather than discouraged. And, by the way, if you feel that your students are so weak that the first language they see will be forever burned into their mind, that all the bad habits and weaknesses of that first language will instill in them bad habits for the rest of their lives, then ask yourselves or your colleagues how you might serve your students by preventing such a poor approach to lifelong learning take hold in them. -
rtoal revised this gist
Apr 23, 2017 . 1 changed file with 18 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,23 +4,23 @@ Have you ever argued for or against teaching language X as the first language in a university computer science curriculum? I hope that your arguments * were first and foremost about _students_, not about your pithy _language preferences_ (in other words, you should answer the question “What do we want to students to gain from their experience with a first language?”, NOT “Is language X better than language Y?” because people hate that latter question); * kept in mind that ultimately we want to train polyglots, so the first language is never the _only_ language; and * took into account previous work from computing educators, and education theorists and practitioners in general. I've taught introductory programming courses at the university level on and off since 1986 and have used Pascal, Modula-2, Ada, C++, Java, and, since 2009, JavaScript. Colleagues at my University have also used Python, Racket, and MATLAB as first languages. My first programming language was HP-65 machine language (hey, I was 11 years old and didn’t know any better) and as far as I know it did not cause me [brain damage](http://wiki.c2.com/?BrainDamage). ## Why JavaScript FIRST? We want students to learn and love computer science, and acquiring programming skils helps the field become alive to the them, and allows them to make their own contributions to the wealth of human knowledge. To give them this enjoyment, we have to kindle their interest early and keep them from getting discouraged. I’ve found that starting with JavaScript helps! In no particular order, here are things I consider to be in JavaScript’s favor for a _first_ language in CS1: * **No batteries required**. There’s nothing to install to write JavaScript: no compilers, no IDEs. Visit [CodePen](http://codepen.io/) or [JSFiddle](https://jsfiddle.net/) and just start programming! * **Students can follow along with you**. On sites like JSFiddle you can code a little, share a URL, and students can add their own changes at a fresh URL, which you can then project to the class. When a nice solution to a seemingly hard problem comes up, students have been known to clap for each other. * **You can write “fun” code, with graphics and animation, on day one** (with no special tooling). In my own CS1 course, we make simple pictures and animations with [Khan Academy Computer Programming](https://www.khanacademy.org/computing/computer-programming). Students grow the examples into a solution to their first assignment that says only "Make the plane land." I’m very often pleased with how creative many students are with this. Sometimes the plane comes in from the side, sometimes head on, and once the plane looked like a character from a Mario Brothers game. But _everyone solves the problem_. And they feel good for doing something interesting on their very first day of class. Confidence! * **It’s NOT the language of high school AP Computer Science**. An introductory computer science course in Java with a mix of first-time programmers and AP CS veterans risks some of the first-timers feeling intimidation when seeing the veterans, and risks veterans being overconfident. Granted, you may have incoming freshmen with previous JavaScript experience, and if so, you might want to take an approach like [Harvey Mudd College’s Green-Gold-Black courses](https://www.cs.hmc.edu/csplacement/). * **You can do internationalization with one line of code, also on day one!**. Run any one of these lines in a browser console. ``` @@ -29,21 +29,21 @@ We want students to learn and love computer science, and programming skils helps * **No magic to hand-wave away**. Well this is picking on Java again, because Python and Ruby can do a nice Hello World, but really, what beginner wants to look at `public static void main(String[] args)`? * **It is one of the most popular programming languages in the world**, and it runs on every device: laptop, Android, iOS. You can write lovely JavaScript programs on Android (you don’t _need_ Java) and lovely JavaScript programs on iOS (you don’t _need_ Swift). Will the native programs look better? Uh, have you remmbered that we are only talking about a _first_ language? You can learn plenty of other languages soon enough. With JavaScript, though, students will know they are learning a real-world language, which often makes their parents happy. Yes, it’s one of those languages that helps them get a job. * **It has first-class functions and closures** for Chrissake. No explanation needed for this one! (Of course, you need to know how to teach this stuff to beginners, so use care if you take a recursion-first approach). Do you think that languages-that-help-you-get-a-job are mutually exclusive from languages-that-provide-a-good-CS-foundation? Provided you stick to the good parts of JavaScript, you get some good overlap. * **Asynchronicity and Events!** Back to putting everyone on an equal footing in CS1: My favorite first-week experience is when introducing animation, I ask the students “how do we move this airplane (or balloon) across the screen?” and some will shout out “For loop” or “While loop” and I get to say ”Actually, that’s a nice idea, but that’s not how we do it.” This is one of the hot shots’ first experience in things being done in a radically different way from what they were previously taught. Imagine: just draw the frame in response to a clock. The system (the animation engine) _calls your code_. This mindblowing insight (for many students) is just beautifully, natively, wired into JavaScript. No listener or observer interfaces required. * **It’s Flexible**. Just write array literals and object literals; you don’t need a schema. Did I just say I prefer dynamic typing? Of course not. What am I getting at? _I want the static things to come later_! I want them to experience the fun of making an object or a list (and perhaps animating something), and only after they have done that, generalize. Where is the fun of building, or designing, up-front, a class (with getters and setters, ugh!) before being able to do anything? Doing such a design first does a disservice to the bricoleurs in your class. What is a bricoleur? You need to read Turkle and Papert’s [Epistemological Plurarlism](http://www.papert.org/articles/EpistemologicalPluralism.html) to find out. * **Unit Testing is Probably Much Easier to do than You Think*. See what I did [here](http://jsfiddle.net/rtoal/ooasyj2w/)? * **It naturally teaches separation of concerns**. Computing educators know about [computing principles](http://denninginstitute.com/pjd/GP/gp_overview.html). One is separation of concerns. When you do JavaScript in the browser, you naturally, almost necessarily, show students how to _separate_ content (HTML), presentation (CSS), and interactivity (JavaScript). And oh guess what, the first two are declarative. How nice to teach beginners the ease and importance of what is essentially modeling. ## But “What About....?” You May Ask As one of the most popular programming languages in the world, JavaScript has passionate lovers and haters. Its creator, Brendan Eich, freely admits some less-than-good design choices (https://youtu.be/1EyRscXrehw#t=04m57s). There is much to poke fun at. Yes, JavaScript is featured in the famous [WAT Video](https://www.destroyallsoftware.com/talks/wat). Douglas Crockford’s [JavaScript: The Good Parts](http://shop.oreilly.com/product/9780596517748.do) has sections of JavaScript’s Bad Parts and Awful Parts. You can take a rigid, intolerant view and claim the language’s shortcomings disqualify it from consideration for your curriculum lest it poison your young student’s minds. Or you can be a reasonable, pragmatic, citizen of the world, and use these flaws as teaching moments. * TODO weak typing @@ -55,11 +55,16 @@ As one of the most popular programming languages in the world, JavaScript has it * TODO we should learn C first because Yes JavaScript has flaws. So do other languages. ## Can’t Other Languages Do What JavaScript Can Do? In 2006, Joel Spolsky wrote [Can Your Programming Language do This?](https://www.joelonsoftware.com/2006/08/01/can-your-programming-language-do-this/) While certainly not a treatise in favor of JavaScript for CS1, he does use JavaScript as an example of a language in which functional abstraction is easy to do (not to mention important), and links to another article of his on the danger of “Java schools” so he’s got some thoughts on education. ## We’ll never all agree I’ve just laid out a few things I _like_ about JavaScript as a CS1 language. I’m not trying to convince anyone that it’s the best language for this purpose. I don’t need to convince you of anything really. Some people will agree with me and some will not. We might even _all_ agree that setting a good foundation for further study is a good CS1 goal, but some people will see that foundation as the lambda calculus and functional abstraction (a la SICP), and others might see it as an appreciation for memory management and the connection to the underlying machine. Some will want students to learn design-first, abstraction-first; others will want students to prototype first, and work from the concrete to the abstract. Should we design experiments (with control groups) to see which of these is best? Have such experiments been done? You know what we might find, right? That some students prefer learning one way over another, while other students prefer the exact opposite. Some students will gravitate to and love functional programming; others will prefer state-based imperative computation. One size does not fit all. It doesn’t have to. All I want to say is JavaScript is, IMHO, a good vehicle for CS1. JavaScript + HTML + CSS, setting students on the road to becoming polygot computer scientists. Teaching JavaScript FIRST or Python FIRST or Java FIRST or OCaml FIRST or Racket FIRST does not mean we ignore other languages. We want to choose a first language that gets them hooked rather than discouraged. And, by the way, if you feel that your students are so weak that the first language they see will be forever burned into their mind, that all the bad habits and weaknesses of that first language will instill in them bad habits for the rest of their lives, then ask yourselves or your colleagues how you might serve your students by preventing such a poor approach to lifelong learning take hold in them. -
rtoal created this gist
Apr 23, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,65 @@ # JSFirst ## About This Manifesto Have you ever argued for or against teaching language X as the first language in a university computer science curriculum? I hope that your arguments * were first and foremost about _students_, not about your pithy _language preferences_ (in other words, are you answering the question “What do we want to students to gain from their experience with a first language?”, NOT “Is language X better than language Y?” because people hate that latter question); * kept in mind that ultimately we want to train polyglots, so the first language is never the _only_ language; and * took into account previous work from computing educators, and education theorists and practitioners in general. I've taught introductory programming courses at the university-level on and off since 1986 and have used Pascal, Modula-2, Ada, C++, Java, and, since 2009, JavaScript. Colleagues at my University have also used Python, Racket, and MATLAB as first languages. My first programming language was HP-65 machine language (hey I was 11 years old) and as far as I know it did not cause me [brain damage](http://wiki.c2.com/?BrainDamage). ## Why JavaScript FIRST? We want students to learn and love computer science, and programming skils helps the field become alive to the students, and allows them to make contributions to the field, and society. To give them this enjoyment, we have to kindle their interest early and keep them from getting discouraged. I’ve found that starting them with JavaScript helps! In no particular order, here are things I consider to be in JavaScript’s favor for a _first_ language in CS1: * **No batteries required**. There’s nothing to install: no compilers, no IDEs. Visit [CodePen](http://codepen.io/) or [JSFiddle](https://jsfiddle.net/) and just start programming! * **Students can follow along with you**. On sites like JSFiddle you can code a little, share a URL, and students can add their own changes at a fresh URL, which you can then project to the class. When a nice solution to a seemingly hard problem comes up, students have been known to clap for each other. * **You can write “fun” code, with graphics and animation, on day one** (with no special tooling). In my own CS1 course, we make simple pictures and animations with [Khan Academy](https://www.khanacademy.org/computing/computer-programming). Students grow the examples into a solution to their first assignment that says only "Make the plane land." I’m very often pleased with how creative many students are with this. Sometimes the plane comes in from the side, sometimes head on, and once the plane looked like a character from a Mario Brothers game. But _everyone solves the problem_. And they feel good for doing something interesting on their very first day of class. Confidence! * **It’s not the language of high school AP Computer Science**. An introductory computer science course in Java with a mix of first-time programmers and AP CS veterans risks some of the first-timers feeling intimidation when seeing the veterans, and risks veterans being overconfident. Granted, you may have incoming freshmen with previous JavaScript experience, and if so, you might want to take an approach like [Harvey Mudd College’s Green-Gold-Black courses](https://www.cs.hmc.edu/csplacement/). * **You can do internationalization with one line of code, also on day one!**. Run any one of these lines in a browser console. ``` ``` I’ve done these programs before and students who speak Arabic, Hindi, Chinese, or come from countries with different date formats experience a very pleasant sense of recognition and start shedding their misconceptions of programming being an American thing. * **No magic to hand-wave away**. Well this is picking on Java again, because Python and Ruby can do a nice Hello World, but really, what beginner wants to look at `public static void main(String[] args)`? * **It is one of the most popular programming languages in the world**, and it runs on every device: laptop, Android, iOS. You can write lovely JavaScript programs on Android (you don’t _need_ Java) and lovely JavaScript programs on iOS (you don’t _need_ Swift). Will the native programs look better? Have you remmbered that we are only talking about a _first_ language? Students will know they are learning a real-world language, which makes parents happy too. Yes, it’s one of those languages that helps them get a job. * **It has first-class functions and closures** for Chrissake. No explanation needed. (Of course, you need to know how to teach this stuff to beginners, so use care if you take a recursion-first approach). Do you think that languages-that-help-you-get-a-job are mutually exclusive from languages-that-provide-a-good-CS-foundation? Provided you stick to the good parts of JavaScript, you get some good overlap. * **Asynchronicity and Events!** Back to putting everyone on an equal footing in CS1: My favorite first-week experience is when introducing animation, I ask the students “how do we move this airplane (or balloon) across the screen?” and some will shout out “For loop” or “While loop” and I get to say ”Actually, that’s a nice idea, but that’s not how we do it.” This is one of the hot shots’ first experience in things being done in a radically different way from what they were previously taught. Imagine: just draw the frame in response to a clock. The system (the animation engine) _calls your code_. This mindblowing insight (for many students) is just beautifully, natively, wired into JavaScript. No listener or observer interfaces required. * **It’s Flexible**. Just write array literals and object literals; you don’t need a schema. Did I just say I prefer dynamic typing? Of course not. What am I getting at? _I want the static things to come later_! I want them to experience the fun of making an object or a list (and perhaps animating something), and after they have done that, _then_ generalize. Where is the fun of building, or designing, up-front, a class (with getters and setters-ugh!) before being able to do anything? Doing this does a disservice to the bricoleurs in your class. At what is a bricoleur? You need to read Turkle and Papert’s [Epistemological Plurarlism](http://www.papert.org/articles/EpistemologicalPluralism.html) to find out. * **Unit Testing is Probably Much Easier to do than You Think*. See what I did [here](http://jsfiddle.net/rtoal/ooasyj2w/)? * **It naturally teaches separation of concerns**. Computing educators know about [computing principles](). One is separation of concerns. When you do JavaScript in the browser, you naturally, almost necessarily, show students how to separate content (HTML), presentation (CSS), and interactivity (JavaScript). And oh guess what, the first two are declarative. How nice to teach beginners the ease and importance of what is essentially modeling. ## But “What About....?” You May Ask As one of the most popular programming languages in the world, JavaScript has its lovers and haters. Its creator, Brendan Eich, freely admits some less-than-stellar design choices (https://youtu.be/1EyRscXrehw#t=04m57s). There is much to poke fun atYes, JavaScript is featured in the famous [WAT Video]. Douglas Crockford’s [JavaScript: The Good Parts]() has sections of JavaScript’s Bad Parts and Awful Parts. You can take a rigid, intolerant view and claim the language’s shortcomings disqualify it from consideration for your curriculum lest it poison your young student’s minds. Or you can be a reasonable, pragmatic, citizen of the world, and use these flaws as teaching moments. * TODO weak typing * TODO too dynamic * TODO other bad practices * That string concatenation tho! Yeah, yeah `"2" + "2" === "22"`. But why are you concatenating strings anyway? Protip: students don’t mind string interpolation. * TODO we should learn C first because Yes JavaScript has flaws ## Can’t Other Languages Do What JavaScript Can Do? TODO