<commit_before>class: center middle

# Intro

## Awesomeness begins

---

What is programming?
====================

> Programming is making the machine do our bidding

The computer is an absolute slave: it does only and exactly what it's told, provided it's told in a language it understands.

---

Why do we program?
==================

Computers can do basic computations very fast (much faster than humans, billions per second). That's useful for:

- executing tedious tasks automatically ("booooring, let the machine do it")
	- counting words in a book
	- searching in databases
	- writing personalized email to a thousand people
	- solving sudoku
- solving problems that we know *how* to solve, but we never *actually* solved because it would take more than a lifetime
	- finding the billionth decimal of π
	- cracking cyphers

---

class: middle

![xkcd](https://imgs.xkcd.com/comics/automation.png)

---

Why do we program? (2)
==================

Computers also have interesting input/output devices, which give them access to "non-human" powers, and by extension, gives humans non-human powers:

- video games
- sound synthesis
- networking

Anything you can think of, you can program and *make it happen*. Through language you can make worlds appear and set them in motion.

---

class: middle

> I'm a god!!

---

What can't we program?
======================

Computers are very fast for very simple tasks, which can be combined is less simple tasks that are necessarily slower. Very complex or "unnatural" tasks are typically slow, if even possible. Brains are very parallel in nature, and some tasks that are trivial for a human being are typically hard for computers:

- recognizing shapes in a picture
- finding an object in a collection in an instant
- doing anything "intelligent"

If you can break up a problem in simple sub-problems, odds are you can write a program to solve it. Otherwise, you'll probably have to cheat.

---

How do we program?
==================

Basically, we tell the computer what to do. To "tell" we need to write. To write we need a common language.

A computer is a very weak minded being. If it understands what you tell it, it will do exactly as told. Therefore, to make the computer your slave, you first have to let *it* be your master and impose its language on you.

Which brings us to...

---

Programming languages
=====================

Wikipedia has a [list](http://en.wikipedia.org/wiki/List_of_programming_languages) of:

> all notable programming languages in existence, both those in current use and historical ones, in alphabetical order, except for dialects of BASIC and esoteric programming languages.

It's 644 items long. There are many way to categorize and compare these languages. Wikipedia's [list of programming languages by category](http://en.wikipedia.org/wiki/List_of_programming_languages_by_category) has 42 categories.

You can also sort them by family, which influenced which, which merged to give birth to others, etc.

So, where do we start?

---

General purpose languages
=========================

We want to make programs. Native desktop or mobile applications. For that we'll focus on general purpose languages. We can already remove:

- web oriented languages (JavaScript, PHP)
- scientific languages (MATLAB, R)
- application specific (VBA)

There are many programming paradigms, or philosophies behind the design of languages. Imperative, functional, object-oriented, concurrent, logic, etc. Not mutually exclusive!

*Imperative*: statements that change a program state ("do this, do that, if this then do that, etc.")

---

High level, low level
=====================

One of the many ways to measure and classify languages is "how close the the machine" they are.

At the lowest level:

- machine code (the *only* language a processor actually understands)
- assembly (machine code but in human readable form. Very difficult to write what you mean, very easy to make mistakes. Basically impossible to maintain.)

Higher (disguised assembly, plus bonuses to make life easier):

- C, C++ (compiled languages, quite verbose, strict syntax, still very lax in terms of memory safety, error prone, but have many higher level constructs that makes coding more "logical" and closer to thought processes)

---

High level, low level (2)
=====================

At the highest level (candy!):

- Python, Ruby, Lua (interpreted languages, concise syntaxes, very dynamic, they allow to do pretty much anything and it works, memory safe)

At first sight, why bother with lower languages, they seem horrible, while the higher level ones are dreamy? Speed. High level languages have more layers of things going on, taking care of all the things "behind the scene" for you, and that takes ressources. They can be as much as 10 times slower than low-level languages.

Compare solutions for the N-queens problem on [Rosetta Code](http://rosettacode.org/wiki/N-queens_problem).

---

High level, low level (3)
=====================

What's a good compromise?

- new modern languages try to combine efficiency of low-level languages with ease of use of higher level languages (D, Rust, Go). Still a work in progress.
- big projects combine and use different languages for different purposes. World of Warcraft is mainly in C++, with probably a bit of assembly for very speed critical code, and Lua for scripting and user interface.

---

Compiled vs. interpreted
========================

Compiled language:

- write source code
- give source code to compiler
- compiler converts source to machine code, thus creating a new program
- ask OS to run program
- machine code is loaded into memory, processor executes instructions directly

(C, C++, C#, D, Java, Rust, Go...)

---

Compiled vs. interpreted (2)
========================

Interpreted language ("scripting language"):

- write source code
- give source code to interpreter
- interpreter builds in memory a high-level representation of the source<commit_msg>Typos in Intro<commit_after>class: center middle

# Intro

## Awesomeness begins

---

What is programming?
====================

> Programming is making the machine do our bidding

The computer does only and exactly what it's told, provided it's told in a language it understands.

---

Why do we program?
==================

Computers can do basic computations very fast (much faster than humans, billions per second). That's useful for:

- executing tedious tasks automatically ("booooring, let the machine do it")
	- counting words in a book
	- searching in databases
	- writing personalized email to a thousand people
	- solving sudoku
- solving problems that we know *how* to solve, but we never *actually* solved because it would take more than a lifetime
	- finding the billionth decimal of π
	- cracking cyphers

---

class: middle

![xkcd](https://imgs.xkcd.com/comics/automation.png)

---

Why do we program? (2)
==================

Computers also have interesting input/output devices, which give them access to "non-human" powers, and by extension, gives humans non-human powers:

- video games
- sound synthesis
- networking

Anything you can think of, you can program and *make it happen*. Through language you can make worlds appear and set them in motion.

---

class: middle

> I'm a god!!

---

What can't we program?
======================

Computers are very fast for very simple tasks, which can be combined is less simple tasks that are necessarily slower. Very complex or "unnatural" tasks are typically slow, if even possible. Brains are very parallel in nature, and some tasks that are trivial for a human being are typically hard for computers:

- recognizing shapes in a picture
- finding an object in a collection in an instant
- doing anything "intelligent"

If you can break up a problem in simple sub-problems, odds are you can write a program to solve it. Otherwise, you'll probably have to cheat.

---

How do we program?
==================

Basically, we tell the computer what to do. To "tell" we need to write. To write we need a common language.

A computer is a very weak minded being. If it understands what you tell it, it will do exactly as told. Therefore, to make the computer your slave, you first have to let *it* be your master and impose its language on you.

Which brings us to...

---

Programming languages
=====================

Wikipedia has a [list](http://en.wikipedia.org/wiki/List_of_programming_languages) of:

> all notable programming languages in existence, both those in current use and historical ones, in alphabetical order, except for dialects of BASIC and esoteric programming languages.

It's 644 items long. There are many way to categorize and compare these languages. Wikipedia's [list of programming languages by category](http://en.wikipedia.org/wiki/List_of_programming_languages_by_category) has 42 categories.

You can also sort them by family, which influenced which, which merged to give birth to others, etc.

So, where do we start?

---

General purpose languages
=========================

We want to make programs. Native desktop or mobile applications. For that we'll focus on general purpose languages. We can already remove:

- web oriented languages (JavaScript, PHP)
- scientific languages (MATLAB, R)
- application specific (VBA)

There are many programming paradigms, or philosophies behind the design of languages. Imperative, functional, object-oriented, concurrent, logic, etc. Not mutually exclusive!

*Imperative*: statements that change a program state ("do this, do that, if this then do that, etc.")

---

High level, low level
=====================

One of the many ways to measure and classify languages is "how close the the machine" they are.

At the lowest level:

- machine code (the *only* language a processor actually understands)
- assembly (machine code but in human readable form. Very difficult to write what you mean, very easy to make mistakes. Basically impossible to maintain.)

Higher (disguised assembly, plus bonuses to make life easier):

- C, C++ (compiled languages, quite verbose, strict syntax, still very lax in terms of memory safety, error prone, but have many higher level constructs that makes coding more "logical" and closer to thought processes)

---

High level, low level (2)
=====================

At the highest level (candy!):

- Python, Ruby, Lua (interpreted languages, concise syntaxes, very dynamic, they allow to do pretty much anything and it works, memory safe)

At first sight, why bother with lower languages, they seem horrible, while the higher level ones are dreamy? Speed. High level languages have more layers of things going on, taking care of all the things "behind the scene" for you, and that takes ressources. They can be as much as 10 times slower than low-level languages.

Compare solutions for the N-queens problem on [Rosetta Code](http://rosettacode.org/wiki/N-queens_problem).

---

High level, low level (3)
=====================

What's a good compromise?

- new modern languages try to combine efficiency of low-level languages with ease of use of higher level languages (D, Rust, Go). Still a work in progress.
- big projects combine and use different languages for different purposes. World of Warcraft is mainly in C++, with probably a bit of assembly for very speed critical code, and Lua for scripting and user interface.

---

Compiled vs. interpreted
========================

Compiled language:

- write source code
- give source code to compiler
- compiler converts source to machine code, thus creating a program
- ask OS to run program
- machine code is loaded into memory, processor executes instructions directly

(C, C++, C#, D, Rust, Go...)

---

Compiled vs. interpreted (2)
========================

Interpreted language ("scripting language"):

- write source code
- give source code to interpreter
- interpreter builds in memory a high-level representation of the source
{'fraction_non_alphanumeric': 0.10336739822415815, 'fraction_numerical': 0.0018428547495392862, 'mean_word_length': 4.278072502210433, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1935668', 'n_tokens_mistral': 3086, 'n_tokens_neox': 2915, 'n_words': 1682}