Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to learn Pharo [closed]

I installed Pharo 1.4 and tried to read "Pharo by example".

Unfortunately, the book and the Pharo image were totally out of synch with each other: menus were different; classes used as examples were not there e.g; BouncingAtomsMorph class.

It is a pity. Maybe one should use a specific Pharo version to learn and another to get up to date...can anyone help?

like image 597
Sharphawk Avatar asked Jan 19 '13 07:01

Sharphawk


Video Answer


2 Answers

As your question is a bit vague (understandably), and I do not know your background or your needs, I'll try to give a short overview over Pharo, so that you know where to look for, as you gain more experience and your needs evolve.

Language Basics

As Uko has pointed out, if you are new to Smalltalk the best way to get started is to follow Prof Stef's tutorial. This will get you familiar with the core aspects of the language. For quick reference, you can use the Pharo Cheatsheet.

Basic Tooling

After you have completed the tutorial, you should familiarize yourself with the tools so that you can work effectively in Pharo. Vital tools, as you probably already know, are the Class Browser, the Inspector and the Debugger.

Learning from Code Examples

The Class Browser has a lot of useful features, in particular it allows you to search the system for method and class references, pointing you to concrete code examples. You can right-click on any method and then choose "Senders of..." in the context menu. Similarly, for classes, you can look for references (Analyze -> Class Refs). This will tell you how particular classes and methods are used, and more than often, will get you faster to the information you need.

Another indispensible tool is Spotter (shift-enter), which provides an easy to use interface to browse the system (for classes and examples). But you'd have to use recent Pharo version.

Ecosystem Overview

That being said, the Pharo ecosystem is quite huge and it will take you some time to get the most out of it (I have been working with Pharo for quite some time now, and there are many things I still have to learn).

Depending on your needs, Pharo has a lot to offer:

  • Roassal (for software & data visualization)
  • Glamourous Toolkit (GT) (including Spotter, the Debugger, and the Inspector). GT allows you to customize all of its tools. For instance, you can customize the inspector very easily to have domain-specific views for your objects. Lots of built-in libraries, such as PetitParser, have customized interfaces that allow you to work more effectively with objects.
  • Morphic for writing GUIs. There is also Spec, a DSL built on top of morphic, which allows you to describe user-interfaces.
  • Monticello for version control and building packages that can be deployed to other images.
  • SUnit for writing testcases.

Roassal is very different from Morphic as it is tailored for rendering all sorts graphs in nice layouts (while it is possible to do that in Morphic as well, you'd have to write a lot of code). Also Roassal uses Vector Graphics, Morphic is raster-based. If you want to write GUIs or a game, I'd stick to morphic. If you have to visualize data, use Roassal.

An excellent introduction into the core concepts of Morphic is given by Maloney (the originator of Morphic). Some class names have changed, but you'll figure it out. There are also different ways in doing event handling in Morphic. One way is to override methods (like you are used from other object-oriented GUI frameworks), another way is to "route" events to methods. I have used both methods, and I'd pick the first one for simpler applications.

Start with a simple project

My advice would be to start with the very basics, best with a small project, for instance a game like Snake. Add things as you learn and if you are stuck, feel free to ask questions on stackoverflow. Also, there is the Pharo mailing list. I found that the Pharo / Smalltalk community is very welcoming.

My last advice would be: Keep things simple. It's not always easy to do, but Smalltalk is a great environment to learn this principle. You'd also want to look at Kent Beck's Best Practice Patterns if you are looking for ways how to organize your code.

Have fun!

Edit: Holy thread resurrection! I just realized that the question is over 4 years old. Well, maybe this post if some help to other newcomers.

like image 117
ftl Avatar answered Oct 26 '22 15:10

ftl


For absolute beginners, the following is a very recent practical and hands-on tutorial, covering just the basics to get you going:

http://ceronio.net/2017/07/first-steps-with-pharo-smalltalk/

like image 41
mydoghasworms Avatar answered Oct 26 '22 16:10

mydoghasworms