How to learn Pharo [closed]
Asked Answered
L

4

11

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?

Libel answered 19/1, 2013 at 7:50 Comment(5)
Which edition of PbE are you reading?Albaugh
yes indeed, sorry fro the typo, the version of Pharo is 1.4!!Libel
The PBE version is the one of 2009-10-28 which can be openly downloaded from the internet here: pharobyexample.orgLibel
It seems that your problem is simply (as you indicated) that the version of Pharo you are using is out of synch with the book. There is a second edition out which is more recent and probably covers Pharo 1.4: rmod.lille.inria.fr/pbe2. If you want to use the old version, you should probably have a look at Pharo 1.2 (which is the oldest available version I can find on the project homepage).Albaugh
That's not a second edition of the same book, it's a new volume 2 that is a sequel.Monica
B
14

First of all be sure to complete Prof Stef's tutorial, it gives basic knowledge. You can start the tutorial by executing

ProfStef go.

in a workspace. Just type it in the workspace, select it, right-click, Do it

There is also a Pharo collaborative book that has interesting things. And there are Pharocasts that can help you to learn something interesting.

Also you can ask questions here on Stack Overflow an tag them with or if it's more general and people will help you out.

Bartolemo answered 19/1, 2013 at 12:11 Comment(1)
Yes ProfStef I went through that, thanks!!Libel
H
7

As said by @Sharphawk, there is an image to be used with the book, available from the homepage. It's a bit old by now, but it should be in sync with the book.

Pharo simply evolves too fast for us to keep up with the book (there are still many chapters under progress), so with recent images you'll have to adapt and discover a bit by yourself. Fortunately there are a lot of other ressources where you can get help: here of course, mailing lists for the book and for Pharo itself, the #pharo-project IRC channel on irc.freenode.net, the books & screencasts pointed to by @uko, etc.

From experience, Smalltalk is much easier to learn with some exploration and mentoring

Hyman answered 19/1, 2013 at 12:41 Comment(7)
Thanks a lot for the advice, but the PBE-Pharo package you indicated does not work :-(.My Linux is a 64 bit Linux and I get the message "libGLU.so.1: cannot open shared object file: No such file or directory could not find module vm-display-X11" . I checked and this lib does exist but in its 64 bit version while probably the package it meant for 32 bits. Something must be rotten in IT if that after so many layers of software the 32-64 bits still makes a difference :-).Libel
Well, it's normal that you can't link a 32bit program with a 64bit library, after all those are different architectures, even if related. You have to install the 32bit version of that library, I believe.Hyman
What about layer independence? What about the layer which is supposed to hide "implementation details" of lower layers from higher layer? 32-64 bits is just a stupid HW detail, like 16-32 bits was 10 years ago. IT failed to fulfill its promises!! Sometimes I think computer science is like socialism and marriage, it solves those problems which without it would have never appeared.:-)Libel
This being said, though I think it's more then time to avoid being dependent of HW architecture for things like 64-32 bit words, once I installed a 32-bit version of the missing lib (only that one!!) the package started to work. It was a pleasant surprise !! Anyhow, still the package complained that other "libs" are missing but ignored that. Till now it behaves...Libel
@Libel that problem is at the OS / distribution level. Some systems have binaries that contains code for multiple architectures and thus work everywhere. Some don't. Anyway, what do you expect 32-bit code to do with a 64-bit pointer?Hyman
For instance it would be nice if a distribution of Pharo or Squeak, would contain the required LIBS, would detect the architecture 32-64 bit architecture (I bet this is easy since some even display it ) and load & use the correct ones. After all they do that already for LINUX, MAC and Window.Libel
We would indeed welcome contributions towards this :)Hyman
K
3

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/

Khan answered 18/7, 2017 at 17:3 Comment(1)
Great introduction.Quoit
Q
3

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.

Quoit answered 19/7, 2017 at 17:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.