Why Strings as Classes?
Derek Parnell
derek at psych.ward
Wed Aug 27 14:58:44 PDT 2008
On Wed, 27 Aug 2008 17:08:47 -0400, Nick Sabalausky wrote:
> The way I see it, encapsulation is all about the black box idea. And the
> only things you can see from outside the black box are the inputs and
> outputs.
Well said.
> Indexing: Return the element at position N.
> Find: Return the position of the element that is equal (value-equal or
> identity-equal, depending on the find) to X .
Exactly.
> So if there's a function that returns the element at position N and you call
> it "find" just because of the *internal implementation* of the function is
> an incrementing loop, I consider that to be both a violation of
> encapsulation (because the name has been chosen based on the inner workings
> of the function, not it's input-output relationship) and a violation of the
> definitions.
Not to mention just plain confusing.
--
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell
More information about the Digitalmars-d
mailing list