﻿WEBVTT

00:00:00.040 --> 00:00:02.880 align:middle
This will be an overview
of the syntax.

00:00:03.040 --> 00:00:06.240 align:middle
We'll show you
the entirety of the syntax...

00:00:06.400 --> 00:00:09.440 align:middle
Don't get stressed
if you don't understand it completely.

00:00:09.600 --> 00:00:11.400 align:middle
We'll go over it all again.

00:00:11.560 --> 00:00:15.360 align:middle
The idea is to show you
all there is in Pharo.

00:00:16.040 --> 00:00:20.000 align:middle
We're going to look
at the main syntactical elements.

00:00:20.160 --> 00:00:22.760 align:middle
We'll see that there are
3 kinds of messages.

00:00:22.920 --> 00:00:25.280 align:middle
And well look at block syntax,

00:00:25.440 --> 00:00:27.440 align:middle
an essential part of Pharo.

00:00:27.600 --> 00:00:32.000 align:middle
Don't worry if you don't get it all,
we'll repeat all the points.

00:00:33.120 --> 00:00:37.320 align:middle
Just to remind you,
you have all the syntax on this slide.

00:00:37.480 --> 00:00:40.040 align:middle
I can go into the details a bit now.

00:00:40.200 --> 00:00:43.960 align:middle
Here's a method definition,
exampleWithNumber.

00:00:44.120 --> 00:00:46.120 align:middle
And it has an argument.

00:00:46.360 --> 00:00:51.040 align:middle
I have local variable definitions
with vertical bars.

00:00:51.200 --> 00:00:54.040 align:middle
I have the return,
which lets me give a value.

00:00:54.200 --> 00:00:57.400 align:middle
I have loops, an affectation...

00:00:57.560 --> 00:01:01.640 align:middle
The period, for example,
is an instruction separator.

00:01:03.120 --> 00:01:05.600 align:middle
We'll look at all this.

00:01:07.040 --> 00:01:10.080 align:middle
We'll start
with the traditional Hello World.

00:01:10.240 --> 00:01:12.000 align:middle
Here, if you like...

00:01:12.160 --> 00:01:16.400 align:middle
You can execute all instructions
in Pharo yourself

00:01:16.560 --> 00:01:18.360 align:middle
to see what the result is.

00:01:18.520 --> 00:01:21.440 align:middle
So here I have a string,

00:01:21.840 --> 00:01:25.880 align:middle
which I convert into a morph,
a graphic element,

00:01:26.040 --> 00:01:29.640 align:middle
and I ask it
to open in a window.

00:01:29.840 --> 00:01:33.320 align:middle
So I send asMorph
to the string object.

00:01:33.480 --> 00:01:36.080 align:middle
And I send openInWindow

00:01:36.240 --> 00:01:37.920 align:middle
to the resulting morph.

00:01:38.080 --> 00:01:41.480 align:middle
So we have two message sends
and one string object.

00:01:42.520 --> 00:01:43.960 align:middle
A more complicated example.

00:01:44.120 --> 00:01:47.920 align:middle
Imagine you want to take
the Pharo logo from the web.

00:01:48.280 --> 00:01:50.800 align:middle
Well, you do it this way.

00:01:50.960 --> 00:01:56.840 align:middle
You do ZnEasy getPng:
with a string which represents the URL

00:01:57.000 --> 00:02:00.000 align:middle
of the resource you want to read.

00:02:00.160 --> 00:02:04.440 align:middle
And once again you convert it
into a graphic object

00:02:04.600 --> 00:02:06.760 align:middle
and ask it to open in a window.

00:02:06.920 --> 00:02:09.200 align:middle
So we see that ZnEasy is a class

00:02:09.360 --> 00:02:12.480 align:middle
because classes start with a capital.

00:02:12.640 --> 00:02:17.800 align:middle
The colon of the message getPng:
means I'm expecting an argument,

00:02:17.960 --> 00:02:22.120 align:middle
which is the string
http://pharo.org.

