how can I make a thing that can be run?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

how can I make a thing that can be run?

Kendall Shaw
Hi,

I'm playing with squeak, and I'm having a hard time getting started. If
I could make something that can be run by someone other than me, I would
feel like I had done the "hello world" exercise. So, for example, I'd
like to know how to make a SqueakPage, or how to make a SqueakMap
package, or how to download someone else's and read it.

I unzipped the ProgrammingMorhps.pr file and I can see some smalltalk
code in there. At the top it looks like text with mac line endings, and
I see what matches a description of smalltalk fileOut format, but at the
end of the file is a bunch of binary data.

Can someone tell me how I can find an entry point into it, so I can walk
through how it's doing what it does? Or, the same information for some
other runnable thing?

The web page linked to in the SqueakPage class comment is either binary
data, or in some non-roman alphabet that I dont' understand.

Reply | Threaded
Open this post in threaded view
|

Re: how can I make a thing that can be run?

Dan Corneanu
Kendall Shaw wrote:

> Hi,
>
> I'm playing with squeak, and I'm having a hard time getting started. If
> I could make something that can be run by someone other than me, I would
> feel like I had done the "hello world" exercise. So, for example, I'd
> like to know how to make a SqueakPage, or how to make a SqueakMap
> package, or how to download someone else's and read it.
>
> I unzipped the ProgrammingMorhps.pr file and I can see some smalltalk
> code in there. At the top it looks like text with mac line endings, and
> I see what matches a description of smalltalk fileOut format, but at the
> end of the file is a bunch of binary data.

Have you tried WorldMenu->Projects->load project from file ?
You can look to the code using the  SystemBrowser from the Tools drawer.

> Can someone tell me how I can find an entry point into it, so I can walk
> through how it's doing what it does? Or, the same information for some
> other runnable thing?
>
> The web page linked to in the SqueakPage class comment is either binary
> data, or in some non-roman alphabet that I dont' understand.
>


Reply | Threaded
Open this post in threaded view
|

Re: how can I make a thing that can be run?

Kendall Shaw
Corneanu Dan wrote:
> Kendall Shaw wrote:

>> I unzipped the ProgrammingMorhps.pr file and I can see some smalltalk
>> code in there. At the top it looks like text with mac line endings, and
>> I see what matches a description of smalltalk fileOut format, but at the
>> end of the file is a bunch of binary data.
>
> Have you tried WorldMenu->Projects->load project from file ?
> You can look to the code using the  SystemBrowser from the Tools drawer.

Well, that loads the project. And I can browse the classes that it
loaded. But, is there a way for me to tell what it did to instantiate
itself, aside from by deduction?


Reply | Threaded
Open this post in threaded view
|

Re: how can I make a thing that can be run?

cbeler
In reply to this post by Kendall Shaw

>
> I'm playing with squeak, and I'm having a hard time getting started.

welcome ;)

> If I could make something that can be run by someone other than me, I
> would feel like I had done the "hello world" exercise. So, for
> example, I'd like to know how to make a SqueakPage, or how to make a
> SqueakMap package, or how to download someone else's and read it.

I think here it's all a question on how to use Monticello (to make .mcz
package and publish them).
If your intend is more about squeak project, it must be different and I
don't know  otherwise read the paper at this adress
http://www.iam.unibe.ch/~scg/Teaching/Smalltalk/Exercises-Smalltalk0405.pdf


Cédrick

Reply | Threaded
Open this post in threaded view
|

Re: how can I make a thing that can be run?

Dan Corneanu
In reply to this post by Kendall Shaw
Kendall Shaw wrote:

> Corneanu Dan wrote:
>> Kendall Shaw wrote:
>
>>> I unzipped the ProgrammingMorhps.pr file and I can see some smalltalk
>>> code in there. At the top it looks like text with mac line endings, and
>>> I see what matches a description of smalltalk fileOut format, but at
>>> the
>>> end of the file is a bunch of binary data.
>>
>> Have you tried WorldMenu->Projects->load project from file ?
>> You can look to the code using the  SystemBrowser from the Tools drawer.
>
> Well, that loads the project. And I can browse the classes that it
> loaded. But, is there a way for me to tell what it did to instantiate
> itself, aside from by deduction?
>
>
Hmmm, I'm not sure I get your question right but I think you're doing a
confusion.
You can save any project to a file using WorldMenu->Projects->save
project on local file only.
The resulting file is not like a c++ or Java program you can compile and
execute or read it.
It is the serialized representation of the Project instance you are saving.
If you want to see what happens when you save/load a project then take a
look to
Project>>exportSegmentFileName: aFileName directory: aDirectory
ProjectLoading Class>>openFromDirectory: aDirectory andFileName: aFileName

