mission pharo kernel - esug.org › data › esug2016 › 04-thursday › 1000-1030... · mission...

58
Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey

Upload: others

Post on 07-Jun-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Mission Pharo KernelESUG 2016, Prague

Pavel Krivanek and Christophe Demarey

Page 2: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

New librariesNew toolsNew testsMore documentation

Pharo is growing

Page 3: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Pharo evolution

Squeak 3.9 Pharo 1.0 Pharo 1.1 Pharo 1.2 Pharo 1.3 Pharo 1.4 Pharo 2.0 Pharo 3.0 Pharo 4.0 Pharo 5.0

Classes

Packages

LOC

Page 4: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Code for future useDuplicitiesObsolete codeDO-NOT-TOUCH code

Page 5: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries
Page 6: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Pharo ZEN● Easy to understand, easy to learn from, easy to change.● Objects all the way down.● Examples to learn from.

● Fully dynamic and malleable.● Beauty in the code, beauty in the comments.

● Simplicity is the ultimate elegance.● Better a set of small polymorphic classes than a large ugly one.● Classes structure our vocabulary.

● Messages are our vocabulary.● Polymorphism is our esperanto.

● Abstraction and composition are our friends.● Tests are important but can be changed.

● Explicit is better than implicit.● Magic only at the right place.● One step at a time.● There is no unimportant fix.● Learning from mistakes.● Perfection can kill movement.● Quality is a emerging property.

● Simple processes to support progress.● Communication is key.

● A system with robust abstractions that a single person can understand.

Page 7: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Modularity

Page 8: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Pharo Kernel

Page 9: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

From top

- cleaning- shrinking- reloading

From bottom

bootstrapping from zero - reloading -

Page 10: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

From top shrinking and modularization

- started before Pharo- removing of code is easy- clean removing is not easy- reloading is even harder

Morphic reloaded [22.07.2006]

Page 11: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Kernel image evolution in shortcut

BROKEN!works again

BROKEN!works again

BROKEN!works again

BROKEN!works again

BROKEN!works again

BROKEN!works again

BROKEN!works again

Broken again... [18.8.2016]

Page 12: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Why so hard and long?

Everyone needs to

take of care of modularity

integrated inintegrated indevelopment processdevelopment process(tests, rules, CI jobs) (tests, rules, CI jobs)

Page 13: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

CI jobs for Pharo modularization

- since Pharo 2.0

- shrink image- increase granularity of reloaded modules- tests- coverage testing- experiments (Tanker)

https://ci.inria.fr/pharo/view/6.0-SysConf/

Page 14: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

CI jobs for Pharo modularization

Kernel image (shrinked / bootstrapped)+ Monticello + Network support+ Remote repositories support+ Metacello= minimal Pharo+ SUnit, Display support, UFFI+ Morphic core, Morphic+ UI, Basic tools, IDE= Pharo

Page 15: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Bootstrapped & reloaded from GIT

Page 16: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Let's talk about BOOTSTRAP

Page 17: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

« The process that builds the minimalinfrastructure of a langage reusable to define the

langage itself »

Bootstrap

Page 18: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Why do we need a bootstrap ?

● Have a known initial state

● Be able to reproduce the state of a system

● Ensure we can reinitialize the system at any time

● Ease Kernel evolution

● Identify a small subset of the language allowingthe definition of the language itself

Page 19: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Why bootstraping is difficult?

Page 20: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Archaelogy

Page 21: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries
Page 22: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Dead code!

Page 23: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Strange things

Page 24: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

cleanups

Page 25: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Missing code

Page 26: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

The dependency hell

Page 27: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Cut dependencies

Page 28: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Code refactoring

Page 29: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

How to fix bad dependencies?

Create a new package to isolate functionnalities

Move some methods as extensions to anotherpackage

Re-design completely a functionalitye.g. startup list

...

Page 30: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Tools support

Page 31: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Dependency Analyser

Page 32: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Dependency dashboard

X 2

Page 33: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Dependency visualization

https://ci.inria.fr/pharo/job/Pharo-6.0-DependencyAnalysis/ws/bootstrap-dependency-report-graph.html

Page 34: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

The bootstrap process

Page 36: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

1Day

Page 37: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries
Page 38: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

2Day

Page 39: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

3Day

Page 40: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

4Day

Page 41: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

5Day

process

Page 42: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

6Day

Page 43: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

7Day

Page 44: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

More details

cf phd Guillermo Polito: https://hal.inria.fr/tel-01251173

Page 45: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Story #2

Page 46: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Road to a working bootstrap

Page 47: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Bootstrap challenge> language side bootstrap

Language initialization generally done VM side

We want to do it language side (image side):need to run code on top of a language under

construction

Page 48: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Bootstrap challenge> language side bootstrap

Page 49: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Road to a working bootstrap

First bootstrapped image!

Page 50: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Road to a working bootstrap

Page 51: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Road to a working bootstrap

We run the image …

… VM crash

Page 52: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Road to a working bootstrap> some debugging examples

Missing class in the boostrape.g. Float

Super class not set

Super class set to a wrong value

Page 53: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Road to a working bootstrap

Compile VM in debug mode

Run bootstrapped image through Xcode / LLDB

Page 54: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Road to a working bootstrap> verifying the bootstrap

Rely on Pharo tests (>8 000 tests)● Load SUnit● Load test packages● Run tests

Page 55: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Wants to know more?

Bootstrap process hosted on Pharo CI server

https://ci.inria.fr/pharo/view/Pharo%20bootstrap/

GitHub repository

https://github.com/guillep/PharoBootstrap

Page 56: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Conclusion

Having a modular system requires a lot of energy• Easy to break• Concern of everyone

We now have a working Pharo bootstrappedimage.We are able to load packages on top to build a fullPharo-image (UI, IDE, etc.)

Page 57: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

Roadmap

Make the boostrap process more robust

Up-to-date package dependencies for the Pharoimage + use of Cargo package manager

Build the official Pharo image on top of thebootstrap

Make the kernel smaller (e.g. kick out Unicode)

Page 58: Mission Pharo Kernel - esug.org › data › ESUG2016 › 04-Thursday › 1000-1030... · Mission Pharo Kernel ESUG 2016, Prague Pavel Krivanek and Christophe Demarey. New libraries

«  Always leave the campgroundcleaner than you found it. »

-Boy Scout rule, Uncle Bob