2015 pharo prague lambda meetup

Post on 18-Jul-2015

422 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Pharo: Live objects for complex projects

http://stephane.ducasse.free.fr http://www.pharo.org

I did my PhD in Lisp and Scheme :)

Talk Roadmap• Pharo: an open-source project

• Get the feel

• Model/Syntax

• Coding with the audience

• Web Development in Pharo

• Ongoing works

• Wrap-up

http://www.pharo.orgPure object language Great community of active doers Powerful and full access Elegant and fun to program Living system under your fingers 100% MIT inside Mac, Linuxes, Windows, iOS

A powerful engine to invent (y)our future

Some projectsWeb frameworks - Seaside, iliad, HTTP2, Tide, Aida, Mustache, Oauth, WebSocket CSS styling Format parsers - XML, HTML, NeoJSON, NeoCSV. Application Security, Graphics frameworks - Roassal, Mondrian, EyeSee, GraphET, Tool builders - Glamour, Spec, XUL, MacNative, Databases - DBXTalk, Mongo, Riak, CouchDB, MySql, PunQLite. Object-Oriented databases - Magma, Goods. Database abstraction - Voyage, ROE MetaCompiler - Petit Parser, SmaCC - Proxy, Logging - SystemLogger, Toothpick, SimpleLogger Units: Aconcagua, Units Time - Chronos Calendars, Timezones Productivity Tools - Codecritics, Refactorings, Cherry picking merge tools: merge tool, Komitter Versionner, Mock frameworks (baby mock), PDFgeneration - Artefact, Testing frameworks - PhExample, SUnit Assembly generation: ASMJIT, Integration Tools: Hudson, Alternate window manager, Games: Tetris, Sokoban, Miner, Chess, CrossWords MetaModeling Frameworks - Magritte, Platypus, Cloud deployement - cloudfork cloudPharo, 3D: Roassal3d, NBOpenGL, JVM connection Bio informatics, ODE solvers, Interactive Geometry - DrGeo…

Some projectsWeb frameworks - Seaside, iliad, HTTP2, Tide, Aida, Mustache, Oauth, WebSocket CSS styling Format parsers - XML, HTML, NeoJSON, NeoCSV. Application Security, Graphics frameworks - Roassal, Mondrian, EyeSee, GraphET, Tool builders - Glamour, Spec, XUL, MacNative, Databases - DBXTalk, Mongo, Riak, CouchDB, MySql, PunQLite. Object-Oriented databases - Magma, Goods. Database abstraction - Voyage, ROE MetaCompiler - Petit Parser, SmaCC - Proxy, Logging - SystemLogger, Toothpick, SimpleLogger Units: Aconcagua, Units Time - Chronos Calendars, Timezones Productivity Tools - Codecritics, Refactorings, Cherry picking merge tools: merge tool, Komitter Versionner, Mock frameworks (baby mock), PDFgeneration - Artefact, Testing frameworks - PhExample, SUnit Assembly generation: ASMJIT, Integration Tools: Hudson, Alternate window manager, Games: Tetris, Sokoban, Miner, Chess, CrossWords MetaModeling Frameworks - Magritte, Platypus, Cloud deployement - cloudfork cloudPharo, 3D: Roassal3d, NBOpenGL, JVM connection Bio informatics, ODE solvers, Interactive Geometry - DrGeo…

AND MUCH

MORE

Our goal...

An ecosystem where innovation/business bloom

We want that **you** can make money with Pharo. We want to be able to invent solutions to existing problems.

!

We want a powerful innovative dynamic language where we can build our future.

We are a cool community

Tweets, blogs, buzz

Pharo 3,303 tweets / 1092 followers S. Ducasse tweets 669 / 804 followers S. Stinckwich 8712 / 1006 followers Moose 502 tweets / 255 followers Youtube Pharo smalltalk: about 1540 videos!

• Uni. of Buenos Aires • Uni. of Bern • Uni. of Maroua • Uni. of Brussels • Ecole des Mines de Douai • Uni. de Savoie • Ivan Franko Nat. Uni. of Lviv • Czech Technical Uni. • CULS Prague• Uni. of Quilmes • Uni. of La Plata • Northern Michigan Uni. • Uni. Technologica Nacional (UTN) • Uni. Catholic of Argentina • Uni. of Chile • Uni. Policnica de Catalunya • Uni. de Bretagne Occidentale • Uni. of Tomsk • Uni. of Fernhagen • IT University of Copenhagen • Uni. Cat del Sacro Cuore of Brescia

Pharo's Teachers