00:02:22.280 --> 00:02:27.120 align:middle
This string is the argument
of the method getPng:

00:02:28.280 --> 00:02:32.520 align:middle
The messages asMorph
and openInWindow

00:02:32.680 --> 00:02:35.400 align:middle
are read from left to right.

00:02:35.800 --> 00:02:38.640 align:middle
So you can cut'n'paste this code

00:02:38.800 --> 00:02:41.000 align:middle
or retype it in Pharo,

00:02:41.160 --> 00:02:43.760 align:middle
and you'll get the Pharo logo.

00:02:43.920 --> 00:02:47.200 align:middle
So what syntactical elements
are there in Pharo?

00:02:47.360 --> 00:02:50.680 align:middle
You have comments, which start
with double quotation marks.

00:02:50.840 --> 00:02:52.200 align:middle
That's a comment.

00:02:52.360 --> 00:02:55.840 align:middle
Characters are always preceded
by a dollar sign.

00:02:56.000 --> 00:02:58.080 align:middle
$A is the character A.

00:02:58.240 --> 00:03:02.280 align:middle
Strings start and finish
with a single quotation mark.

00:03:03.400 --> 00:03:05.920 align:middle
You have symbols,
which are unique strings.

00:03:06.080 --> 00:03:10.320 align:middle
These begin like this,
with the hashtag.

00:03:10.480 --> 00:03:12.840 align:middle
#a is the symbol a.

00:03:13.000 --> 00:03:14.600 align:middle
There are literal arrays.

00:03:14.760 --> 00:03:19.200 align:middle
Here I have one with 12, 23 and 36.
Three elements.

00:03:19.560 --> 00:03:22.280 align:middle
Integers have various representations,

00:03:22.440 --> 00:03:24.600 align:middle
but we won't dwell on this.

00:03:24.760 --> 00:03:27.360 align:middle
We usually use representations
in base 10.

00:03:27.520 --> 00:03:30.240 align:middle
But if you want one in base 2,
that's OK.

00:03:30.400 --> 00:03:32.760 align:middle
You have reals.
This is the same.

00:03:32.920 --> 00:03:35.200 align:middle
You can find the syntax if you need.

00:03:35.360 --> 00:03:38.080 align:middle
You have booleans,
with true and false.

00:03:38.240 --> 00:03:39.800 align:middle
You have undefined.

00:03:39.960 --> 00:03:43.640 align:middle
The null of Java is nil in Pharo.

00:03:43.800 --> 00:03:47.200 align:middle
It's an instance
of the class UndefinedObject.

00:03:47.480 --> 00:03:49.320 align:middle
And you have points.

00:03:49.480 --> 00:03:52.720 align:middle
This is described in Pharo
under the form

00:03:52.880 --> 00:03:56.440 align:middle
of 10 @ 200, for example.

00:03:56.600 --> 00:03:59.880 align:middle
So I'm creating the point 10,
which is 10 on the x,

00:04:00.040 --> 00:04:02.440 align:middle
and 200 on the y.

00:04:03.680 --> 00:04:07.040 align:middle
So we've seen the essential elements
for the syntax.

00:04:07.200 --> 00:04:09.840 align:middle
Now we have the constructs
of the language.

00:04:10.000 --> 00:04:13.040 align:middle
You have
temporary variable declaration.

00:04:13.200 --> 00:04:16.200 align:middle
It's a vertical bar
followed by another vertical bar.

00:04:16.360 --> 00:04:19.320 align:middle
Assignment
is a colon and an equal sign.

00:04:19.480 --> 00:04:22.520 align:middle
In the variable var I put aValue.

00:04:22.720 --> 00:04:24.640 align:middle
I have messages in my system.

00:04:24.800 --> 00:04:26.280 align:middle
How do I separate them?

00:04:26.440 --> 00:04:28.240 align:middle
With a period.

00:04:28.400 --> 00:04:30.760 align:middle
When I want a sequence of messages.

00:04:30.920 --> 00:04:32.000 align:middle
There's return,

