[Pharo-project] Stack should be reimplemented with Array

Igor Stasenko siguctua at gmail.com
Mon Oct 18 19:23:17 EDT 2010


On 19 October 2010 00:25, Levente Uzonyi <leves at elte.hu> wrote:
> On Mon, 18 Oct 2010, Igor Stasenko wrote:
>
>> Stephane, i could say more:
>> - i don't like how LinkedList implemented.
>>
>> I don't see why it should mimic things like #at: #at:put: at all..
>
> It's not mimicing those methods. A list usually support things like this,
> but the user should know the consequences.
>

The consequences of such approach is much more far-reaching: leads to
bad design practices, crappy application performance,
and then tons of bugs and workarounds.

>> IMO this protocol should be pruned from it, to not provoke uses which
>> completely do not fit for given data structure.
>
> I'm not sure if it's okay to remove features, because users lacking really
> basic CS knowledge may use them the wrong way.
>

Imo, we should prohibit this from the beginning. Standard, core
classes should not contain an API, which could lead to
careless, abusive programming techniques.
IMO, a kernel APIs should serve not only as an implementation of basic
system funcionality, it also must serve as guide,
how to best use these facilities, so people will learn what is the
right way to use it.

We should teach users to use right tools for things they need.


>>
>> Removing/inserting into the middle of list is quite ineffective
>> operation (O(n)),
>
> As long as you don't give away the link objects, it's O(n), otherwise it can
> be O(1).

giving away link objects... oh, that's the worst thing, which could
possibly happen :)

>
>> while inserting at the begginning/end of list is O(1).
>>
>> Lists are sequenceable.. but sequenceable ~~ indexable. Period.
>
> Sequenceable is indexable, but good performance is not guaranteed.
>
Unless you representing an infinite collection(s).
Streams are good example of sequenceable, however non-indexable containers.


>
> Levente
>
>>
>> --
>> Best regards,
>> Igor Stasenko AKA sig.
>>
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project at lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



-- 
Best regards,
Igor Stasenko AKA sig.




More information about the Pharo-dev mailing list