Peeping At The KeyHole

Todd Blanchard tblanchard at mac.com
Tue May 2 07:45:38 UTC 2006


On May 2, 2006, at 12:02 AM, SmallSqueak wrote:

> 	In C++ and its derivatives if I have the source for the whole
> system,
> 	can I just add methods to any class I want to then rebuild the whole
>
> 	system?

Sure

> 	Would the effect be the same as what you are saying for Smalltalk?

Yes, the problem is that you seldom have all of the source code for  
the entire system.

> 	I can't really see that this is good software engineering practice.

I can't see where its bad.

> 	My C# friends used to talk about data hiding, encapsulation, public,
> 	private, protected, internal, virtual, ... what a mouthful!

This is the C++ cargo cult.  So many basic ideas behind C++ are wrong  
but have been adopted by the masses anyhow.  Witness the vast number  
of people who believe static typing is holding back the forces of  
darkness.

> 	Just for curiosity reason, are there any other OOP languages that
> allow this practice?

Apart from Smalltalk, have a look at "method categories" in ObjectiveC.
http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/ 
Articles/chapter_4_section_7.html
http://en.wikipedia.org/wiki/Objective-C

There is also an experimental feature known as Traits - a bundle of  
methods that can be attached to any class provided the class  
implements an underlying enabling protocol.  Traits are written in  
terms of the classes methods and cannot access ivars directly (where  
categories are bound to a class at definition time and can access  
ivars).  Traits can only call methods.  The Traits paper is http:// 
www.iam.unibe.ch/~scg/Archive/Papers/Scha03aTraits.pdf

> 	If you don't have access to the source code of Object, can you build
> 	this debugger?

Smalltalk can do reverse compilation when necessary.  Usually, all  
source code is available.

> 	When it's time to upgrade/update the Smalltalk system, do you have
> 	to go to each of these classes that you modified to repeat the whole
> 	procedure.

No, there are various code management strategies including changesets  
and Monticello packages.

> 	Would it be cumbersome if the new version of Smalltalk has the
> methods
> 	with the same name as the ones you added?

That would be inconvenient in any language.

> 	BTW, would this technique help or hinder the efforts to make Squeak
> 	modular? The whole Squeak community have been struggling for several
> 	years to modularize Squeak but it looks like no one really knows
> how.

It can do either, depending on how it is done.

> 	To me this is the only way I can ever make any progress in
> 	learning Squeak. I call it SmallLearn ;-)

There is a new mailing list specifically for helping beginners get up  
to speed you might want to join.
http://lists.squeakfoundation.org/mailman/listinfo/beginners





More information about the Squeak-dev mailing list