00:04:32.160 --> 00:04:34.560 align:middle
where a function or method
gives a value.

00:04:34.720 --> 00:04:39.520 align:middle
I use the little hat,
which is called caret in English.

00:04:39.680 --> 00:04:41.200 align:middle
Then you have blocks,

00:04:41.360 --> 00:04:45.760 align:middle
which, technically speaking,
are lexical closures,

00:04:46.480 --> 00:04:49.840 align:middle
and which you can take
as anonymous methods.

00:04:50.000 --> 00:04:53.120 align:middle
I'll show you what a block is.

00:04:53.280 --> 00:04:55.880 align:middle
It's defined with square brackets.

00:04:56.680 --> 00:04:59.560 align:middle
And it's executed
with the message value.

00:04:59.720 --> 00:05:01.160 align:middle
We'll look at this.

00:05:01.320 --> 00:05:03.960 align:middle
There you have all the constructs.

00:05:05.240 --> 00:05:08.520 align:middle
So what is the essence
of a Pharo program?

00:05:08.680 --> 00:05:12.240 align:middle
It's creating objects
by using messages,

00:05:12.400 --> 00:05:14.320 align:middle
sending messages to these objects,

00:05:14.480 --> 00:05:17.280 align:middle
and, now and then,
using blocks, or anonymous methods.

00:05:17.440 --> 00:05:18.680 align:middle
That's all.

00:05:19.800 --> 00:05:23.080 align:middle
There are three types
of message in Pharo. Why?

00:05:23.240 --> 00:05:26.560 align:middle
In order to minimize
the number of parentheses used.

00:05:26.720 --> 00:05:28.320 align:middle
It's fairly simple.

00:05:28.480 --> 00:05:32.360 align:middle
A unary message
is always a receiver and a selector.

00:05:32.520 --> 00:05:35.480 align:middle
Here for example I've said
that I want 9 squared.

00:05:35.640 --> 00:05:37.680 align:middle
I want today's date.

00:05:37.840 --> 00:05:41.480 align:middle
I send the message today
to the class Date.

00:05:41.960 --> 00:05:43.800 align:middle
There's no argument.

00:05:43.960 --> 00:05:46.080 align:middle
Then there's the binary message,

00:05:46.240 --> 00:05:50.800 align:middle
which also takes the form
of a receiver, selector and argument.

00:05:51.160 --> 00:05:52.640 align:middle
But the selector will be

00:05:52.800 --> 00:05:57.320 align:middle
plus, minus, tilde, equals, slash...
That sort of thing.

00:05:57.480 --> 00:06:01.080 align:middle
All those mathematical signs
are for binary messages.

00:06:01.360 --> 00:06:04.560 align:middle
Here we see 1+2.
This is a message.

00:06:04.720 --> 00:06:08.080 align:middle
Sending message + to object 1
with argument object 2.

00:06:08.240 --> 00:06:11.240 align:middle
@ for the creation of a point
is also a message,

00:06:11.400 --> 00:06:12.760 align:middle
a binary message.

00:06:12.920 --> 00:06:16.160 align:middle
Here I create the point 3@4

00:06:16.320 --> 00:06:18.640 align:middle
by sending the message @.

00:06:18.800 --> 00:06:22.200 align:middle
Then you have
what we call keyword messages.

00:06:22.360 --> 00:06:24.920 align:middle
A keyword message takes the form

00:06:25.080 --> 00:06:28.840 align:middle
of receiver key1: arg1 key2: arg2.

00:06:29.000 --> 00:06:31.440 align:middle
So the example is...

00:06:31.600 --> 00:06:34.720 align:middle
is 2 between 10 and 20

00:06:35.000 --> 00:06:38.760 align:middle
If you wrote it in Java or C
it would be like this...

00:06:39.000 --> 00:06:44.320 align:middle
You'd write betweenAnd...

00:06:44.480 --> 00:06:48.920 align:middle
Then, between brackets,
you'd write (10, 20).

00:06:49.080 --> 00:06:53.720 align:middle
In Pharo you express it
in the form of key and key.

