What programming languages do you teach?
Khan Academy teaches JavaScript,SQL, and Python. For markup and stylesheet languages see Which Markup and Stylesheet languages do you 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 in our “HTML/JS: Making web pages active with jQuery” we demonstrate how to include the jQuery library and use it for simplifying client-side scripting of HTML and particularly the DOM API.
For security and safety reasons, not all DOM 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 semicolons, 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 each other. 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.
*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 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 can be a difficult language for spelling, and we don’t want spelling errors to interfere with learning to program, so when we see that there’s a tag that we don’t understand in your code we check to see if it is close in spelling to something we do know about.
Python
In our “Intro to computer science - Python” curriculum, we teach a programming language called Python, walking through several fundamental Computer Science concepts, such as variables, strings, conditionals, loops, lists, functions, and more.
We use various tools to check that your written Python is valid and that there are no syntax errors before we run it. If we find something wrong, the platform will print an error message that describes the problem.