[Newbies] a titleize function?

David Mitchell david.mitchell at gmail.com
Fri Mar 19 19:55:34 UTC 2010


In Smalltalk, as in Ruby, just add the useful method to the class. (You
could also add the code to an instance, but it is far less common in
Smalltalk than in Ruby.)

You can still put this in a "library." The de facto library in Squeak is a
Monticello package.

You 'create' a Monticello package by creating a class category in the
browser. (For example, MyApplication-Core or MyApplication-View or
MyApplication-Tests).

Monticello can keep your extensions to other people's classes by adding a
specially named method category. It has to start with an asterisk (*) and
then match the first part of your class category. For example,
*myapplication or *myapplication-printing

When you share your Monticello .mcz, it will automatically include your
classes and any extensions to other classes. I'm using the term extension in
a Smalltalky way, as opposed to using the term monkey-patching.

If you are writing an application, usually you will have no problems.

If you are writing libraries that others will find useful, then you may want
to "namespace" your methods by adding a prefix indicating your application.
The Magma OO database defines a method magmaOid on Object rather than taking
the name oid.


On Fri, Mar 19, 2010 at 11:21 AM, sergio_101 <sergiolist at village-buzz.com>wrote:

> i know there is one in rails.. i might just look at the code and adapt it..
>
> but.. this makes me wonder..
>
> since this would probably be a handy function to have in strings...
>
> should i add it to a personal library/collection, or add it directly
> to strings? or extend strings?
>
> how do smalltalkers usually do this kind thing?
>
> --
>
> ----
> peace,
> sergio
> photographer, journalist, visionary
>
> http://www.coffee-black.com
> http://www.painlessfrugality.com
> http://www.twitter.com/sergio_101
> http://www.facebook.com/sergio101
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20100319/1e6e7ecd/attachment.htm


More information about the Beginners mailing list