00:06:53.880 --> 00:06:57.520 align:middle
We'll look at this again, but it gives
you an idea of the syntax.

00:06:58.800 --> 00:07:02.680 align:middle
There's a precedence
between messages,

00:07:02.840 --> 00:07:06.480 align:middle
the system will execute in priority
the parentheses,

00:07:06.640 --> 00:07:09.200 align:middle
then the unary,
binary and keyword messages.

00:07:09.360 --> 00:07:10.160 align:middle
Why?

00:07:10.320 --> 00:07:13.560 align:middle
To avoid writing too many parentheses.

00:07:13.720 --> 00:07:17.880 align:middle
We could have had a system
with parentheses all over the place,

00:07:18.040 --> 00:07:20.000 align:middle
but the code would be illegible.

00:07:20.960 --> 00:07:24.680 align:middle
I'll go back over each type of message
in a simple way.

00:07:24.840 --> 00:07:27.680 align:middle
This unary message, 10000 factorial.

00:07:27.840 --> 00:07:30.160 align:middle
Try it, it's a very big number.

00:07:30.320 --> 00:07:33.640 align:middle
I send the message factorial
to the object 10000.

00:07:33.800 --> 00:07:36.240 align:middle
There's no argument,
it's a unary message.

00:07:36.880 --> 00:07:41.840 align:middle
Similarly, a binary message.
1+3 is a message, a binary message.

00:07:42.000 --> 00:07:46.720 align:middle
The selector,
the name of the method, is +.

00:07:47.360 --> 00:07:52.040 align:middle
I send the message + to the object 1
with the object 3 as argument.

00:07:53.120 --> 00:07:55.960 align:middle
A keyword message,
as I explained earlier...

00:07:56.120 --> 00:08:00.360 align:middle
I'll just tell you again.
Teaching is all about repetition.

00:08:00.800 --> 00:08:04.520 align:middle
I have a keyword message
with keyword and keyword,

00:08:04.680 --> 00:08:07.560 align:middle
which is the message,
with the arguments,

00:08:07.720 --> 00:08:11.080 align:middle
which are floating inside the message.

00:08:11.240 --> 00:08:14.680 align:middle
The idea is to have a syntax
that children can use

00:08:14.840 --> 00:08:18.320 align:middle
and to have something
close to English.

00:08:18.480 --> 00:08:24.280 align:middle
So you can introduce the arguments
inside your messages.

00:08:25.440 --> 00:08:29.120 align:middle
As an example, imagine
I'm sending an HTTP request.

00:08:29.280 --> 00:08:32.880 align:middle
ZnClient is a Pharo HTTP server.

00:08:33.040 --> 00:08:35.880 align:middle
So I create an instance of Zn server.

00:08:36.040 --> 00:08:40.680 align:middle
So new is a unary message,
there's no argument, no colon.

00:08:41.560 --> 00:08:46.720 align:middle
url is a keyword message,
there's a colon.

00:08:46.880 --> 00:08:49.880 align:middle
queryAt: put:
is another message.

00:08:50.040 --> 00:08:52.600 align:middle
It's another keyword message.

00:08:52.760 --> 00:08:54.880 align:middle
And get is a unary message.

00:08:55.360 --> 00:08:59.400 align:middle
What we can also see
in this example are semi-colons.

00:08:59.760 --> 00:09:02.120 align:middle
We call this a cascade,

00:09:02.880 --> 00:09:05.800 align:middle
which sends all the messages
to the same object.

00:09:05.960 --> 00:09:08.920 align:middle
You don't need
a temporary variable.

00:09:09.080 --> 00:09:12.320 align:middle
And you can write more compact code.

00:09:13.720 --> 00:09:17.080 align:middle
You have to understand
that messages are everywhere.

00:09:17.240 --> 00:09:20.880 align:middle
Conditionals, loops, iterators and
concurrency are expressed as messages.

00:09:21.040 --> 00:09:23.480 align:middle
My explanation
about those three messages