All the classes loaded by a project are also objects associated with the
project instance (take a look to change sets).
So they were also serialized like normal objects when you have saved the
project.
Take a look to http://minnow.cc.gatech.edu/squeak/1817

I hope this helps.

Reply | Threaded
Open this post in threaded view
|

Re: how can I make a thing that can be run?

stéphane ducasse-2
Hi Dan,

Doru (yes) is saying hello to you :)))
Finally some squeakers in Roumania.
Excellent!

Stef

> Hmmm, I'm not sure I get your question right but I think you're  
> doing a
> confusion.
> You can save any project to a file using WorldMenu->Projects->save
> project on local file only.
> The resulting file is not like a c++ or Java program you can  
> compile and
> execute or read it.
> It is the serialized representation of the Project instance you are  
> saving.
> If you want to see what happens when you save/load a project then  
> take a
> look to
> Project>>exportSegmentFileName: aFileName directory: aDirectory
> ProjectLoading Class>>openFromDirectory: aDirectory andFileName:  
> aFileName
>
> All the classes loaded by a project are also objects associated  
> with the
> project instance (take a look to change sets).
> So they were also serialized like normal objects when you have  
> saved the
> project.
> Take a look to http://minnow.cc.gatech.edu/squeak/1817
>
> I hope this helps.
>


Reply | Threaded
Open this post in threaded view
|

Re: how can I make a thing that can be run?

Kendall Shaw
In reply to this post by Dan Corneanu
Corneanu Dan wrote:
> Hmmm, I'm not sure I get your question right but I think you're doing a
> confusion.

The part about the Project class looks like it is an answer to the
question I was trying to ask. An application would be a serialized
Project. So, for example, Hello world would be a project displaying
hello world, opened in a world.

Kendall

> You can save any project to a file using WorldMenu->Projects->save
> project on local file only.
> The resulting file is not like a c++ or Java program you can compile and
> execute or read it.
> It is the serialized representation of the Project instance you are saving.
> If you want to see what happens when you save/load a project then take a
> look to
> Project>>exportSegmentFileName: aFileName directory: aDirectory
> ProjectLoading Class>>openFromDirectory: aDirectory andFileName: aFileName
>
> All the classes loaded by a project are also objects associated with the
> project instance (take a look to change sets).
> So they were also serialized like normal objects when you have saved the
> project.
> Take a look to http://minnow.cc.gatech.edu/squeak/1817
>
> I hope this helps.
>
>


Reply | Threaded
Open this post in threaded view
|

Re: how can I make a thing that can be run?

Göran Krampe
Kendall Shaw <[hidden email]> wrote:

> Corneanu Dan wrote:
> > Hmmm, I'm not sure I get your question right but I think you're doing a
> > confusion.
>
> The part about the Project class looks like it is an answer to the
> question I was trying to ask. An application would be a serialized
> Project. So, for example, Hello world would be a project displaying
> hello world, opened in a world.
>
> Kendall

There are numerous ways to deliver squeak "apps" or code. Project files
are used primarily for eToys or "demos" of code.
Most projects in the Squeak community are delivered in source form
instead, using a variety of file formats:

        .st (or .st.gz compressed) - the good old fileout of code. Not used
much anymore.
        .cs (or .cs.gz compressed) - changesets. They are like patches from the
regular world, quite nifty but can be confusing.
        .mcz - Monticello package. This is the "standard" today and is what
most people use. The file is a zip file with source in it, in a special
format to be loaded by Monticello.
        .sar - This is also a zip file with a code snippet inside for
performing the install of the rest of the contents. .mcz files only
contain code so a .sar file can be used as a wrapper in order to include
other kinds of files too.

Well, there you go. There are some other forms too, but here is my
recommendation:

        - For a simple standalone class or a couple of classes, use .st if you
