Pharo, an innovative and open-source Smalltalk
-
Upload
serge-stinckwich -
Category
Education
-
view
3.839 -
download
1
Transcript of Pharo, an innovative and open-source Smalltalk
![Page 2: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/2.jpg)
1 Smalltalk Syntax
Smalltalk object model
Pharo, an open-source Smalltalk
2
3
![Page 3: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/3.jpg)
Smalltalk syntax1
![Page 4: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/4.jpg)
What are the keywords ?
How do you build expressions ?
![Page 5: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/5.jpg)
Almost no keywords
![Page 6: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/6.jpg)
Syntax for litterals
1 -10 30
3.14156 1e-10 -1.4e4
$A $z
‘Hello World’
#(1 2 3 4 5)
![Page 7: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/7.jpg)
“A comment is a sequence of characters surrounded by
quotation marks.”
![Page 8: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/8.jpg)
Assignement
x := 3.y := ‘Hello world’.z := x+4.
![Page 9: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/9.jpg)
6 pseudo-variables
nil, true, false
self, super, thisContext
![Page 10: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/10.jpg)
Everything happensby message sending
![Page 11: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/11.jpg)
(1) Unary message
![Page 12: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/12.jpg)
receiver message.
![Page 13: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/13.jpg)
20 factorial
![Page 14: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/14.jpg)
2432902008176640000
![Page 15: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/15.jpg)
‘Esope reste et se repose’reversed
![Page 16: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/16.jpg)
‘esoper es te etser eposE’
![Page 17: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/17.jpg)
‘12345’ isAllDigits
![Page 18: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/18.jpg)
true
![Page 19: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/19.jpg)
‘Quelle est ma longueur ?’ size
![Page 20: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/20.jpg)
23
![Page 21: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/21.jpg)
‘foobar’ first
![Page 22: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/22.jpg)
$f
![Page 23: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/23.jpg)
(2) Binary Messages
![Page 24: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/24.jpg)
aReceiver aSelector anArgument
![Page 25: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/25.jpg)
3 + 4
![Page 26: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/26.jpg)
7
![Page 27: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/27.jpg)
‘Bonjour ’, ‘monde’
![Page 28: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/28.jpg)
‘Bonjour monde’
![Page 29: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/29.jpg)
2@3
![Page 30: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/30.jpg)
2@3
![Page 31: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/31.jpg)
(3) Keywords Messages
![Page 32: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/32.jpg)
12 between: 8 and:15.
![Page 33: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/33.jpg)
8 < 12 < 15 ?
![Page 34: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/34.jpg)
true
![Page 35: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/35.jpg)
#(1 4 9 16 25) at: 3
![Page 36: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/36.jpg)
9
![Page 37: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/37.jpg)
aString.substring(2, 5) aString copyFrom: 2 to: 5
new ColorValue(a, b, c) ColorValue hue: a saturation: b value: c
new DateAndTime(a, b, c) DateAndTime year: a day: b timeZone: c
Easier to document the semantic roleof arguments with keywords messages.
![Page 38: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/38.jpg)
(Msg) > Unary > Binary > Keywords
![Page 39: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/39.jpg)
Messages cascading
![Page 40: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/40.jpg)
myBirthday := Date new.
myBirthDay setYear: 1967. myBirthDay setMonth: 5.myBirthDay setDayOfMonth: 10.
![Page 41: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/41.jpg)
myBirthday := Date new; setYear: 1967; setMonth: 5; setDayOfMonth: 10.
![Page 42: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/42.jpg)
TheEnd
![Page 43: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/43.jpg)
if ... then ... else ?
![Page 44: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/44.jpg)
Weather today isRaining
ifTrue: [self takeMyUmbrella]
ifFalse: [self takeMySunglasses]
ifTrue:ifFalse is sent to an objet: a boolean
![Page 45: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/45.jpg)
Closures
[3+4]
[‘Bonjour’ size. 3+4. #(1 2 3 4) at:2]
![Page 46: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/46.jpg)
A block (lexical closure) is a Smalltalk object, whose value could be evaluated in
the future.
A block is evaluated by sending the message value.
![Page 47: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/47.jpg)
[1+2] value. ⇒ 3
![Page 48: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/48.jpg)
Block could be parametrized
[:param1 :param2 ... | statements]
![Page 49: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/49.jpg)
[:x | x+1] value:2.
[:x :y | x,y] value:’Bonjour’ value:’monde !’.
![Page 50: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/50.jpg)
Dynamic binding
Postponing selection of an operation until execution time
aCondition ifTrue:[y:= 3] ifFalse:[y:= #(1 2 3)].y printOn: someStream.
Many printOn: methods,compiler can’t preordain the choice.
![Page 51: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/51.jpg)
Dynamic binding enables polymorphism
![Page 52: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/52.jpg)
Where is implemented ifTrue:ifFalse: ?
![Page 53: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/53.jpg)
Where is implemented ifTrue:ifFalse: ?
True>>ifTrue:aBlock1 ifFalse: aBlock2
^aBlock1 value
False>>ifTrue:aBlock1 ifFalse: aBlock2
^aBlock2 value
![Page 54: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/54.jpg)
Build your own control structure !
7 ifSeven:[Object inform: ‘Its seven’]
Number>>ifSeven:aBlock
self=7 ifTrue:[^aBlock value]
![Page 55: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/55.jpg)
Iterations
![Page 56: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/56.jpg)
[Weather today isRaining]whileTrue:[self doNotGoOutside.
self readAGoodBook]
![Page 57: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/57.jpg)
![Page 58: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/58.jpg)
| life |life := #(calvin hates suzie).life at:2 put:#loves.life. ⇒ #(#calvin #loves #suzie)
life first. ⇒ #calvinlife last. ⇒#suzielife indexOf:#calvin. ⇒ 1life indexOf:#asterix ifAbsent:[Transcript show:’Je ne connais pas’].
Array
![Page 59: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/59.jpg)
s := Set new.s add:1.s add:2.s add:2.s. ⇒ a Set(1 2)
Set
![Page 60: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/60.jpg)
Interval
-10 to:10. ⇒ (-10 to: 10)(-10 to:10) at:2. ⇒ -9(-10 to:10) at:2 put:3. ⇒ erreur
![Page 61: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/61.jpg)
OrderedCollection
distributions := OrderedCollection new.distributions add:’Slackware’;
add:’Fedora’; add:’Ubuntu’.distributions. ⇒ an OrderedCollection('Slackware' 'Fedora' 'Ubuntu')distributions remove:’Fedora’.distributions. ⇒ an OrderedCollection('Slackware' 'Ubuntu')
![Page 62: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/62.jpg)
OrderedCollectiondistributions addFirst:’Debian’.distributions addLast:’RedHat’.
distributions. ⇒ an OrderedCollection('Debian' 'Slackware' 'Ubuntu' 'RedHat')
distributions add:’Mandriva’ afterIndex:2.
distributions. ⇒ an OrderedCollection('Debian' 'Slackware' 'Mandriva' 'Ubuntu' 'RedHat')
![Page 63: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/63.jpg)
Collection enumeration
A collection contains a lot of elements.
Enumerate a collection is browsing the collection and running a statement for each element:
do:, select:, reject:collect:, inject:
![Page 64: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/64.jpg)
Enumeration messages are polymorphic=
they work whatever the collection is
![Page 65: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/65.jpg)
do:
Evaluate the block for each element of the collection.
total := 0.a := #(1 2 3 4 5 6).a do:[:unElement | total := total + unElement]
![Page 66: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/66.jpg)
select:
Evaluate the block for each element of the collection and return a collectiof the items of the same class containing elements whose evaluation return true.
a := #(1 2 3 4 5 6).a select:[:unElement| unElement even]
Return : #(2 4 6)
![Page 67: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/67.jpg)
detect:
Evaluate the block for each element of the collection and return the first element that evaluate as the block value as true.
a := #(1 2 3 4 5 6).a detect:[:unElement | unElement>3].
Return : 4.
![Page 68: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/68.jpg)
Smalltalk object model2
![Page 69: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/69.jpg)
Classe Rectangle
Rectangle
widthheight
area...
![Page 70: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/70.jpg)
Object subclass: #Rectangle instanceVariableNames: 'width height' classVariableNames: '' poolDictionaries: '' category: 'Exemples-Heritage'
![Page 71: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/71.jpg)
Rectangle>>width: wwidth := w
Rectangle>>height: hheight := h
Rectangle>>width^width
Rectangle>>height^height
Rectangle>>area^ width*height
![Page 72: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/72.jpg)
Classe ColoredRectangle
ColoredRectangle
widthheightcolor
area...
![Page 73: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/73.jpg)
A colored rectangle is like a rectangle but with a color ...
![Page 74: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/74.jpg)
Operations that can be done a rectangle, can also be done on a colored rectangle
(e.g surface calculus)
![Page 75: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/75.jpg)
a ColoredRectangle isa Rectangle
![Page 76: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/76.jpg)
Rectangle subclass: #ColoredRectangle instanceVariableNames: 'color' classVariableNames: '' poolDictionaries: '' category: 'Exemples-Heritage'
![Page 77: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/77.jpg)
ColoredRectangle>>color ^color
ColoredRectangle>>color: aColor color := aColor
![Page 78: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/78.jpg)
Class inheritanceRectangle
widthheight
area...
ColoredRectangle
color
...
![Page 79: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/79.jpg)
a := Rectangle new.a width:10.a height:50.
a width. ⇒ 10a height. ⇒ 50a area. ⇒ 500
![Page 80: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/80.jpg)
b := ColoredRectangle new.b width:10.b height:50.b color: Color blue.b width. ⇒ 10b height. ⇒ 50b color. ⇒ Color blueb area. ⇒ 500
![Page 81: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/81.jpg)
Rule 1Everything is an object
Rule 2Every object is an instance of one
classRule 3
Every class has a super-classRule 4
Everything happens by message sending
![Page 82: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/82.jpg)
Classes are also objects !
1 class⇒ SmallInteger
20 factorial class ⇒ LargePositiveInteger‘Hello’ class ⇒ ByteString
#(1 2 3) class ⇒ Array
![Page 83: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/83.jpg)
Every class has a superclass
Integer superclass ⇒ Integer
Number superclass ⇒ Magnitude
Magnitude superclass ⇒ Object
![Page 84: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/84.jpg)
doesNotUnderstand:
![Page 85: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/85.jpg)
If a class is an object, every class should be also an
instance of a specific classe.
Metaclasses !
![Page 86: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/86.jpg)
![Page 87: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/87.jpg)
![Page 88: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/88.jpg)
Metaclasses hierarchy is parallel to class hierarchy
![Page 89: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/89.jpg)
![Page 90: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/90.jpg)
Every metaclasses is instance of Metaclass
![Page 91: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/91.jpg)
The metaclass of Metaclass is an
instance of Metaclass
![Page 92: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/92.jpg)
![Page 93: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/93.jpg)
How many classes in the system ?
Object allSubclasses size
![Page 94: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/94.jpg)
Object allSubclasses do:[:aClass| aClass methodDict keys select: [:aMethod | (aClass>>aMethod) isAbstract ]]
How many abstract methods in the system ?
![Page 95: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/95.jpg)
What is a dynamic language ?
Dynamic typing: greater polymorphism
Metaprogramming (metaclasses):allow language itself to be dynamically changed
allow hooks into object life cycle and method calls
Work with code as easily as dataClosures
Higher-order programming
![Page 96: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/96.jpg)
Readability
Shorter code is easier to read and maintain and refactor
Need balance between cryptic and expressive
![Page 97: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/97.jpg)
square^self*self
public int square(int x) { return x * x;}
![Page 98: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/98.jpg)
button on: #mouseDown send: #value to: [Object inform: 'You clicked me'].
button.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { (Button) view.setText(""You Clicked Me!") }});
![Page 99: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/99.jpg)
Pharo, an open-source Smalltalk
3
![Page 100: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/100.jpg)
![Page 101: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/101.jpg)
In a nutshell
Pharo = language + IDE
Pure object-oriented programming language (Smalltalk)
Dynamically language and trait-based
Open and flexible environment
Used Monticello for versionning (Metacello planned for 1.1)
![Page 102: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/102.jpg)
![Page 103: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/103.jpg)
iPhone
![Page 104: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/104.jpg)
Pharo class Browser
![Page 105: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/105.jpg)
other Pharo tools
![Page 106: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/106.jpg)
![Page 107: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/107.jpg)
Polymorph UI
Polymorph provides support for selectable UI themes in Morphic, extra widgets to support a consistent look&fell, a framework for easily creating UI in code.
Standard UI in Pharo
![Page 108: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/108.jpg)
![Page 109: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/109.jpg)
Demo of Pharo
Simple examples
BlinkMorph example
Skins support
MultiMorph UI (UITheme examples)
![Page 110: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/110.jpg)
Tests !
9179 unit tests includes in Pharo 1.0
9144 passes
20 expected failures
15 failures
0 errors
![Page 111: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/111.jpg)
Everybody can help
Reporting bugsConfirming bugsWriting testsWriting examplesWriting commentsSimple contributing fixesDeep discussion...
![Page 112: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/112.jpg)
FIX/ENHANCEMENTIn PharoInbox or
Changesets
Discussed on Mailing-
list
BUG Tracker
Integrated Rejected
BUG
Discussed on
Discussed on
Described
Described
Other version
Community Process
![Page 113: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/113.jpg)
Pharo by example vol. 2 on preparation
http://www.pharobyexample.org/
![Page 114: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/114.jpg)
Pharo SprintsMay 2008 Bern (Switzerland)July 2009 Bern (Switzerland)October 2009 Lille (France)November 2009 Buenos Aires (Argentina)
![Page 115: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/115.jpg)
ThanksHans Beck
Alexandre Bergel Cédric Beler
Torsten Bergmann Matthias Berth Ralph Boland
Noury Bouraqadi Brian Brown
Gwenael Casaccio Damien Cassou Nicolas Cellier Gary Chambers
Miguel Coba Gabriel Cotelli Carlos Crosetti Cyrille Delaunay Simon Denier
Marcus Denker Ramiro Diaz Trepat Stéphane Ducasse
Morales Durand Hernan Stephan Eggermont
Luc Fabresse
Matthew Fulmer Hilaire Fernandes
Julian Fitzell Tudor Girba Sean Glazier
Norbert Hartl Dale Henrichs Reinout Heeck
Eric Hochmeister Keith Hodges
Henrik Sperre Johansen Pavel Krivanek Adrian Kuhn
Adrian Lienhard Andreas Leidig
Mariano Martinez Peck Dave Mason
John McIntosh Johnaton Meichtry
Eliot Miranda Hernan Morales Durand
Philipp Marshall Jannick Menanteau
Yann Monclair Oscar Nierstrasz
David J Pennell Joseph Pelrine Alain Plantec Damien Pollet Lukas Renggli Jorge Ressia
Mike Roberts Robert Rothwell
David Rotlisberger Michael Rueger
Bill Schwab Niko Schwarz Igor Stasenko
Francois Stephany Serge Stinckwich
Mathieu Suen Lawrence Trutter Andrew Tween
Martin von loewis Juan Vuletich Steven Wirts
Hernan Wilkinson
![Page 116: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/116.jpg)
Join Us!
Creating good energy, software quality,learning and having fun
http://pharo-project.org
![Page 117: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/117.jpg)
Cộng đồng Smalltalk Việt
Smalltalk-VN mailing-list :
http://lists.squeakfoundation.org/mailman/listinfo/smalltalk-vn
Smalltalk flyer in vietnamese
EToys in vietnamese
![Page 118: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/118.jpg)
Occam's razor: "entities should not be multiplied beyond what is necessary" (entia non sunt multiplicanda praeter necessitatem)
the simplest solution is usually the correct one.
![Page 119: Pharo, an innovative and open-source Smalltalk](https://reader033.fdocuments.net/reader033/viewer/2022061306/554dd58db4c905d10e8b4c04/html5/thumbnails/119.jpg)
Thank you for your attention.
Cám ơn sự quan tâm của bạn.