pipe and system building

Fabio Filasieno fabio.filasieno at gmail.com
Thu Aug 30 09:57:03 UTC 2007


On Aug 30, 2007, at 2:55 AM, Blake wrote:

> On Wed, 29 Aug 2007 02:41:01 -0700, Fabio Filasieno  
> <fabio.filasieno at gmail.com> wrote:
>
>>  From a first look at the collection libraries, it seems to me that
>> there is a LOT of bloat. Really really a LOT.
>> I bet that Ocaml's collections can do the same things with an order
>> of magnitude of less of code.
>
> Easy enough to demonstrate, at least for starters. Show us a  
> particularly bad example in Squeak and the same thing in OCaml.  
> Then how you would recommend Smalltalk change. Stephen and his pals  
> redesigned the whole collection system in traits to demonstrte  
> their theory. (BTW, anyone know how to turn traits visible in the  
> browser?)
>
I'll show the most evident thing

add: newObject after: oldObject
	"Add the argument, newObject, as an element of the receiver. Put it in
	the sequence just succeeding oldObject. Answer newObject."
	
	| index |
	index _ self find: oldObject.
	self insert: newObject before: index + 1.
	^newObject

Why ? Why there is a NEED for this ? to save me 2 lines of code ?

I would dump it.

If the user needs to do that he could write: find then insert. is it ?

This is an example of bloat !
We have the virtual address space, right ?
Let's add methods at will. Is it ?
Or we might add all the permutations of add/find/delete.. in  
sequences of 2 ... to n, if the previous method is ok.

A functional programmer (LISP) don't even have the stack data  
structure. They use a list. As they are very very concerned of bloat.  
Maybe this is extreme. And it would't be a bad idea to keep a stack.  
But this is to render the idea.

The general philosophy should be: essentiality. Find the core. And  
express just that.

Which doesn't mean not having rich objects. It just mean more care on  
what we really need.


In OrderedCollection I would dump:
addLast: (make Add be addLast)
add:after:
add:afterIndex:
add:before:
add:beforeIndex
addAll (make addAllLast be AddAll)
...
sorry too long to write them all. I wanted to make a list of things  
to cut in OrderedCollection. But I had to stop to many. And you get  
the idea.

The general idea is that if a method is 4 lines long.
1 line for variable declaration
1 line for return value
2 lines to send 2 messages to self .... on public methods ...

Don't you think that this numbers shout at you `I'm bloat !`
50% overhead => the method is not doing anything (declaration and  
return) and inlining would remove this overhead .
50% just 2 calls to self...

It's very very ugly ...

In Ocaml there is simply no bloat. Just open their doc. count the  
methods. There are very few.
LISP is even more terse.

Then there is the following, which is a bit more subjective.

I don't care of traits.
I don't care of inheritance, the less the better. It confuses me.

I want to pick objects that I need as easily as I pick pasta from the  
supermarket.
Who cares that `tagliatelle` is a similar type of pasta to `fettuccine`.
I know when I want `fettuccine`. And I know went I want `tagliatelle`.

But this is subjective. Someone might think this quite differently.

Fabio





More information about the Squeak-dev mailing list