[Newbies] closed and open interval

Bert Freudenberg bert at freudenbergs.de
Mon Nov 24 17:46:43 UTC 2008


On 24.11.2008, at 18:36, Randal L. Schwartz wrote:

>>>>>> "Bert" == Bert Freudenberg <bert at freudenbergs.de> writes:
>
> Bert> On 24.11.2008, at 17:46, Randal L. Schwartz wrote:
>
>>>>>>>> "Filip" == Filip Malczak <filet00 at gmail.com> writes:
>>>
> Filip> You can always make subclass of Interval for example   
> OpenedInterval
>>> , add
> Filip> two variables: left and right.Make new methods:
> OpenedInterval> from: aNumber to: aNumber left: aBoolean
> OpenedInterval> from: aNumber to: aNumber right: aBoolean
> OpenedInterval> from: aNumber to: aNumber left: aBoolean right:   
> aBoolean
>>>
>>> You're exposing implementation there.
>
> Bert> How so?
>
> You're requiring the user to do their own encoding of "open = true,  
> closed =
> false", when that's really no business of the user.

It might be a bad interface, but it does not expose the implementation.

> And what if you decide later to encode the four combinations as a  
> single pluggable block or symbol?


Then you change the method that takes the booleans to create a block  
or symbol.

- Bert -




More information about the Beginners mailing list