[Pharo-project] Pharo by Example
mike at mjr104.co.uk
Thu Jan 5 09:19:03 CET 2012
On 5 Jan 2012, at 05:50, "Gerry Weaver" <gerryw at compvia.com> wrote:
> 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.
> 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.
> 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
FillInTheBlankMorph request: 'hello'
And context click accept. Now open a workspace. Evaluate
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.
> -----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:
>>> 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:
>> and try the exemple in the book ?
>> Serge Stinckwich
>> UMI UMMISCO 209 (IRD/UPMC), Hanoi, Vietnam
>> Matsuno Laboratory, Kyoto University, Japan (until 12/2011)
>> Every DSL ends up being Smalltalk
More information about the Pharo-project