really don't have time to learn something else. Just use the "fileout"
menu choices in the standard browser (on a class or a class category).
        - Use project files for eToys or "demos".
        - Use .cs files (changesets) for small bug fixes etc. It has been
customary for quite some time.
        - Use .mcz files for delivering your package. In short - learn how to
use Monticello.
        - Use a .sar file if you somehow need to complement your .mcz files
with other kinds of files like .gif files etc.

And to put something on SM - just get an account, produce a file of any
of the above formats, upload it using the web UI and create a package
and a release of it. Done.

regards, Göran

Reply | Threaded
Open this post in threaded view
|

Re: how can I make a thing that can be run?

Kendall Shaw
[hidden email] wrote:

> Kendall Shaw <[hidden email]> wrote:
> There are numerous ways to deliver squeak "apps" or code. Project files
> are used primarily for eToys or "demos" of code.
> Most projects in the Squeak community are delivered in source form
> instead, using a variety of file formats:
>
> .st (or .st.gz compressed) - the good old fileout of code. Not used
> much anymore.
> .cs (or .cs.gz compressed) - changesets. They are like patches from the
> regular world, quite nifty but can be confusing.
> .mcz - Monticello package. This is the "standard" today and is what
> most people use. The file is a zip file with source in it, in a special
> format to be loaded by Monticello.
> .sar - This is also a zip file with a code snippet inside for
> performing the install of the rest of the contents. .mcz files only
> contain code so a .sar file can be used as a wrapper in order to include
> other kinds of files too.

Thanks. This and your other suggestions seem to be about how to package
an application. But, what I don't get is how you make something that
does something, aside from by a Project.

For example, with C there is a "main" routine that is the entry point,
so that when you have a C program you "run" it, in one uniform way for
all programs (more or less) that causes it to "execute".

Is there something like that, in these other packaging schemes? Some
standard instantiation interface that gets invoked to run your app? Or
does the user have to know for each class to open a workspace and type in:

Blah something: blah somethingElse: blah.

The Project seems to do something like that, because you could have some
GUI thing open that the user will see. Is there another similar mechanism?



Reply | Threaded
Open this post in threaded view
|

Re: how can I make a thing that can be run?

Göran Krampe
Kendall Shaw <[hidden email]> wrote:

> [hidden email] wrote:
> > Kendall Shaw <[hidden email]> wrote:
> > There are numerous ways to deliver squeak "apps" or code. Project files
> > are used primarily for eToys or "demos" of code.
> > Most projects in the Squeak community are delivered in source form
> > instead, using a variety of file formats:
> >
> > .st (or .st.gz compressed) - the good old fileout of code. Not used
> > much anymore.
> > .cs (or .cs.gz compressed) - changesets. They are like patches from the
> > regular world, quite nifty but can be confusing.
> > .mcz - Monticello package. This is the "standard" today and is what
> > most people use. The file is a zip file with source in it, in a special
> > format to be loaded by Monticello.
> > .sar - This is also a zip file with a code snippet inside for
> > performing the install of the rest of the contents. .mcz files only
> > contain code so a .sar file can be used as a wrapper in order to include
> > other kinds of files too.
>
> Thanks. This and your other suggestions seem to be about how to package
> an application. But, what I don't get is how you make something that
> does something, aside from by a Project.
>
> For example, with C there is a "main" routine that is the entry point,
> so that when you have a C program you "run" it, in one uniform way for
> all programs (more or less) that causes it to "execute".

Again there are numerous options. :) Here are a few:

- If you start an app in an image and then save the image, it will
already be running when the image is restarted.

- If you deliver an image to an enduser you can also start it with
command line arguments. One argument can be an .st file to filein -
which is the same as executing it. So the file can contain just a
snippet of code to execute, just like in a workspace.

- When installing code into the image there are several "hooks" to
actually run something:
        - Class side initialize methods, they are executed when the class is
installed into the image.
        - Changeset files have preambles and postscripts - two optional
snippets of code that are executed before and after the filein.
        - Sar files have as I said a script that gets run when it is
installing.
        - .mcz files I am unsure about, the class initialize methods are of
course run, but not sure if there are other ways too.