00:09:23.640 --> 00:09:25.560 align:middle
applies across the board.

00:09:25.720 --> 00:09:27.760 align:middle
It's the cornerstone of the system.

00:09:27.920 --> 00:09:31.000 align:middle
There's nothing other
than these messages.

00:09:31.520 --> 00:09:32.880 align:middle
Let's have a look.

00:09:33.040 --> 00:09:35.520 align:middle
I've taken
the silly factorial definition here.

00:09:35.680 --> 00:09:37.200 align:middle
How do I define it?

00:09:37.360 --> 00:09:40.160 align:middle
I define my method factorial.

00:09:40.320 --> 00:09:43.840 align:middle
I put a comment for the method.
Double quotation marks.

00:09:44.000 --> 00:09:45.360 align:middle
And I start with self.

00:09:45.520 --> 00:09:47.560 align:middle
If the object
getting the message is zero,

00:09:47.720 --> 00:09:49.600 align:middle
then I'll give 1.

00:09:49.760 --> 00:09:51.320 align:middle
If self is positive,

00:09:51.480 --> 00:09:55.160 align:middle
for example, factorial 6,
self equals 6...

00:09:55.480 --> 00:09:58.120 align:middle
If this is true
than what will I give?

00:09:58.280 --> 00:10:01.520 align:middle
6 multiplied by 6 minus 1 factorial.

00:10:01.680 --> 00:10:04.920 align:middle
The recursive definition we all know.
And that's that.

00:10:05.080 --> 00:10:08.120 align:middle
And the interesting thing to note here

00:10:08.280 --> 00:10:10.440 align:middle
is that ifTrue:, which is a condition,

00:10:10.600 --> 00:10:13.720 align:middle
is also a message,
a keyword message with a colon,

00:10:13.880 --> 00:10:15.320 align:middle
sent to a boolean.

00:10:15.480 --> 00:10:18.800 align:middle
You also have ifFalse:ifTrue:,
ifTrue:ifFalse:...

00:10:18.960 --> 00:10:21.440 align:middle
All these conditions are messages

00:10:21.600 --> 00:10:23.320 align:middle
which satisfy the rules,

00:10:23.480 --> 00:10:28.680 align:middle
and are keyword messages
like I presented earlier.

00:10:29.080 --> 00:10:30.960 align:middle
So conditions are messages.

00:10:31.120 --> 00:10:32.960 align:middle
Loops are messages too.

00:10:33.120 --> 00:10:35.160 align:middle
Here I'll make a loop from 1 to 4.

00:10:35.320 --> 00:10:37.840 align:middle
From 1 to 4, what do I do?

00:10:38.000 --> 00:10:40.080 align:middle
A block.
An anonymous method.

00:10:40.240 --> 00:10:45.360 align:middle
Here I'm saying I want it
to show the value of i,

00:10:45.520 --> 00:10:50.320 align:middle
and i will take the value
of 1, 2, 3, 4...

00:10:50.480 --> 00:10:53.840 align:middle
And there you can see that to: do:

00:10:54.000 --> 00:10:56.280 align:middle
is a keyword message.

00:10:56.520 --> 00:10:59.960 align:middle
It's a message
that takes the form of a loop.

00:11:00.120 --> 00:11:03.360 align:middle
There are other loops in Pharo:
timesRepeat:, to:by:do: and so on.

00:11:03.520 --> 00:11:05.360 align:middle
We'll look at them all.

00:11:05.520 --> 00:11:07.520 align:middle
But, again, these are messages...

00:11:07.680 --> 00:11:11.440 align:middle
So here, to: do: is sent to object 1
with 4 as parameter and a block.

00:11:11.600 --> 00:11:14.600 align:middle
We'll see what a block is very soon.

00:11:14.760 --> 00:11:16.480 align:middle
You also have iterators.

00:11:16.640 --> 00:11:18.440 align:middle
Iterators are different.

00:11:18.600 --> 00:11:21.040 align:middle
I send the message do:

00:11:21.200 --> 00:11:22.360 align:middle
to the collection,

