I've been using Pharo professionally for about 1.5 months now, and I'm beginning to getting the hang of the language, and the culture surrounding it.
I'll share a couple of thoughts.
__General Development/Hacking__
0. From Pharo 9 and onwards, it runs smooth on an M1 Mac.
1. If you're interested in developing in Pharo professionally, we're hiring [1]!
1b. Other ways to learn about Pharo is to come to Smalltalk/Pharo conferences. I've been to the Pharo Days in Lille recently and I've learned a lot in those 3 days! Other than the Pharo Days there is ESUG.
1c. Check out the Discord channel. People have been really helpful [0].
2. A big part of the documentation can be found inside the image. For example, press SHIFT + enter and type "tutorial" or "exercise" and a few will come up. Moreover, when you click on any class, there's a "class comment" tab. Some class comments actually have comments and they're written out in a quite understandable fashion when they do.
3. You can make the following clicks and they do something different:
- Click: shows a context menu to showcase a particular window / tool
- Right click: shows "World Contents", aka objects about your GUI (I haven't used this one yet)
- Shift + Option + click: this shows a "halo" around a GUI
- Shift + Control + Click: the coolest meta click there is, it shows all objects that are directly related to the pixel you clicked on. If you clicked on a table cell item in a GUI window, you can figure it out via this click. I've used this trick to figure out where to go in order to alter my IDE to my own taste.
4. Pharo is one of the few languages I know where you can create like a game or application for which it's possible to immediately see the source code and interact with it. The use-case this allows for is highly hackable open-source applications. For example, here's a game that allows you to design chips [2]. It's easy to see how you could alter levels yourself quite easily, just start editing the code! IMO, that's next level open-source.
5. If you want to, it's relatively easy-ish to inspect the AST and see how it's mapped to the VM. Be careful of setting breakpoints here, you'll crash your image :P
6. A Smalltalker told me that Pharo's VM enforces everything to be an object but technically not everything is an object, as far as VM implementation goes. If you're not hacking on the VM, then you can assume everything is an object.
7. Overwriting the #doesNotUnderstand: message can lead to all kinds of fun! I wrote my custom If/Elif/Else DSL. Smalltalkers will hate me but I found it awesome because it showcases how one could hack a DSL quickly. You can see about it here [3]. Here's some example code:
As you can see, I've hacked the _: to be a separator of some sorts, but what it actually is, is an argument of a message. You can do all kinds of fun stuff with this. See [8].
8. When you overwrite #doesNotUnderstand then you can inspect the message and its arguments. So whether you send Object1 a:arg1 veryImportant:arg2 message:arg3, then you can inspect those arguments. In the case above, this means you can also inspect _:arg1 _:arg2 or _:arg1 _:arg2 _:arg3 ... _;argN. In other words, you can deal with variable arguments and it doesn't matter what they're called. Because of this, it's easy to create a simple DSL, if you need another separator, then simply add one. You have a lot of characters at your disposal that are quite unique [4]. I figured that out by using by using point (2) and just looking around in the environment.
__Web Development__
9. Seaside is capable of live and dynamic updating. MOOCs won't tell you this because it requires using Seaside quite differently. In short, the pattern that I see used at my work is by having server-side rendered HTML that has designated blocks as callbacks. So when you send your server-side rendered HTML, those callback blocks will transform itself into a jQuery GET/POST request. Pharo writes the jQuery for you. We also use React, but I haven't gotten around to it how it's used, I'm fairly sure we don't use anything like Redux.
10. In terms of testing, it's relatively easy to write tests. As with Go, it's all included and you're ready to test! Also note: if you want to use Selenium tests, you can use Parasol [5], it's quite easy to use.
11. The following concepts are not explained well, so I'll do it: Seaside heavily uses what we'd call middleware in NodeJS (filters in Seaside). In NodeJS/Express we also have a request object that exists during the lifetime of a request. In Seaside this is called a dynamic variable (WADynamicVariable is the class).
__Stuff I wrote out in the open__
12. I've been working on refactoring i18n in Seaside [6]. I currently find the approach Pharo uses the nicest approach, which is something along the lines of:
'You have some string that needs translation in your web app' SeasideTranslated
When you want to export a catalog file of all the strings you want to translate, then you send exportCatalog new exportCatalog and it will look through the whole image and find every tagged string and export it into a catalog (.pot) file that you can edit with POEdit (a free Mac app [7]).
13. I wrote a simple animation that shows the definition of sin and cos [8]. Most of the code is shown in that video, IMO it gives a good enough sense how to use it.
__Bottom Line Thoughts__
14. I think Pharo is a production-ready language for SaaS apps where you can easily scale by adding instances. I am not sure if it'd be production-ready for consumer facing web apps with many concurrent users.
15. It's an amazing language to create desktop applications for.
16. The debugger capabilities are awesome and there's active research on it. Time travel debugging is currently in its PoC phase (source: Pharo Days).
17. It's also a good language for live music making (source: Pharo Days where someone demo-ed some live coded acid music).
[1] We're hiring developers able to work in Europe and based in a European time zone. The way we use Pharo is IMO the real deal, it goes far beyond what any MOOC can teach you.
> Be careful of setting breakpoints here, you'll crash your image :P
I accidentally defined `=` on a class with an incomplete implementation. I think I saved it just out of habit.
Of course, this royally buggered the entire image because the class browser evaluated `=` when trying to open that specific class.
I was doing this in Squeak rather than Pharo, but that was a scary moment when my mental model before that was to do a `git checkout` to revert the change. I think I ended up writing some code to find the method and delete it, before I realised there was a change browser where I could discard that implementation.
The biggest barrier to entry was really understanding the concept of the image and that you do all the work in the class browser, rather than building a hierarchy of classes that all branch out from a main class.
> before I realised there was a change browser where I could discard that implementation.
Haha nice!
There's also a changes file.
I guess I have another recommendation: Pharo is not just about the image. When you click on an image folder there are other files. Try to figure out what they do and how you could use it to your advantage. Check out what the pharo-local folder does for example. The iceberg folder there, for example, directly hosts the .git folder. I've used it at times if I couldn't get whatever I wanted to do in Iceberg to work (e.g. adding a remote). The .sources file shows the changes that you have.
For sure. I started off with Squeak so I eventually got the git package installed and, in addition to updating the image and the changes file, it also wrote out the classes I added to disk - basically a directory being the class and every file inside the directory being the implementation of a method.
It's hard for me to see what I'd deploy this way, as a pet project, but it's teaching me a lot more about a nice way to do OOP that also gives you an environment in which OOP can thrive.
A bit late to the show, but I'm trying to use Pharo on an M1.
It runs for sure, however the interface is blurry. Seems like it doesn't know how to render hi dpi. Is there some setting to get that right?
I'll share a couple of thoughts.
__General Development/Hacking__
0. From Pharo 9 and onwards, it runs smooth on an M1 Mac.
1. If you're interested in developing in Pharo professionally, we're hiring [1]!
1b. Other ways to learn about Pharo is to come to Smalltalk/Pharo conferences. I've been to the Pharo Days in Lille recently and I've learned a lot in those 3 days! Other than the Pharo Days there is ESUG.
1c. Check out the Discord channel. People have been really helpful [0].
2. A big part of the documentation can be found inside the image. For example, press SHIFT + enter and type "tutorial" or "exercise" and a few will come up. Moreover, when you click on any class, there's a "class comment" tab. Some class comments actually have comments and they're written out in a quite understandable fashion when they do.
3. You can make the following clicks and they do something different:
- Click: shows a context menu to showcase a particular window / tool
- Right click: shows "World Contents", aka objects about your GUI (I haven't used this one yet)
- Shift + Option + click: this shows a "halo" around a GUI
- Shift + Control + Click: the coolest meta click there is, it shows all objects that are directly related to the pixel you clicked on. If you clicked on a table cell item in a GUI window, you can figure it out via this click. I've used this trick to figure out where to go in order to alter my IDE to my own taste.
4. Pharo is one of the few languages I know where you can create like a game or application for which it's possible to immediately see the source code and interact with it. The use-case this allows for is highly hackable open-source applications. For example, here's a game that allows you to design chips [2]. It's easy to see how you could alter levels yourself quite easily, just start editing the code! IMO, that's next level open-source.
5. If you want to, it's relatively easy-ish to inspect the AST and see how it's mapped to the VM. Be careful of setting breakpoints here, you'll crash your image :P
6. A Smalltalker told me that Pharo's VM enforces everything to be an object but technically not everything is an object, as far as VM implementation goes. If you're not hacking on the VM, then you can assume everything is an object.
7. Overwriting the #doesNotUnderstand: message can lead to all kinds of fun! I wrote my custom If/Elif/Else DSL. Smalltalkers will hate me but I found it awesome because it showcases how one could hack a DSL quickly. You can see about it here [3]. Here's some example code:
``` If _: (someCondition) _: [ "code" ] Elif _: (anotherCondition) _: [ "more code" ] Else _: [ "final code" ] ```
As you can see, I've hacked the _: to be a separator of some sorts, but what it actually is, is an argument of a message. You can do all kinds of fun stuff with this. See [8].
8. When you overwrite #doesNotUnderstand then you can inspect the message and its arguments. So whether you send Object1 a:arg1 veryImportant:arg2 message:arg3, then you can inspect those arguments. In the case above, this means you can also inspect _:arg1 _:arg2 or _:arg1 _:arg2 _:arg3 ... _;argN. In other words, you can deal with variable arguments and it doesn't matter what they're called. Because of this, it's easy to create a simple DSL, if you need another separator, then simply add one. You have a lot of characters at your disposal that are quite unique [4]. I figured that out by using by using point (2) and just looking around in the environment.
__Web Development__
9. Seaside is capable of live and dynamic updating. MOOCs won't tell you this because it requires using Seaside quite differently. In short, the pattern that I see used at my work is by having server-side rendered HTML that has designated blocks as callbacks. So when you send your server-side rendered HTML, those callback blocks will transform itself into a jQuery GET/POST request. Pharo writes the jQuery for you. We also use React, but I haven't gotten around to it how it's used, I'm fairly sure we don't use anything like Redux.
10. In terms of testing, it's relatively easy to write tests. As with Go, it's all included and you're ready to test! Also note: if you want to use Selenium tests, you can use Parasol [5], it's quite easy to use.
11. The following concepts are not explained well, so I'll do it: Seaside heavily uses what we'd call middleware in NodeJS (filters in Seaside). In NodeJS/Express we also have a request object that exists during the lifetime of a request. In Seaside this is called a dynamic variable (WADynamicVariable is the class).
__Stuff I wrote out in the open__
12. I've been working on refactoring i18n in Seaside [6]. I currently find the approach Pharo uses the nicest approach, which is something along the lines of:
'You have some string that needs translation in your web app' SeasideTranslated
When you want to export a catalog file of all the strings you want to translate, then you send exportCatalog new exportCatalog and it will look through the whole image and find every tagged string and export it into a catalog (.pot) file that you can edit with POEdit (a free Mac app [7]).
13. I wrote a simple animation that shows the definition of sin and cos [8]. Most of the code is shown in that video, IMO it gives a good enough sense how to use it.
__Bottom Line Thoughts__
14. I think Pharo is a production-ready language for SaaS apps where you can easily scale by adding instances. I am not sure if it'd be production-ready for consumer facing web apps with many concurrent users.
15. It's an amazing language to create desktop applications for.
16. The debugger capabilities are awesome and there's active research on it. Time travel debugging is currently in its PoC phase (source: Pharo Days).
17. It's also a good language for live music making (source: Pharo Days where someone demo-ed some live coded acid music).
[0] https://discord.gg/QewZMZa
[1] We're hiring developers able to work in Europe and based in a European time zone. The way we use Pharo is IMO the real deal, it goes far beyond what any MOOC can teach you.
https://yesplan.be/en/vacancy/full-stack-software-engineer
[2] https://github.com/pavel-krivanek/PharoChipDesigner
[3] https://www.youtube.com/watch?v=BUEnRrUZ-Ug
[4] ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ
[5] https://github.com/SeasideSt/Parasol
[6] https://github.com/SeasideSt/Seaside/tree/gettext-fix
[7] https://poedit.net/features
[8] https://drive.google.com/file/d/1Z3UwTAj4A2CRo_TXk6JNG-mN9yM...