In class side initialize methods you can hook up into menues in the
system, hook up into the startUp sequence of the image etc etc.

regards, Göran

Reply | Threaded
Open this post in threaded view
|

Re: how can I make a thing that can be run?

Dan Corneanu
In reply to this post by Kendall Shaw
Kendall Shaw wrote:

> [hidden email] wrote:
>> Kendall Shaw <[hidden email]> wrote:
>> There are numerous ways to deliver squeak "apps" or code. Project files
>> are used primarily for eToys or "demos" of code.
>> Most projects in the Squeak community are delivered in source form
>> instead, using a variety of file formats:
>>
>>     .st (or .st.gz compressed) - the good old fileout of code. Not used
>> much anymore.
>>     .cs (or .cs.gz compressed) - changesets. They are like patches
>> from the
>> regular world, quite nifty but can be confusing.
>>     .mcz - Monticello package. This is the "standard" today and is what
>> most people use. The file is a zip file with source in it, in a special
>> format to be loaded by Monticello.
>>     .sar - This is also a zip file with a code snippet inside for
>> performing the install of the rest of the contents. .mcz files only
>> contain code so a .sar file can be used as a wrapper in order to include
>> other kinds of files too.
>
> Thanks. This and your other suggestions seem to be about how to package
> an application. But, what I don't get is how you make something that
> does something, aside from by a Project.
>
> For example, with C there is a "main" routine that is the entry point,
> so that when you have a C program you "run" it, in one uniform way for
> all programs (more or less) that causes it to "execute".

Here lies the error :)
There is a major difference between Squeak and C regarding the
context in which code is executed. In C your program is responsible
for rebuilding your "world" every time it is run (allocate new
objects, initialization etc.) The operating system is responsible
for running the executable file in a new process so there must be a
convention about the entry point in the executable (the main(...)
function for C compilers)

In Squeak you always have your own world (the loaded image) with
Classes, Object instances etc. you are working in. If you load a
.st,.cs,.mcz then you end up with some more Classes in the image.
Later you can instantiate this classes and eventually send some
message to the instances. There is no convention of what is the
entry point like there is in C (there is no need for it :) ). Most
of the time there is a comment in the package telling you how to
make use of it.

Projects (and saving loading them from file) add a little bit more.
When you load a project you also add some new objects (instances) to
your image besides new Classes. This is way your project appears to
you in the same state as it was when the owner has saved it (some
windows already opened etc) and you can start 'clicking' around.

Think of it like a table full of toys. Someone puts a new toy on it.
You can start playing with it any way you like but don't expect all
of them to come in the same shape.

> Is there something like that, in these other packaging schemes? Some
> standard instantiation interface that gets invoked to run your app? Or
> does the user have to know for each class to open a workspace and type in:
>
> Blah something: blah somethingElse: blah.
>
> The Project seems to do something like that, because you could have some
> GUI thing open that the user will see. Is there another similar mechanism?

Reply | Threaded
Open this post in threaded view
|

Re: how can I make a thing that can be run?

Edgar J. De Cleene
In reply to this post by Kendall Shaw
Kendall Shaw puso en su mail :

> For example, with C there is a "main" routine that is the entry point,
> so that when you have a C program you "run" it, in one uniform way for
> all programs (more or less) that causes it to "execute".
>
> Is there something like that, in these other packaging schemes? Some
> standard instantiation interface that gets invoked to run your app? Or
> does the user have to know for each class to open a workspace and type in:
>
> Blah something: blah somethingElse: blah.
Smalltalk and Squeak demands you are a child again, brain wash all your 20
years of computing and start fresh.

Ot something similar happens to me what always said have Pascal burned in my
brain ROM.

No main.

The far away closer could be each class have a initialization process what
was runned automatic.

For Squeak , from 3.7 until now, is usual each class have a "initialize"
method , what runs when you type MyClass new in a Workspace.

But exist other ways too and lots of GUI forms of doing.

I currently train students what finds better refactorize my old first steps
in this wonderful world as they also think procedural.

If you think what could do that and have IRC, Yahoo chat or ICQ, email me.

Edgar



       
       
               
___________________________________________________________
1GB gratis, Antivirus y Antispam
Correo Yahoo!, el mejor correo web del mundo
http://correo.yahoo.com.ar