Lafhis (AR)Software Composition Group (CH) CAR (FR)RMOD (FR) Ummisco (IRD) Reveal (CH) Lysic (FR)Pleiad (CL) CEA-List (FR) Uqbar (AR) CCMI-FIT(CZ)

Research Groups

www.2denker.de www.agilitic.com

www.airflowing.com www.anymorphic.com www.ardishealth.com

www.beta9.be www.bombardier.com

www.cmsbox.com www.finworks.biz

seaside.gemstone.com www.ibizlog.com www.inceptive.be www.jooshr.com www.majcon.de

www.mindclue.ch

www.miriamtech.com www.myneat.org www.netstyle.ch

www.panasoft.com www.pinesoft.co.uk

www.promedmedical.net www.sharedlogic.ca

www.smallworks.com.ar www.10pines.com www.trantaria.com www.yesplan.be

www.synectique.eu www.sorabito.com objectprofile.com

!

Companies

BooksPharo by example http://www.pharobyexample.org

translated to french, merci!

translated to spanish, gracias!

translated to japanese, ありがとう!

Deep into Pharo http://www.deepintopharo.org

Numerical Methods

https://github.com/SquareBracketAssociates/NumericalMethods/releases

New books in preparation

Updated Pharo by Example

Entreprise Pharo

Fun with Pharo

Some success stories…

Continuous API Testingkeep your services under control 24/7

Norbert Hartl norbert@2denker.dewww.2denker.de

eMCee is developed and deployed using pharo

- zinc

- seaside

- jquery

- magritte

- mongotalk

- magritte-mongo

- fuel

- metacello

mail@2denker.de

Sunday 20 May 12

• 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

Sunday 20 May 12

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

NTed: disaster scenario recovery

iBizLog - http://www.ibizlog.com

A product by SmallworksTuesday, May 15, 12

Pinesoft MBagger

Since may 2008Pharo 4.0 - Apr/Jul 2015 (1271 issues closed…)

Pharo 3.0 - Apr 2013 (2364 issues closed)

Pharo 2.0 - Apr 2013 (1727 issues closed)

Pharo 1.4 - Apr 2012 (860 updates)

Pharo 1.3 (700 updates)

Pharo 1.2 - mar 2011 (500 updates)

Pharo 1.1 - jul 2010 (410 updates)

We are improving the complete system!

Of course not everything is perfect :) But it feels like that:

Pharo is

yours

with 20 min per week you can get an impact!

Getting the object feel

• Live interaction

• Using Inspectors

• Talk and interact with objects

• Programs are objects too

http://youtu.be/CuimMwuZiGA

Scripting livehttps://www.youtube.com/watch?v=1Nze9tnwYxY

http://www.pharocasts.com/2010/08/see-how-to-get-data-from-url-parse-xml.html

Simplicity and elegance

• Syntax fits on a postcard!

• Simple but complete object model

The complete syntaxexampleWithNumber: x “A method that illustrates every part of Smalltalk method syntax”

<menu>

| 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

The complete syntaxexampleWithNumber: x “A method that illustrates every part of Smalltalk method syntax”

<menu>

| 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

Less is more!No constructors, no static methods, no operators

No type declaration, no primitive types,

No interfaces, no need for factory

No packages/private/protected modifiers

No parametrized types

No boxing/unboxing

Still powerful

A Pure OO World

Only objects! mouse, booleans, arrays, numbers, strings, windows, scrollbars, canvas, files, trees, compilers, sound, url, socket, fonts, text, collections, stack, shortcut, streams, …

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:)

Classes are objects too

!

Point instVarNames

Classes are objects too

!

Point instVarNames

>#('x' 'y')

Methods are public

Methods are all late-bound

Instance variables are protected

Single Inheritance

Summary• Everything is an object

• Single inheritance, public methods, protected attributes

• One single model

• Classes are simply objects too

• A class is instance of another class

• One unique method lookup, look in the class of the receiver

Messages + Objects

postman.send(mail,recipient);

postman.send(mail,recipient);

postman send mail recipient

postman send mail to recipient

postman send: mail to: recipient

2 + 5

2 + 5

> 7

Yes + is a message sent to 2

Unary messages

Binary messages

Keywords messages

5 factorial!Transcript cr

3 + 4

3 between: 10 and: 5!!Transcript show: 'hello world'

Blocks: Closures all the way

• Anonymous method

• Passed as method argument or stored • Functions fct(x)= x*x+3, fct(2). !

fct :=[:x| x * x + 3]. fct value: 2

!

Every control structure is a message

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]

Method name Argument Comment

Return Binary messageKeyword messageInstance variable

Block

(2@3) <= (5@6) true