00:11:22.520 --> 00:11:25.680 align:middle
saying what I want to apply
to each of the elements.

00:11:25.840 --> 00:11:29.320 align:middle
So the each,
the argument of my function,

00:11:29.480 --> 00:11:34.440 align:middle
will take as value
1, 2, -4 and -86.

00:11:34.600 --> 00:11:36.960 align:middle
And what I do here
is that the each...

00:11:38.440 --> 00:11:40.800 align:middle
I apply the absolute value
and display it.

00:11:40.960 --> 00:11:43.840 align:middle
Once again,
this will be another course.

00:11:44.000 --> 00:11:45.720 align:middle
We'll explain iterators.

00:11:45.880 --> 00:11:48.640 align:middle
Iterators are something
you get in Java 8.

00:11:50.280 --> 00:11:53.240 align:middle
And they're part of the core of Pharo.

00:11:54.280 --> 00:11:55.760 align:middle
So what is a block?

00:11:55.920 --> 00:11:57.680 align:middle
Blocks look like functions.

00:11:57.840 --> 00:12:01.320 align:middle
If in maths you wrote f(x) = x²+3,

00:12:01.480 --> 00:12:03.920 align:middle
you'd write it like this, literally.

00:12:04.440 --> 00:12:07.320 align:middle
I define a variable
in which I affect a block.

00:12:07.480 --> 00:12:10.520 align:middle
A block is something
inside square brackets.

00:12:10.680 --> 00:12:13.160 align:middle
Here, the block has an argument
which is x.

00:12:13.520 --> 00:12:16.640 align:middle
And I put a core, which is x+3.

00:12:16.800 --> 00:12:18.600 align:middle
And when I want
to execute this block...

00:12:18.760 --> 00:12:20.880 align:middle
The application of the function.

00:12:21.040 --> 00:12:24.600 align:middle
That's the definition of the function,
now I have the application.

00:12:24.760 --> 00:12:30.360 align:middle
I send the message value:
to the block. I put value: 2.

00:12:31.520 --> 00:12:35.080 align:middle
x is 2,
so my block will give me 5.

00:12:35.520 --> 00:12:36.680 align:middle
OK?

00:12:36.960 --> 00:12:41.560 align:middle
So what's a block? It's a kind
of anonymous function, it has no name.

00:12:41.960 --> 00:12:46.160 align:middle
In fact, it's a lexical closure.

00:12:46.320 --> 00:12:48.240 align:middle
We'll explain that.

00:12:48.400 --> 00:12:50.360 align:middle
Blocks are real objects.

00:12:50.520 --> 00:12:54.440 align:middle
They can be passed as method
arguments, stored in variables,

00:12:54.600 --> 00:12:55.720 align:middle
returned...

00:12:55.880 --> 00:12:58.600 align:middle
So they can be used
as button triggers,

00:12:58.760 --> 00:13:02.960 align:middle
as callbacks in web applications...
These can be blocks.

00:13:04.480 --> 00:13:06.560 align:middle
We've already seen block usage.

00:13:06.720 --> 00:13:08.800 align:middle
In iterators you have blocks.

00:13:08.960 --> 00:13:11.680 align:middle
We saw blocks were used
in conditions.

00:13:11.840 --> 00:13:13.600 align:middle
There'll be a course about blocks.

00:13:13.840 --> 00:13:16.440 align:middle
It's elegant,
it was introduced in Eiffel,

00:13:16.600 --> 00:13:19.200 align:middle
it was recently introduced in Java 8,

00:13:19.360 --> 00:13:21.800 align:middle
there was a first version in C#...

00:13:21.960 --> 00:13:23.200 align:middle
So it's fundamental.

00:13:23.360 --> 00:13:26.320 align:middle
Blocks are a fundamental element

00:13:26.480 --> 00:13:30.400 align:middle
of Pharo's syntax
and computational model.

00:13:30.720 --> 00:13:33.600 align:middle
How do we define a class in Pharo?

