[Pharo-project] Pharo by Example

Michael Roberts mike at mjr104.co.uk
Sat Jan 7 14:56:16 CET 2012


It is hopefully explained somewhere in a book....

It is more complex than needed by history. Here is what I roughly understand:

Categories are the original mechanism to group classes together. The browser shows this as the left most pane and there are tools to allow you to reorganise it as you want. The category is just a string associated with the class (or the class' organiser). 

All code originally lived in the ST80 (or early squeak) image. You could move it around externally by filing it out either into a .st file or change set .cs file.  Class and method definitions in this chunk format are quite flexible and specify the changes that should be made on file-in. You are not constrained to move whole classes or whole class categories around. 

The history of Smalltalk source control is varied. Various projects map image representation of classes onto file
based representation in CVS, SVN and so on. 

Packages in general mean the mapping of a subset of the image onto an external source control construct. I.e. a modularisation of the image that can be shared in a distributed developer environment. 

Various Smalltalks do this in various ways. The dominant squeak derived system is Monticello.  A class category can be mapped onto a Monticello package. Monticello defines a file format which is the physical representation of the package. It provides tools to manage these packages. Part of the complexity currently is that you are not forced to have the system cleanly separated into packages. You can leave bits of the system unpackaged and you currently have to bootstrap (at some point in history) the source management (package) system into an image based on categories. Since there is an overlap of design concerns and implementations it is not obvious what tools or file formats do what. 

In general in Pharo there is a desire to move towards a more modular system. There is a desire to cleanly bootstrap this system from some kernel specification. Ideally we would then have a namespace implementation that allowed us to isolate and load conflicting code. We also need package dependency management and do on. 

You will see references to these goals and discussions on all these topics from time to time. Some of these are implemented, some of these are deprecated, and the wish list is long.  

You wouldn't really start out fresh with the combination of concepts and implementations we currently have in Pharo. 

Not sure what collections are in this context.

Hope that helps
Mike
 

On 5 Jan 2012, at 08:37, "Gerry Weaver" <gerryw at compvia.com> wrote:

> Hi Michael,
> 
> Well... that actually makes good sense (maybe  the terminology is my issue). I think I've written C code for so long that I get too bogged down in the details. So, what exactly is a category vs a collection vs a package?. I seems like a category is just a mechanism for organizing code?. I guess a package would be like a Lisp module or C library? What about collections?
> 
> 
> Thanks for your help. It really did help.
> Gerry  
> 
> 
> 
> -----Original Message----- 
>> From: "Michael Roberts" <mike at mjr104.co.uk> 
>> To: Pharo-project at lists.gforge.inria.fr 
>> Date: 01/05/12 02:18 
>> Subject: Re: [Pharo-project] Pharo by Example 
>> 
>> On 5 Jan 2012, at 05:50, "Gerry Weaver" <gerryw at compvia.com> wrote:
>> 
>>> Hi,
>>> 
>>> Perhaps I should just take a shot at explaining what I'm having trouble understanding.
>>> 
>>> 
>>> My current take on the environment is that an image is basically a container that holds everything in the application.
>> 
>> Indeed. 
>> 
>>> In development mode it also includes the IDE and tools.
>> 
>> For general Pharo images there is no "mode". They all contain some set of development tools. To remove them you have to go to some effort (stripping) or find a smaller seed image that does not contain them (expert).
>> 
>>> I assume one would typically start by defining a class that was a subclass of some system or package class.
>> 
>> You could start with Object. 
>> 
>>> I assume this process would continue until the application logic and data were defined.
>> 
>> Yes
>> 
>>> I also assume that there must be a way to indicate the class that represents the top level or entry point (main) of the application.
>> 
>> Not really. There is no main() as there is in C. There is an entry point for the whole system and this triggers the start of the UI and other services. If you want your application to start on system start you need to register it on the startup list (or whatever the current abstraction is.)
>> 
>> For development you can register the start on a world menu or just use a workspace to evaluate the starting expression. 
>> 
>>> That appears to be the init method. Is this anywhere close to being correct?
>>> 
>>> 
>>> The problem is that I'm not sure how to get started. I have played around with the system browser a bit. I can see that you would create a category and be presented with what looks to be a template for a class. I'm confused about the fact that the "Pharo by Example" has me creating a package when I don't see that in the 1.3 browser.
>> 
>> So for PBE you have to run the exact image the book was targeted for and the examples should work. 
>> 
>>> I also don't know how to create additional classes in that category or how to tell the environment which class is my application entry point. I figure maybe the answer to all of this is a little too much for a mailing list question, which is why I didn't start out asking this. Anyway, at least this gives you an idea of where I'm stuck. Maybe my brain just isn't wired to understand something that may be obvious to others.
>>> 
>> 
>> So for the standard/original system browser I would do the following. In the left most pane you can context click and create a new category 'example'. You get shown a class template in the bottom pane that is an expression to make a class. Type the name of the subclass e.g. ExampleClass into the text where it says NameOfSubclass and context click accept. This makes the new class. On the class side (the button class) define a method go. To do this you need the method template. Normally you get this selecting one of the method protocols. You can replace the method template with something like
>> 
>> go
>>     FillInTheBlankMorph request: 'hello'
>> 
>> And context click accept. Now open a workspace. Evaluate 
>> 
>> ExampleClass go
>> 
>> It should pop up a dialog. That's really it. The "application" runs and then stops. 
>> 
>> To make more classes click on the class category again. Type a new class name on and accept it. The new class should appear alongside the other one and you can add methods to it. 
>> 
>> Hope that helps. 
>> Mike
>> 
>> 
>>> 
>>> Thanks,
>>> Gerry
>>> 
>>> 
>>> 
>>> 
>>> -----Original Message----- 
>>>> From: "Serge Stinckwich" <serge.stinckwich at gmail.com> 
>>>> To: Pharo-project at lists.gforge.inria.fr 
>>>> Date: 01/04/12 23:04 
>>>> Subject: Re: [Pharo-project] Pharo by Example 
>>>> 
>>>> On Thu, Jan 5, 2012 at 11:45 AM, Gerry Weaver <gerryw at compvia.com> wrote:
>>>>> Hi,
>>>>> 
>>>>> I've been trying various downloads, but I haven't found anything that works. I guess I may be making it harder than it needs to be, but I really have no idea how to proceed. I've been trying to find some doc on basic things like creating a package, class, etc., but I'm not having much luck. I assume the docs will be updated at some point. Would anyone have a feel for when that might be? I'm not in a hurry at all, so I could wait for a couple of more versions.
>>>> 
>>>> Could give us more information about what is not working exactly ?
>>>> Did you upload the file here:
>>>> https://gforge.inria.fr/frs/download.php/27023/PBE-1.0.zip
>>>> and try the exemple in the book ?
>>>> 
>>>> Regards,
>>>> -- 
>>>> Serge Stinckwich
>>>> UMI UMMISCO 209 (IRD/UPMC), Hanoi, Vietnam
>>>> Matsuno Laboratory, Kyoto University, Japan (until 12/2011)
>>>> http://www.mechatronics.me.kyoto-u.ac.jp/
>>>> Every DSL ends up being Smalltalk
>>>> http://doesnotunderstand.org/
>>> 
>>> 
>>> 
>>> 
> 
> 
> 
> 



More information about the Pharo-project mailing list