Object subclass: #Point!! instanceVariableNames: 'x y'!! classVariableNames: ''!! category: 'Kernel-BasicObjects'

2 instance variables

subclass of Object

Fun with numbers

1 class

1 class

> SmallInteger

1 class maxVal

> 1073741823

(1 class maxVal + 1)

(1 class maxVal + 1)

> 1073741824

(1 class maxVal + 1) class

!

(1 class maxVal + 1) class

> LargePositiveInteger

1000 factorial

>

1000 factorial

> 402387260077093773543702433923003985719374864210714632543799910429938512398629020592044208486969404800479988610197196058631666872994808558901323829669944590997424504087073759918823627727188732519779505950995276120874975462497043601418278094646496291056393887437886487337119181045825783647849977012476632889835955735432513185323958463075557409114262417474349347553428646576611667797396668820291207379143853719588249808126867838374559731746136085379534524221586593201928090878297308431392844403281231558611036976801357304216168747609675871348312025478589320767169132448426236131412508780208000261683151027341827977704784635868170164365024153691398281264810213092761244896359928705114964975419909342221566832572080821333186116811553615836546984046708975602900950537616475847728421889679646244945160765353408198901385442487984959953319101723355556602139450399736280750137837615307127761926849034352625200015888535147331611702103968175921510907788019393178114194545257223865541461062892187960223838971476088506276862967146674697562911234082439208160153780889893964518263243671616762179168909779911903754031274622289988005195444414282012187361745992642956581746628302955570299024324153181617210465832036786906117260158783520751516284225540265170483304226143974286933061690897968482590125458327168226458066526769958652682272807075781391858178889652208164348344825993266043367660176999612831860788386150279465955131156552036093988180612138558600301435694527224206344631797460594682573103790084024432438465657245014402821885252470935190620929023136493273497565513958720559654228749774011413346962715422845862377387538230483865688976461927383814900140767310446640259899490222221765904339901886018566526485061799702356193897017860040811889729918311021171229845901641921068884387121855646124960798722908519296819372388642614839657382291123125024186649353143970137428531926649875337218940694281434118520158014123344828015051399694290153483077644569099073152433278288269864602789864321139083506217095002597389863554277196742822248757586765752344220207573630569498825087968928162753848863396909959826280956121450994871701244516461260379029309120889086942028510640182154399457156805941872748998094254742173582401063677404595741785160829230135358081840096996372524230560855903700624271243416909004153690105933983835777939410970027753472000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

1000 factorial / 999 factorial

1000

1000

Learning from the system…

Check in the system

Let us hack something…

(3 D20 + 3 D4) roll

The Pharo Stack is Gorgeous

Voyage/ DBXTalk / Mongo / (Gemstone :)

Magritte

Zinc, Zodiac(HTTPS), Oauth, ...

STON, JSON, LDAP...

Seaside, Rest, Zinc Rest, Illiad, Aida, Reef

Amber!

Dynamic Web Applications with Seaside

!

http://seaside.st

Demo

1Natural Flow

Demo

<form action="result.html"> <input type="hidden" name="value1" value="<% value1 %>"> <input type="text" name="value2"> <input type="submit" value="OK"> </form>

<p> <% value1 + value2 %> </p>

<form action="second.html"> <input type="text" name="value1"> <input type="submit" value="OK"> </form>

<form action="result.html"> <input type="text" name="value2"> <input type="submit" value="OK"> </form>

Who cares about HTTP anyway?

is different

Concentrate on your application ...

... no manual request parsing

... no XML configuration files

3 user interactions

3 lines of code

value1 := self request: ‘First Number’.

value2 := self request: ‘Second Number’.

self inform: value1 + value2.

AB

call:A Bx :=

AB

answer:B

A

x :=

We don’t think in pages ...

..., but in stateful components

Valid

Sour

ce: s

tock

.xch

ng, A

l Nak

ib

Did you notice?

Web applications

No URL fiddling

No request parsing

Development tools

Control flow at ease

On going work

• Working bootstrap for pharo reflective core

• Customized images (11k)

• First class variables for real

• associations

• data flow model

Glimpse on going work

• Package catalog

• Git (the right subset)

• OSWindow (SDL)

• Multi touch support

• Full vector graphics

VM• Spur: new memory manager (got *4 speed up)

• ephemerons, pinned object, fragmented memory, 64 bits

• Sista: next level JIT

• inliner, constant propagation…

• Unified FFI + threaded

• one syntax several back-ends

Fun, simple Pure & elegant Productive Empowering Addictive Full access

Creating good energy, software quality,

learning and having fun !

http://pharo.org

Join

top related