Best place to ask Smalltalk questions?

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

Best place to ask Smalltalk questions?

SeanTAllen
If I have beginner Smalltalk questions. What is the best forum for  
asking those?

Here even if they aren't squeak specific?
Some other mailing list?


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Best place to ask Smalltalk questions?

Randal L. Schwartz
>>>>> "Sean" == Sean Allen <[hidden email]> writes:

Sean> If I have beginner Smalltalk questions. What is the best forum for
Sean> asking those?

Sean> Here even if they aren't squeak specific?

If you're learning Smalltalk by using Squeak, it makes sense to ask them here.
If you're not using Squeak to learn, it might be best to start with an
appropriate list for that vendor, simply because you might not know whether
it's Squeak-specific or not.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Best place to ask Smalltalk questions?

SeanTAllen

On Aug 1, 2008, at 6:01 PM, Randal L. Schwartz wrote:

>>>>>> "Sean" == Sean Allen <[hidden email]> writes:
>
> Sean> If I have beginner Smalltalk questions. What is the best forum  
> for
> Sean> asking those?
>
> Sean> Here even if they aren't squeak specific?
>
> If you're learning Smalltalk by using Squeak, it makes sense to ask  
> them here.
> If you're not using Squeak to learn, it might be best to start with an
> appropriate list for that vendor, simply because you might not know  
> whether
> it's Squeak-specific or not.

i'm using squeak but i also know they arent really squeak specific  
questions...

design type things like...

you have an instance variable you only want to allow to set once,
never again ( in that fashion its like variable binding in erlang. )
what is the accepted smalltalk way to do this? is there one?

or

how are the equivalent of c++ virtual methods handled in smalltalk?
what is the standard idiom for that design pattern?

those are two, i have more. is this the right forum? if not,
where would be the right forum?

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Best place to ask Smalltalk questions?

Tapple Gao
On Sat, Aug 02, 2008 at 12:08:51AM -0400, Sean Allen wrote:
> you have an instance variable you only want to allow to set once,
> never again ( in that fashion its like variable binding in erlang. )
> what is the accepted smalltalk way to do this? is there one?

ivar: aValue
    ivar ifNotNil: [self error: 'variable already set'].
    ^ ivar := aValue

> how are the equivalent of c++ virtual methods handled in smalltalk?
> what is the standard idiom for that design pattern?

All methods in Smalltalk are virtual, i.e., looked up when
called.

> those are two, i have more. is this the right forum? if not,
> where would be the right forum?

Here or squeak-dev.

--
Matthew Fulmer -- http://mtfulmer.wordpress.com/
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Best place to ask Smalltalk questions?

SeanTAllen

On Aug 2, 2008, at 12:44 AM, Matthew Fulmer wrote:

> On Sat, Aug 02, 2008 at 12:08:51AM -0400, Sean Allen wrote:
>> you have an instance variable you only want to allow to set once,
>> never again ( in that fashion its like variable binding in erlang. )
>> what is the accepted smalltalk way to do this? is there one?
>
> ivar: aValue
>    ivar ifNotNil: [self error: 'variable already set'].
>    ^ ivar := aValue
>

so what i was doing is the correct way to do it.
>> how are the equivalent of c++ virtual methods handled in smalltalk?
>> what is the standard idiom for that design pattern?
>
> All methods in Smalltalk are virtual, i.e., looked up when
> called.
>

let me clarify that question.

if I have class foo that is meant to only be descended from,
never instantiated directly. and it has method bar that needs
to made concrete by its descendents, what is the standard idiom for
that?

is there a specific error that should be thrown or just:

foo
   self error: 'any old error here'

is there a particular error that is common practice to use?


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Best place to ask Smalltalk questions?

Benjamin Schroeder-2

On Aug 2, 2008, at 10:43 AM, Sean Allen wrote:

> if I have class foo that is meant to only be descended from,
> never instantiated directly. and it has method bar that needs
> to made concrete by its descendents, what is the standard idiom for
> that?
>
> is there a specific error that should be thrown or just:
>
> foo
>  self error: 'any old error here'
>
> is there a particular error that is common practice to use?

You can do

        foo

                self subclassResponsibility

in such cases.

Ben Schroeder

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Best place to ask Smalltalk questions?

SeanTAllen

On Aug 2, 2008, at 10:50 AM, Benjamin Schroeder wrote:

>
> On Aug 2, 2008, at 10:43 AM, Sean Allen wrote:
>
>> if I have class foo that is meant to only be descended from,
>> never instantiated directly. and it has method bar that needs
>> to made concrete by its descendents, what is the standard idiom for
>> that?
>>
>> is there a specific error that should be thrown or just:
>>
>> foo
>> self error: 'any old error here'
>>
>> is there a particular error that is common practice to use?
>
> You can do
>
> foo
>
> self subclassResponsibility
>

thanks ben. ok i have another. lets take something that in a sql  
driven environment would be a lookup table.
countries and states. what the the smalltalk way with this?

ive come up with two basic ideas...

each country and each state/province is a single instance of their  
respective classes ( the class layout i can
see a few different options but that isnt the thrust of the  
question. ). if its a single instance, then you have to
deal with creation of each instance... how do you handle the instance  
creation? what is the normal method
for setting up data to create them? monticello in the instances? have  
class side data that is used to build?
this idea seems nice from being able to equality based on object  
equality but it seems like its generally
overblown... however you could attach customized functionality easily  
if needed to different instances
so that nice. ( in the past with C++, i would just load in data from a  
file on startup and create the objects
the data file called for.... )

the other way i can see is to store all the information needed in  
class variables and create instances
as needed when the are asked for. this seems much easier to manage but  
it feel less smalltalk.
then again i dont really know what a smalltalk way really is, but a  
lookup data structure in class
variables dont feel like it.

is one of these more smalltalk? is there something else more suited as  
a smalltalk solutuion?
in the app i'm using to learn smalltak etc, i have this same basic  
pattern come up several times
so I'd prefer to use the best method from the start so 3-6 months from  
now I dont have a 'o I should have done
it this way because with smalltalk that allows... ' kind of moment.

Thanks to everyone for the help so far and any advice on tackling this.
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

RE: Best place to ask Smalltalk questions?

Ron Teitelbaum
Hi Sean,

> ok i have another. lets take something that in a sql
> driven environment would be a lookup table.
> countries and states. what the the smalltalk way with this?

There are a number of patterns for this.  Not all of them are strictly
object oriented.  The easiest way to do this is to use a database to hold
and coordinate the data.  Then you would query for the data and instantiate
objects as needed (and maybe cache some frequently used ones).

Your suggestion of using a class variable or a class method that is
responsible for creating all of your instances also makes sense.  You can
either build all the instances and save them in your image or build the
instances during startup or lazily when needed.  You need to have some root
to hold those new instances to keep them from being garbage collected.  This
can also be done with a class variable.  Just set a class variable to a
collection of your instances, then use that variable to lookup your
instances.

Having an external file is also a good way to go.  The same issues arise
from the file as for putting the data in a method, but benefit of using the
file is that your data is not saved in code and can be updated without
changing your running image, although your image needs to know when the file
changes so that it can refresh your instances.  

Hope that helps,

Ron Teitelbaum



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners