Pharo: Objects at your Fingertips

Pharo
PharoMaître de conférences at Pharo
Pharo: Object at
your Fingertips
Marcus Denker
http://www.pharo-project.org
What is it?
Language + Environment
Simple Language (Smalltalk)
Object-Oriented, Dynamic, Reflective
Explore + Change running systems
!
The Ultimate Programming Environment!
Pharo
MIT license
Mac, Linux, Android, iOS, Windows
Great community
Improving steadily
Many excellent libraries
Started 2008
Pharo 1.0 released October 2009
2.0 is the current stable
Pharo3: Early 2014
Plan: 1 Release per year
Language
(in 10 minutes)
Pharo started with Smalltalk-80 (Squeak)
Language still very much Smalltalk
But the goal is to develop it further
Example: Reflective Capabilities
No constructors
No types declaration
No interfaces
No packages/private/protected
No parametrized types
Yet really powerful
Less is better
Objects are instances of Classes
Objects are instances of Classes
!
(10@200)
Objects are instances of Classes
!
(10@200) class
Objects are instances of Classes
!
(10@200) class
Point
Classes are objects too
Classes are objects too
!
Point selectors
!
Classes are objects too
!
Point selectors
!
> an IdentitySet(#eightNeighbors #+ #isZero #sortsBefore: #degrees #printOn: #sideOf:
#fourNeighbors #hash #roundUpTo: #min: #min:max: #max #adaptToCollection:andSend:
#quadrantOf: #crossProduct: #= #nearestPointOnLineFrom:to: #bitShiftPoint: #* #guarded
#insideTriangle:with:with: #grid: #truncateTo: #y #setR:degrees: #normal #directionToLineFrom:to:
#truncated #nearestPointAlongLineFrom:to: #theta #scaleTo: #encodePostscriptOn: #> #asPoint
#extent: #r #roundTo: #max: #interpolateTo:at: #triangleArea:with: #angleWith: #dotProduct:
#isSelfEvaluating #'<=' #to:intersects:to: #'//' #isInsideCircle:with:with: #< #scaleFrom:to: #corner:
#to:sideOf: #x #'>=' #roundDownTo: #onLineFrom:to:within: #transposed #ceiling #angle #basicType
#translateBy: #asFloatPoint #'' #adaptToNumber:andSend: #abs #negated #octantOf:
#asIntegerPoint #flipBy:centerAt: #scaleBy: #floor #onLineFrom:to: #isPoint #reflectedAbout: #/ #dist:
#asNonFractionalPoint #bearingToPoint: #reciprocal #rotateBy:centerAt: #rotateBy:about: #rounded
#setX:setY: #squaredDistanceTo: #normalized #veryDeepCopyWith: #- #storeOn: #rect: #deepCopy
#isIntegerPoint #min #adhereTo: #adaptToString:andSend:)
Methods are public
Instance variables are protected
Single Inheritance
Single Inheritance
Object subclass: #Point!
! instanceVariableNames: 'x y'!
! classVariableNames: ''!
! poolDictionaries: ''!
! category: 'Kernel-BasicObjects'
2 instance variables
subclass of Object
3 kinds of messages
Unary messages
Binary messages
Keywords messages
5 factorial!
Transcript cr
3 + 4
3 raisedTo: 10 modulo: 5!
!
Transcript show: 'hello world'
• Anonymous method
• Passed as method argument or stored
• Functions
	 	 fct(x)= x*x+3, fct(2).
!
	 	 fct :=[:x| x * x + 3].
fct value: 2
!
Blocks
Control structures
Every control structure is realized by message sends
4 timesRepeat: [Beeper beep]
max: aNumber!
! ^ self < aNumber !
! ! ifTrue: [aNumber] !
! ! ifFalse: [self]
<= aPoint !
! "Answer whether the receiver is neither!
! below nor to the right of aPoint."!
!
! ^ x <= aPoint x and: [y <= aPoint y]
A typical method in Point
Method name Argument Comment
Return Binary message
Keyword messageInstance variable
Block
(2@3) <= (5@6) true
Complete Syntax on a PostCard
exampleWithNumber: x
“A method that has unary, binary, and key word messages, declares arguments and
temporaries (but not block temporaries), accesses a global variable (but not and
instance variable), uses literals (array, character, symbol, string, integer, float), uses the
pseudo variable true false, nil, self, and super, and has sequence, assignment, return
and cascade. It has both zero argument and one argument blocks.”
	 |y|
true & false not & (nil isNil) ifFalse: [self halt].
	 y := self size + super size.
	 #($a #a ‘a’ 1 1.0)
do: [:each | Transcript show: (each class name); show: (each printString); show:
‘ ‘].
^ x < y
Environment
Language + Environment are closely linked
Reflection is the basis
Classes, Methods, Packages are Objects
The tools manipulate these Objects
Class Browser
Inspector
Demo: Changing a class at runtime
Demo: Exploring the system
Demo: Inspect World
There is so much more…
Pharo Books
Pharo Success Stories
Continuous API Testing
keep your services under control 24/7
Norbert Hartl norbert@2denker.de
www.2denker.de
eMCee is a montoring service for backend interfaces
- Web application to define backend interfaces
- Monitors reliability of interface periodically
- Sends warning if status of interface changes
- Provides overview graphs about reliability
- Snapshots requests for debugging purposes
mail@2denker.de
Pharo: Objects at your Fingertips
• Entry Level Track & Trace Product
• Complements T3 Full Product
• One Page Javascript HTML5 / Ajax Client
• REST Back End in Pharo Smalltalk
• Gateways to multiple data providers
Pharo Consortium
Managed by INRIA
Who: companies, institutions, user groups
Privileged access to the core development team
Influence priorities of the next development
http://consortium.pharo.org
Pharo: Objects at your Fingertips
Future +
Research
Instance Variables as Objects —> Slots
!
Proxy model in the base language
!
Structuring reflective API (—> Mirrors)
More Reflection
AST Everywhere
Used in Tools for Navigation
!
Do we need to store text?
!
Use for Behavioral Reflection
Beyond Text
Put “virtualization” in the language
We already use “Images”
Make the Image a first class concept in the language
System - as - Objects
Open Pharo SprintsMay 2008 Bern
July 2009 Bern
October 2009 Lille
November 2009 Buenos Ares
March 2010 Bern
May 2010 Buenos Ares
June 2010 Bern
June 2010 Bruxelles
July 2010 London
September 2010 Barcelona
September 2010 Lille
January 2011 Lille
July 2011 Lille
October 2011 Bruxelles
February 2012 Bern
April 2012 Lille
September 2012 Ghent
October 2013 Lille
November 2013 Buenos Aires
Pharo: Objects at your Fingertips
1 of 48

More Related Content

What's hot(20)

Sesion mat3g 23Sesion mat3g 23
Sesion mat3g 23
Margret Aguilar1.5K views
Planremoto3 lenguaje5°Planremoto3 lenguaje5°
Planremoto3 lenguaje5°
Rominita Troncoso178 views
Sumas con policubos Sumas con policubos
Sumas con policubos
Silvia Bailarina235 views
ejercicios con fraccionesejercicios con fracciones
ejercicios con fracciones
sandra15111.2K views
Mat u2 3g_sesion14Mat u2 3g_sesion14
Mat u2 3g_sesion14
Margret Aguilar625 views
Mat u2 2g_sesion15Mat u2 2g_sesion15
Mat u2 2g_sesion15
Margret Aguilar314 views
Resumen unidad 6: Los animalesResumen unidad 6: Los animales
Resumen unidad 6: Los animales
elgimnasiodelcolegio1.6K views

Similar to Pharo: Objects at your Fingertips(20)

Pharo: Objects at your FingertipsPharo: Objects at your Fingertips
Pharo: Objects at your Fingertips
Marcus Denker2.5K views
Pharo: A Reflective SystemPharo: A Reflective System
Pharo: A Reflective System
Pharo1.4K views
Step talkStep talk
Step talk
ESUG732 views
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
Satish Verma1.8K views
Pharo3 at FosdemPharo3 at Fosdem
Pharo3 at Fosdem
Pharo1.6K views
Pharo Status ESUG 2014Pharo Status ESUG 2014
Pharo Status ESUG 2014
Pharo1.3K views
Pharo3 at FosdemPharo3 at Fosdem
Pharo3 at Fosdem
Marcus Denker3.4K views
Pharo UpdatePharo Update
Pharo Update
ESUG890 views
Fosdem 13: Pharo 2.0 updateFosdem 13: Pharo 2.0 update
Fosdem 13: Pharo 2.0 update
Marcus Denker5.1K views
Talk: Pharo at JM2L 2009Talk: Pharo at JM2L 2009
Talk: Pharo at JM2L 2009
Marcus Denker1.1K views
Smalltalk and BusinessSmalltalk and Business
Smalltalk and Business
Mariano Martínez Peck1.9K views
Flex and PHP For the Flash FolksFlex and PHP For the Flash Folks
Flex and PHP For the Flash Folks
10n Software, LLC1.1K views
Pharo StatusPharo Status
Pharo Status
Jannik Laval2.8K views

More from Pharo

Yesplan: 10 Years laterYesplan: 10 Years later
Yesplan: 10 Years laterPharo
2.5K views30 slides
 UI Testing with Spec UI Testing with Spec
UI Testing with SpecPharo
801 views25 slides
Pharo 7.0 and 8.0 alphaPharo 7.0 and 8.0 alpha
Pharo 7.0 and 8.0 alphaPharo
768 views26 slides

Pharo: Objects at your Fingertips

  • 1. Pharo: Object at your Fingertips Marcus Denker http://www.pharo-project.org
  • 2. What is it? Language + Environment Simple Language (Smalltalk) Object-Oriented, Dynamic, Reflective Explore + Change running systems ! The Ultimate Programming Environment!
  • 3. Pharo MIT license Mac, Linux, Android, iOS, Windows Great community Improving steadily Many excellent libraries
  • 4. Started 2008 Pharo 1.0 released October 2009 2.0 is the current stable Pharo3: Early 2014 Plan: 1 Release per year
  • 6. Pharo started with Smalltalk-80 (Squeak) Language still very much Smalltalk But the goal is to develop it further Example: Reflective Capabilities
  • 7. No constructors No types declaration No interfaces No packages/private/protected No parametrized types Yet really powerful Less is better
  • 9. Objects are instances of Classes ! (10@200)
  • 10. Objects are instances of Classes ! (10@200) class
  • 11. Objects are instances of Classes ! (10@200) class Point
  • 13. Classes are objects too ! Point selectors !
  • 14. Classes are objects too ! Point selectors ! > an IdentitySet(#eightNeighbors #+ #isZero #sortsBefore: #degrees #printOn: #sideOf: #fourNeighbors #hash #roundUpTo: #min: #min:max: #max #adaptToCollection:andSend: #quadrantOf: #crossProduct: #= #nearestPointOnLineFrom:to: #bitShiftPoint: #* #guarded #insideTriangle:with:with: #grid: #truncateTo: #y #setR:degrees: #normal #directionToLineFrom:to: #truncated #nearestPointAlongLineFrom:to: #theta #scaleTo: #encodePostscriptOn: #> #asPoint #extent: #r #roundTo: #max: #interpolateTo:at: #triangleArea:with: #angleWith: #dotProduct: #isSelfEvaluating #'<=' #to:intersects:to: #'//' #isInsideCircle:with:with: #< #scaleFrom:to: #corner: #to:sideOf: #x #'>=' #roundDownTo: #onLineFrom:to:within: #transposed #ceiling #angle #basicType #translateBy: #asFloatPoint #'' #adaptToNumber:andSend: #abs #negated #octantOf: #asIntegerPoint #flipBy:centerAt: #scaleBy: #floor #onLineFrom:to: #isPoint #reflectedAbout: #/ #dist: #asNonFractionalPoint #bearingToPoint: #reciprocal #rotateBy:centerAt: #rotateBy:about: #rounded #setX:setY: #squaredDistanceTo: #normalized #veryDeepCopyWith: #- #storeOn: #rect: #deepCopy #isIntegerPoint #min #adhereTo: #adaptToString:andSend:)
  • 18. Single Inheritance Object subclass: #Point! ! instanceVariableNames: 'x y'! ! classVariableNames: ''! ! poolDictionaries: ''! ! category: 'Kernel-BasicObjects' 2 instance variables subclass of Object
  • 19. 3 kinds of messages Unary messages Binary messages Keywords messages 5 factorial! Transcript cr 3 + 4 3 raisedTo: 10 modulo: 5! ! Transcript show: 'hello world'
  • 20. • Anonymous method • Passed as method argument or stored • Functions fct(x)= x*x+3, fct(2). ! fct :=[:x| x * x + 3]. fct value: 2 ! Blocks
  • 21. Control structures Every control structure is realized by message sends 4 timesRepeat: [Beeper beep] max: aNumber! ! ^ self < aNumber ! ! ! ifTrue: [aNumber] ! ! ! ifFalse: [self]
  • 22. <= aPoint ! ! "Answer whether the receiver is neither! ! below nor to the right of aPoint."! ! ! ^ x <= aPoint x and: [y <= aPoint y] A typical method in Point Method name Argument Comment Return Binary message Keyword messageInstance variable Block (2@3) <= (5@6) true
  • 23. Complete Syntax on a PostCard exampleWithNumber: x “A method that has unary, binary, and key word messages, declares arguments and temporaries (but not block temporaries), accesses a global variable (but not and instance variable), uses literals (array, character, symbol, string, integer, float), uses the pseudo variable true false, nil, self, and super, and has sequence, assignment, return and cascade. It has both zero argument and one argument blocks.” |y| true & false not & (nil isNil) ifFalse: [self halt]. y := self size + super size. #($a #a ‘a’ 1 1.0) do: [:each | Transcript show: (each class name); show: (each printString); show: ‘ ‘]. ^ x < y
  • 25. Language + Environment are closely linked
  • 28. The tools manipulate these Objects
  • 31. Demo: Changing a class at runtime
  • 34. There is so much more…
  • 37. Continuous API Testing keep your services under control 24/7 Norbert Hartl norbert@2denker.de www.2denker.de
  • 38. eMCee is a montoring service for backend interfaces - Web application to define backend interfaces - Monitors reliability of interface periodically - Sends warning if status of interface changes - Provides overview graphs about reliability - Snapshots requests for debugging purposes mail@2denker.de
  • 40. • Entry Level Track & Trace Product • Complements T3 Full Product • One Page Javascript HTML5 / Ajax Client • REST Back End in Pharo Smalltalk • Gateways to multiple data providers
  • 41. Pharo Consortium Managed by INRIA Who: companies, institutions, user groups Privileged access to the core development team Influence priorities of the next development http://consortium.pharo.org
  • 44. Instance Variables as Objects —> Slots ! Proxy model in the base language ! Structuring reflective API (—> Mirrors) More Reflection
  • 45. AST Everywhere Used in Tools for Navigation ! Do we need to store text? ! Use for Behavioral Reflection Beyond Text
  • 46. Put “virtualization” in the language We already use “Images” Make the Image a first class concept in the language System - as - Objects
  • 47. Open Pharo SprintsMay 2008 Bern July 2009 Bern October 2009 Lille November 2009 Buenos Ares March 2010 Bern May 2010 Buenos Ares June 2010 Bern June 2010 Bruxelles July 2010 London September 2010 Barcelona September 2010 Lille January 2011 Lille July 2011 Lille October 2011 Bruxelles February 2012 Bern April 2012 Lille September 2012 Ghent October 2013 Lille November 2013 Buenos Aires