Pharo tutorial at ECOOP 2013
-
Upload
damien-cassou -
Category
Technology
-
view
805 -
download
2
description
Transcript of Pharo tutorial at ECOOP 2013
![Page 1: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/1.jpg)
Pharo: A malleable and powerful platform
Damien Cassou and Camille Teruelhttp://www.pharo.org
![Page 2: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/2.jpg)
What is it?
Programming language + IDEObject-Oriented, Dynamic, Reflective
Explore + Change running systems
The Ultimate Live Programming Environment!
![Page 3: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/3.jpg)
Pharo
MIT licenseGreat community of active doersPowerfulElegant and fun to programLiving system under your fingersMac, Linux, Android, iOS, Windows
![Page 4: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/4.jpg)
2nd most downloaded on Inria gforge40-50 active commiters> 600 mailing-list members180 license agreements50 association members17 industrial consortium membersaround 300 external projects
Pharo in numbersVery HighActivity
![Page 5: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/5.jpg)
![Page 6: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/6.jpg)
Create an ecosystem where business/innovation
can bloom
![Page 7: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/7.jpg)
We want that you can make research and money with Pharo.
We want a powerful innovative dynamic language where we can build our future.
![Page 8: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/8.jpg)
A Little Journey in the Pharo Object Model
![Page 9: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/9.jpg)
A pure and minimal object model
Less is more!
![Page 10: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/10.jpg)
No constructors, no static methods, no operators
No interfaces, no private/protected modifiers
No type declarations, no parametrized types
No primitive types, no boxing/unboxing
Still powerful
![Page 11: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/11.jpg)
Everything is an object
![Page 12: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/12.jpg)
213 class
⇒ SmallInteger
Objects are instances of Classes
class is a message sent to the object 213
SmallInteger is the result of the message sentIn “Java”:
213.getClass()
![Page 13: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/13.jpg)
Objects are instances of Classes
Integer
SmallInteger
213
instance of
inheritsfrom
![Page 14: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/14.jpg)
Sending a message
Integer
SmallInteger
213
factoria
l
instance of
inheritsfrom
![Page 15: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/15.jpg)
Classes are objects too
213 class selectors
⇒ #(#instVarAt: #sizeInMemory #printOn:base:length:padded: #< #bitXor: #'\\' #numberOfDigitsInBase: #'//' #threeDigitName
#highBitOfPositiveReceiver #bitAnd: #isLarge #largeIdentityHash #'>=' #nextObject #nextInstance
#gcd: #printStringBase: #lowBit #pointsTo: #basicIdentityHash #fromString:radix: ...)
![Page 16: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/16.jpg)
Classes are objects too
Number allSubclasses
⇒ an OrderedCollection(Fraction Float Integer ScaledDecimal SmallInteger LargePositiveInteger
LargeNegativeInteger)
![Page 17: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/17.jpg)
Fun with Numbers!
![Page 18: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/18.jpg)
1 class
⇒ SmallInteger
![Page 19: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/19.jpg)
1 class
⇒ SmallInteger
1 class maxVal
⇒ 1073741823
![Page 20: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/20.jpg)
1 class
⇒ SmallInteger
1 class maxVal
⇒ 1073741823
1 class maxVal + 1
⇒ 1073741824
![Page 21: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/21.jpg)
1 class
⇒ SmallInteger
1 class maxVal
⇒ 1073741823
1 class maxVal + 1
⇒ 1073741824
(1 class maxVal + 1) class
⇒ LargePositiveInteger
![Page 22: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/22.jpg)
(1/3) + (2/3)
⇒ 1
![Page 23: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/23.jpg)
(1/3) + (2/3)
⇒ 1
2/3 + 1
⇒ 5/3
![Page 24: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/24.jpg)
(1/3) + (2/3)
⇒ 1
2/3 + 1
⇒ 5/3
1000 factorial
4023872600770937735437024339230039857193748642107146325437999104299385123986290205920442084869694048004799886101971960586316668729948085589013238296699445909974245040870737599188236277271887325197795059509952761208749754624970436014182780946464962910563938874378864873371191810458257836478499770124766328898359557354325131853239584630755574091142624174743493475534286465766116677973966688202912073791438537195882498081268678383745597317461360853795345242215865932019280908782973084313928444032812315586110369768013573042161687476096758713483120254785893207671691324484262361314125087802080002616831510273418279777047846358681701643650241536913982812648102130927612448963599287051149649754199093422215668325720808213331861168115536158365469840467089756029009505376164758477284218896796462449451607653534081989013854424879849599533191017233555566021394503997362807501378376153071277619268490343526252000158885351473316117021039681759215109077880193931781141945452572238655414610628921879602238389714760885062768629671466746975629112340824392081601537808898939645182632436716167621791689097799119037540312746222899880051954444142820121873617459926429565817466283029555702990243241531816172104658320367869061172601587835207515162842255402651704833042261439742869330616908979684825901254583271682264580665267699586526822728070757813918581788896522081643483448259932660433676601769996128318607883861502794659551311565520360939881806121385586003014356945272242063446317974605946825731037900840244324384656572450144028218852524709351906209290231364932734975655139587205596542287497740114133469627154228458623773875382304838656889764619273838149001407673104466402598994902222217659043399018860185665264850617997023561938970178600408118897299183110211712298459016419210688843871218556461249607987229085192968193723886426148396573822911231250241866493531439701374285319266498753372189406942814341185201580141233448280150513996942901534830776445690990731524332782882698646027898643211390835062170950025973898635542771967428222487575867657523442202075736305694988250879689281627538488633969099598262809561214509948717012445164612603790293091208890869420285106401821543994571568059418727489980942547421735824010636774045957417851608292301353580818400969963725242305608559037006242712434169090041536901059339838357779394109700277534720000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
![Page 25: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/25.jpg)
Point class
⇒ Point class
Classes are objects too
![Page 26: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/26.jpg)
Point class
⇒ Point class
Classes are objects too
“Point class” is an anonymous class with only one instance: Point.
We call such classes “metaclasses”
![Page 27: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/27.jpg)
Integer
SmallInteger
Class Parallel Inheritance
213
instance of
![Page 28: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/28.jpg)
Integer
SmallInteger
Integer class
SmallInteger class
Class Parallel Inheritance
213
instance of
instance of
instanceof
![Page 29: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/29.jpg)
Integer
SmallInteger
Integer class
SmallInteger class
A “static” method is just a method of
the metaclassInteger readFrom: '123'
⇒ 123
Class Parallel Inheritance
factorial
class
class
readFrom:
![Page 30: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/30.jpg)
Class extensions
A method can be defined in a class that belongs to another package!Powerful to build DSLs
$x ctrl , $f ctrl⇒ Ctrl + X , Ctrl + F
ctrl method in Character class
![Page 31: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/31.jpg)
Summary
Everything is an object
One single model
Classes are objects too
A class is instance of another class
One unique method lookup, look in the class of the receiver
![Page 32: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/32.jpg)
Pharo: Syntax in a Nutshell
![Page 33: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/33.jpg)
asm push: asm RBP; mov: asm RSP -> asm RBP; mov: 1024 -> asm RAX; mov: asm RBP -> asm RSP; pop: asm RBP; ret.
identifier := #letter asParser , #word asParser star
Assembly
Parsers
Syntax Examples
![Page 34: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/34.jpg)
Syntax on a PostCardexampleWithNumber: x
|y|
true & false not & (nil isNil) ifFalse: [ self halt ].
y := self size + super size.
{ 1 . 2 . #($a #a ‘a’ 1 1.0) }
do: [ :each | Transcript show: (each class name); show: (each printString); show: ‘ ‘ ].
^ x < y
![Page 35: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/35.jpg)
Language Constructs
^ return“ comments # symbol or array‘ string[] block. separator; cascade| local or block variable:= assignment$ character<...> annotation
![Page 36: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/36.jpg)
Examplescomment: “a comment”character: $c $. string: 'a nice string' 'lulu' 'l''idiot'symbol: #mac #+ array: { 1 . 123 + 1 }literal array: #(1 2 3 (1 3) $a 4)byte array: #[1 2 3]block: [ :x | x * 2 ]integer: 1 2r101real: 1.5 6.03e-34 4 2.4e7keywords: true false nil self super thisContext
![Page 37: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/37.jpg)
Not Syntax
& conjunction (and)| disjunction (or)+ addition< lower thanifTrue: conditiondo: iteration...
all of these are plain methods!
![Page 38: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/38.jpg)
Not Syntax
& conjunction (and)| disjunction (or)+ addition< lower thanifTrue: conditiondo: iteration...
Boolean>>
Boolean>>
Number>>
Magnitude>>
Boolean>>
Collection>>
their classes
3 = 2 ifTrue: [ Error signal: 'Help' ]
![Page 39: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/39.jpg)
3 kinds of messagesUnary messages
Binary messages
Keywords messages
5 factorialTranscript cr
3 + 4
2 between: 0 and: 5
Transcript show: 'hello world'
![Page 40: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/40.jpg)
postman.send( mail, recipient);
Keyword messages
![Page 41: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/41.jpg)
postman.send( mail, recipient);
Keyword messages
![Page 42: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/42.jpg)
postman send mail recipient
Keyword messages
![Page 43: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/43.jpg)
postman send mail to recipient
Keyword messages
![Page 44: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/44.jpg)
postman send: mail to: recipient
Keyword messages
![Page 45: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/45.jpg)
postman send: mail to: recipient
Keyword messages
send:to: method in the Postman class
receiver argument 1 argument 2
message send
![Page 46: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/46.jpg)
strings := OrderedCollection new
ArrayList<String> strings = new ArrayList<String>();
Some Comparisons
![Page 47: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/47.jpg)
persons collect: [:person | person name]
ArrayList<String> strings
= new ArrayList<String>();
for(Person person: persons) {
strings.add(person.name());
}
Some Comparisons
![Page 48: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/48.jpg)
persons collect: #name
ArrayList<String> strings
= new ArrayList<String>();
for(Person person: persons) {
strings.add(person.name());
}
Some Comparisons
![Page 49: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/49.jpg)
[ self doSomething ] fork
new Thread(
new Runnable() {
public void run() {
this.doSomething();}}).start();
Some Comparisons
![Page 50: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/50.jpg)
(10 between: 1 and: 20 + 2) not
⇒ false
( ) > Unary > Binary > Keywords
![Page 51: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/51.jpg)
A method definition in PointMethod name
<= aPoint "Answer whether the receiver is neither below nor to the right of aPoint."
^ x <= aPoint x and: [y <= aPoint y]
(2@3) <= (5@6)⇒ true
![Page 52: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/52.jpg)
A method definition in PointArgument
<= aPoint "Answer whether the receiver is neither below nor to the right of aPoint."
^ x <= aPoint x and: [y <= aPoint y]
(2@3) <= (5@6)⇒ true
![Page 53: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/53.jpg)
A method definition in PointComment
<= aPoint "Answer whether the receiver is neither below nor to the right of aPoint."
^ x <= aPoint x and: [y <= aPoint y]
(2@3) <= (5@6)⇒ true
![Page 54: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/54.jpg)
A method definition in Point
Return
<= aPoint "Answer whether the receiver is neither below nor to the right of aPoint."
^ x <= aPoint x and: [y <= aPoint y]
(2@3) <= (5@6)⇒ true
![Page 55: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/55.jpg)
A method definition in Point
Instance variable
<= aPoint "Answer whether the receiver is neither below nor to the right of aPoint."
^ x <= aPoint x and: [y <= aPoint y]
(2@3) <= (5@6)⇒ true
![Page 56: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/56.jpg)
A method definition in Point
Binary message
<= aPoint "Answer whether the receiver is neither below nor to the right of aPoint."
^ x <= aPoint x and: [y <= aPoint y]
(2@3) <= (5@6)⇒ true
![Page 57: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/57.jpg)
A method definition in Point
Keyword message
<= aPoint "Answer whether the receiver is neither below nor to the right of aPoint."
^ x <= aPoint x and: [y <= aPoint y]
(2@3) <= (5@6)⇒ true
![Page 58: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/58.jpg)
A method definition in Point
Block
<= aPoint "Answer whether the receiver is neither below nor to the right of aPoint."
^ x <= aPoint x and: [y <= aPoint y]
(2@3) <= (5@6)⇒ true
![Page 59: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/59.jpg)
Point>> <= aPoint "Answer whether the receiver is neither below nor to the right of aPoint."
^ x <= aPoint x and: [y <= aPoint y]
in books and slides, we specify the class name
Class name
![Page 60: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/60.jpg)
Statements and Cascades
Temporary variables Statement
Cascade
| p pen |p := [email protected] := Pen new.pen up; goto: p; down; goto: p+p
![Page 61: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/61.jpg)
Anonymous methodPassed as method argument or stored
f := [:x | x * x + 3].f value: 2
⇒ 7
Blocks (aka Closure)
BlockClosure>>value:
![Page 62: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/62.jpg)
Block usage
Integer>> factorial self = 0 ifTrue: [ ^ 1 ]. self > 0 ifTrue: [ ^ self * (self - 1) factorial ]
#(1 2 3) do: [ :each | each crLog ]
![Page 63: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/63.jpg)
Control StructuresEvery control structure is realized by message sends
[ stream atEnd ] whileFalse: [ self process: stream next ].
Magnitude>> max: aMagniture ^ self > aMagnitude ifTrue: [ self ] ifFalse: [ aMagnitude ]
![Page 64: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/64.jpg)
Iterating Collections#(2 3 4 -35 4)
collect: [ :each| each abs ]
⇒ #(2 3 4 35 4)
![Page 65: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/65.jpg)
Iterating Collections#(2 3 4 -35 4)
select: [ :each| each odd ]
⇒ #(-3 -35)
![Page 66: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/66.jpg)
Iterating Collections#(2 3 4 -35 4)
do: [ :each| Transcript crShow: each ]
⇒ 2
3...
![Page 67: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/67.jpg)
Pharo, a live programming environment
![Page 68: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/68.jpg)
DemoModifying classes and methods while
the program is running
![Page 69: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/69.jpg)
Nice libraries and frameworks
![Page 70: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/70.jpg)
'http://picasaweb.google.com/data/feed/
api/all?q=puppy' asUrl retrieveContents
![Page 71: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/71.jpg)
Gofer new
smalltalkhubUser: 'PharoExtras'
project: 'XMLParser';
loadStable.
![Page 72: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/72.jpg)
data := 'http://picasaweb.google.com/data/feed/api/all?q=puppy' asUrl retrieveContents.
doc := XMLDOMParser parse: data
![Page 73: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/73.jpg)
data := 'http://picasaweb.google.com/data/feed/api/all?q=puppy' asUrl retrieveContents.
doc := XMLDOMParser parse: data.
entries := doc allNodesSelect: [ :n | n name = 'entry' ].
entry := entries anyOne.
content := entry nodesDetect: [ :n | n name = 'content'].
url := content attributeAt: 'src'.
'http://lh3.ggpht.com/[...]/puppy-and-kitten.jpg'
![Page 74: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/74.jpg)
data := 'http://picasaweb.google.com/data/feed/api/all?q=puppy' asUrl retrieveContents.
doc := XMLDOMParser parse: data.
path := XPath for: 'entry/content/@src'.
urls := path in: doc.
url := urls anyOne.
'http://lh3.ggpht.com/[...]/puppy-and-kitten.jpg'
![Page 75: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/75.jpg)
(ZnEasy getGif: url) asMorph openInHand
![Page 76: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/76.jpg)
Your turn
![Page 77: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/77.jpg)
Black magic
![Page 78: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/78.jpg)
Execution Stack as an Object
To define exceptions from within the language
Debugger support!
Advanced debugging
Continuation
![Page 79: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/79.jpg)
thisContext
returns an object that represents the method invocationcan walk (even modify!) the stack
![Page 80: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/80.jpg)
Serializing Continuations[ "some code causing an error" ] on: Error do: [ :error | FLSerializer serialize: error toFileNamed: 'error.fuel' ]
Then in a new image open a debugger on the serialized error:
FLMaterializer materializeFromFileNamed: 'error.fuel'; debug.
![Page 81: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/81.jpg)
Powerful Breakpoints?
Would be so good if we could say:“Stop method bar only if it is called from method named foo” i.e.,bar ... Halt whenCalledFrom: #foo. ...
![Page 82: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/82.jpg)
Halt>> whenCalledFrom: aSelector | ctxt | ctxt := thisContext. [ ctxt sender isNil ] whileFalse: [ ctxt := ctxt sender. ctxt selector = aSelector ifTrue: [ self signal ] ]
![Page 83: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/83.jpg)
Pointer Swapping
anObject become: anotherObject
![Page 84: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/84.jpg)
| pt1 pt2 ref |
pt1 := 0@0.
pt2 := 100@100.
ref := pt1.
pt1 become: pt2.
self assert: ref = (100@100).
self assert: pt2 = (0@0).
self assert: pt1 = (100@100).
Pointer Swapping
![Page 85: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/85.jpg)
Some Pharo’s success stories
![Page 86: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/86.jpg)
![Page 87: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/87.jpg)
![Page 89: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/89.jpg)
WEBDRUCK.CHWeb-To-Print Solution
• Design and create individual printed matter
• eShop with credit card payment
• High quality PDF output with Printing Process integration
• Thousands of orders for seven Swiss printing companies
![Page 90: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/90.jpg)
NTed: disaster scenario recovery
![Page 91: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/91.jpg)
iBizLog - http://www.ibizlog.com
A product by SmallworksTuesday, May 15, 12
![Page 92: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/92.jpg)
![Page 93: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/93.jpg)
![Page 94: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/94.jpg)
Pinesoft MBagger
![Page 95: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/95.jpg)
We want more success stories!
![Page 96: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/96.jpg)
We are a cool community
![Page 97: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/97.jpg)
www.10pines.comwww.2denker.dewww.agilitic.com
www.airflowing.comwww.anymorphic.comwww.ardishealth.com
www.beta9.bewww.bombardier.com
www.cmsbox.comwww.finworks.biz
seaside.gemstone.comwww.ibizlog.comwww.inceptive.bewww.jooshr.comwww.majcon.de
www.mindclue.chwww.miriamtech.com
www.myneat.orgwww.netstyle.ch
www.objectfusion.frwww.panasoft.comwww.pinesoft.co.uk
www.promedmedical.netwww.sharedlogic.ca
www.smallworks.com.arwww.trantaria.com www.square-i.net
yesplan.be
Companies
![Page 98: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/98.jpg)
University of Bueno Aires University of Bern scg.unibe.chUniversity of Brussels soft.vub.ac.be/soft/Ecole des Mines www.ensm-douai.frUniversité de Savoie www.imus.univ-savoie.frIvan Franko National University of UkraineCzech Technical UniversityUniversity of Life Sciences in PragueNorthen Michigan University www.nmu.eduUniversity Catholic of Argentina www.uca.edu.arUniversity of Santiago www.uchile.clUniversitat Policnica de Catalunya www.upc.edu
Lectures
![Page 99: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/99.jpg)
Lafhis (University of Bueno Aires )Software Composition Group (scg.unibe.ch)CAR (Ecole des mines www.ensm-douai.fr)RMoD (Inria)Ummisco (IRD)Reveal (University of Lugano) Lysic (University of Bretagne Occidentale)Pleiad (University of Santiago)CEA-List
Research Groups
![Page 100: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/100.jpg)
Community Ongoing WorkBetter widgets, UI Builder (A. Plantec, G. Chambers, B. van Ryseghem)
Better browsers (B. van Ryseghem, C. Bruni)
Proxy (M. Martinez-Peck)
New compiler (J. Ressia/M. Denker/C. Bera/)
Vectorial canvas (I. Stasenko)
Better FFI (I. Stasenko, E. Lorenzano)
Bootstrap (G. Polito/S. Ducasse/N. Bouraqadi/L. Fabresse)
PDF generation (O. Auverlot, G. Larcheveque)
Network (WebSocket, Oauth, Zinc, Zodiac S. van Caekenberghe)
![Page 101: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/101.jpg)
Consortium & Association
How to sustain Pharo?
How to structure the community?
![Page 102: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/102.jpg)
![Page 103: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/103.jpg)
Consortium MembersManaged by Inria for nowWho: companies, institutions, user groupsPrivileged access to the core development teamInfluence priorities of the next developmentEngineering support timeJob postsTraining/Conferences special prices
![Page 104: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/104.jpg)
![Page 105: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/105.jpg)
Pharo User Association
Managed by the Pharo AssociationIndividuals
Premium (99 €/year)Normal (40 €/year)
Join and participate!
![Page 106: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/106.jpg)
Pharo books
Pharo by example translated to french, merci!translated to spanish, gracias!translated to japanese, ありがとう!
german started
http://pharobyexample.org
![Page 107: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/107.jpg)
New books are coming
Deep into Pharo
Pharo for the Enterprise
A glimpse at VM
![Page 108: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/108.jpg)
Everybody can helpReporting bugs
Confirming bugs
Writing tests
Writing examples
Writing comments
Simple contributing fixes
Discussion, feedback
![Page 109: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/109.jpg)
May 2008 BernJuly 2009 BernOctober 2009 LilleNovember 2009 Buenos AiresMarch 2010 BernMay 2010 Buenos AiresJune 2010 BernJune 2010 BruxellesJuly 2010 LondonSeptember 2010 BarcelonaSeptember 2010 LilleJanuary 2011 LilleJuly 2011 LilleOctober 2011 BruxellesFebruary 2012 BernOctober 2012 BernApril 2012 LilleAugust 2012 GhentOctober 2012 Perto MadrynJanuary 2013 SantiagoFebruary 2013 LilleApril 2013 LilleJune 2013 Lille
Open Pharo Sprints
![Page 110: Pharo tutorial at ECOOP 2013](https://reader031.fdocuments.us/reader031/viewer/2022013011/555bde55d8b42a38078b4828/html5/thumbnails/110.jpg)
To Take AwayBecause it is simple and extensible, Pharo is a nice platform to experiment on
Use it for your own research (language design or implementation, types, modularity, empirical studies…)
http://www.pharo.org