Mission Pharo Kernel

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

Transcript of Mission Pharo Kernel

Page 1: Mission Pharo Kernel

Mission Pharo KernelESUG 2016, Prague

Pavel Krivanek and Christophe Demarey

Page 2: Mission Pharo Kernel

New librariesNew toolsNew testsMore documentation

Pharo is growing

Page 3: Mission Pharo Kernel

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

Code for future useDuplicitiesObsolete codeDO-NOT-TOUCH code

Page 5: Mission Pharo Kernel
Page 6: Mission Pharo Kernel

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

Modularity

Page 8: Mission Pharo Kernel

Pharo Kernel

Page 9: Mission Pharo Kernel

From top

- cleaning- shrinking- reloading

From bottom

bootstrapping from zero - reloading -

Page 10: Mission Pharo Kernel

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

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

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

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

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

Bootstrapped & reloaded from GIT

Page 16: Mission Pharo Kernel

Let's talk about BOOTSTRAP

Page 17: Mission Pharo Kernel

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

langage itself »

Bootstrap

Page 18: Mission Pharo Kernel

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

Why bootstraping is difficult?

Page 20: Mission Pharo Kernel

Archaelogy

Page 21: Mission Pharo Kernel
Page 22: Mission Pharo Kernel

Dead code!

Page 23: Mission Pharo Kernel

Strange things

Page 24: Mission Pharo Kernel

cleanups

Page 25: Mission Pharo Kernel

Missing code

Page 26: Mission Pharo Kernel

The dependency hell

Page 27: Mission Pharo Kernel

Cut dependencies

Page 28: Mission Pharo Kernel

Code refactoring

Page 29: Mission Pharo Kernel

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

Tools support

Page 31: Mission Pharo Kernel

Dependency Analyser

Page 32: Mission Pharo Kernel

Dependency dashboard

X 2

Page 33: Mission Pharo Kernel

Dependency visualization

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

Page 34: Mission Pharo Kernel

The bootstrap process

Page 36: Mission Pharo Kernel

1Day

Page 37: Mission Pharo Kernel
Page 38: Mission Pharo Kernel

2Day

Page 39: Mission Pharo Kernel

3Day

Page 40: Mission Pharo Kernel

4Day

Page 41: Mission Pharo Kernel

5Day

process

Page 42: Mission Pharo Kernel

6Day

Page 43: Mission Pharo Kernel

7Day

Page 44: Mission Pharo Kernel

More details

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

Page 45: Mission Pharo Kernel

Story #2

Page 46: Mission Pharo Kernel

Road to a working bootstrap

Page 47: Mission Pharo Kernel

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

Bootstrap challenge> language side bootstrap

Page 49: Mission Pharo Kernel

Road to a working bootstrap

First bootstrapped image!

Page 50: Mission Pharo Kernel

Road to a working bootstrap

Page 51: Mission Pharo Kernel

Road to a working bootstrap

We run the image …

… VM crash

Page 52: Mission Pharo Kernel

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

Road to a working bootstrap

Compile VM in debug mode

Run bootstrapped image through Xcode / LLDB

Page 54: Mission Pharo Kernel

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

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

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

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

«  Always leave the campgroundcleaner than you found it. »

-Boy Scout rule, Uncle Bob