00:13:33.760 --> 00:13:37.480 align:middle
The browser you see here
shows you packages.

00:13:37.640 --> 00:13:39.960 align:middle
You have the classes inside.

00:13:40.120 --> 00:13:41.600 align:middle
And it shows you a template.

00:13:41.760 --> 00:13:45.240 align:middle
The template is saying that
by default you inherit an object,

00:13:45.400 --> 00:13:47.480 align:middle
and the name of the class.

00:13:47.640 --> 00:13:51.160 align:middle
We'll see it for the class Point,
for example.

00:13:51.320 --> 00:13:53.360 align:middle
So the definition of the class...

00:13:53.520 --> 00:13:56.840 align:middle
I have the class object.
It's also a message!

00:13:57.000 --> 00:13:59.680 align:middle
The message subclass:
InstanceVariableNames:

00:13:59.840 --> 00:14:01.160 align:middle
blah blah blah...

00:14:01.320 --> 00:14:02.160 align:middle
With...

00:14:02.320 --> 00:14:04.960 align:middle
I define the class Point,

00:14:05.120 --> 00:14:07.920 align:middle
and I give the instance variables
x and y.

00:14:08.080 --> 00:14:13.640 align:middle
That's just to show the syntax always
follows the same model with messages.

00:14:13.800 --> 00:14:16.680 align:middle
You don't usually write it out
by hand.

00:14:16.840 --> 00:14:20.960 align:middle
The tool gives you the template
and you just fill it in.

00:14:22.680 --> 00:14:24.480 align:middle
So how do we define a method?

00:14:24.640 --> 00:14:27.400 align:middle
As I said, the methods
are public and virtual,

00:14:27.560 --> 00:14:29.240 align:middle
and by default return self.

00:14:29.400 --> 00:14:31.720 align:middle
So, when you're in the browser,

00:14:31.880 --> 00:14:34.120 align:middle
it suggests a template,

00:14:34.280 --> 00:14:37.160 align:middle
the name of the potential method
and a comment...

00:14:37.320 --> 00:14:41.800 align:middle
We're nice and polite
so we comment on our code.

00:14:41.960 --> 00:14:46.800 align:middle
We can also put temporary
variable names and statements.

00:14:46.960 --> 00:14:50.360 align:middle
What does this gives us?
We've seen the method factorial.

00:14:50.520 --> 00:14:53.040 align:middle
Here I'm in the class Integer.

00:14:53.200 --> 00:14:56.400 align:middle
I look at the method factorial,
I have its code,

00:14:56.560 --> 00:14:59.000 align:middle
with the name of the method,
its comment

00:14:59.160 --> 00:15:02.040 align:middle
and the core of the method
that I've defined.

00:15:03.840 --> 00:15:05.840 align:middle
So, to sum up, what have we seen?

00:15:06.000 --> 00:15:09.560 align:middle
There are 3 kinds of messages:
unary messages, without arguments,

00:15:09.720 --> 00:15:12.760 align:middle
binary messages,
where the selectors are mathematical,

00:15:12.920 --> 00:15:17.000 align:middle
and keyword messages,
where there can be several arguments.

00:15:17.160 --> 00:15:20.720 align:middle
There's a priority:
parentheses first,

00:15:20.880 --> 00:15:23.080 align:middle
then unary, binary and keyword.

00:15:23.240 --> 00:15:27.360 align:middle
And if there are same-level messages
it's from left to right.

00:15:27.600 --> 00:15:30.920 align:middle
What have we seen?
The syntax is very compact.

00:15:31.160 --> 00:15:35.040 align:middle
There are few constructs
but they're really expressive.

00:15:35.200 --> 00:15:39.480 align:middle
It's mainly messages
and lexical closures, or blocks.

00:15:39.640 --> 00:15:42.400 align:middle
There are three kinds of messages.

00:15:42.560 --> 00:15:45.160 align:middle
You'll do an exercise
to develop a language.

00:15:45.320 --> 00:15:49.200 align:middle
Like that you can define what we call
Domain Specific Languages.