Follow

What programming languages do you teach?

Khan Academy teaches JavaScript and SQL. For markup- and stylesheet languages see Which Markup- and Stylesheet languages do your teach?

 

Javascript

In our “Drawing & Animation” curriculum, we teach a programming language called JavaScript, and we teach all of the basics of the JavaScript language: variables, strings, arrays, functions, loops, objects. We also include an additional library in our programming environment called ProcessingJS, and that is where we get the drawing & animation functionality from - functions like “rect()”, “ellipse()”, “fill()”, etc.

Additionally, in our “HTML/JS: Making web pages interactive” we include the DOM (Document Object Model) for access methods, modification, events, animation and using JP libraries, and in our

HTML/JS: Making web pages active with jQuery” we include some parts of the jQuery library for simplifying client side scripting of HTML and particularly the DOM API.

For security and safety reasons not all DOM or jQuery manipulations are allowed on Khan Academy.

 

We use various tools* to check that your written JavaScript code is valid before we run it. If we find something wrong, we throw an error message that describes the problem. For example, those tools check for:

  • Syntax errors: These are when the JS interpreter does not understand your code at all - like if you wrote “var bla = [ };”, it would get very confused by the mismatched braces and give up trying to turn it into code.
  • Best practices: There are some parts of JS syntax that are optional, like ending your statements with semi-colons, but it is considered a “best practice” to use semi-colons because it makes your code less likely to be buggy, therefore we enforce that all our code uses semi-colons.
  • Conventions: Since JS is a very flexible language and lets you write the same things in multiple ways, we enforce certain conventions to improve the consistency of the code in our community, to make it easier to learn from eachother. For example, JS lets you declare functions like “function funcName(){}” or “var funcName = function(){}”, but our environment only allows the latter.
  • # of Arguments: JS actually allows code to call functions with any number of arguments, but we see that it can be confusing when, for example, you call a function with 3 parameters instead of 4, and it doesn’t do what you expect. So we have a tool that knows how many arguments are expected in ProcessingJS functions like rect(), and we output an error if we see you’ve used a different number of arguments than expected.
  • Spelling errors: English is a hard to spell language, and we don’t want spelling errors to interfere with learning to program, so when we see that there’s a function or variable name that we don’t understand in your program, we check if it’s close in spelling to something we do know about.

Esprima, JSHint, Pamela Fox’s supplemental BabyHint library (https://gist.github.com/pamelafox/7745401)

 

SQL

In our “Intro to SQL: Querying and managing data” we teach the basics of a programming language designed for managing data in a relational database: SQL or Structured Query Language, in the form of the dialect SQlite. The intro goes through Creating tables, Inserting data, Querying data, Aggregating data, Joining tables and Updating and deleting data.

We use various tools to check that your written SQL is valid before we run it. If we find something wrong, we throw an error message that describes the problem. For example, those tools check for: 

  • Syntax errors: These are when the SQL interpreter does not understand your code at all - like if you wrote “CREATE TABLE groceries()” and no more, it would get very confused by lack of column names and data types and give up trying to turn it into code
  • Spelling errors: English is a hard to spell language, and we don’t want spelling errors to interfere with learning to program, so when we see that there’s a command or variable that we don’t understand in your program, we check if it’s close in spelling to something we do know about.

 

Last edited 05.24.2017

Was this article helpful?
49 out of 52 found this helpful
Have more questions? Submit a request

Comments