[squeak-dev] Balance of metrics

tim Rowledge tim at rowledge.org
Mon Mar 12 19:26:54 UTC 2018



> On 12-03-2018, at 11:48 AM, Tobias Pape <Das.Linux at gmx.de> wrote:
> 
> well, I think the compiler complains if you send messages starting with 'pvt' to something other than self, right?

That's the wrong way round though; it requires the sender to know too much. And it can't work to stop (ab)use of #perform: type sneakiness.
> 
> Other than that, I think there's too much merit in "vars are private, messages are public" than to introduce an outright restrictive messaging model.

Personally I'd be more inclined to go for "methods are private unless explicitly set to public" as a way to aggressively make people think about what they're doing!

> 
> You'll never know what part of your objects interface is gonna being needed down the road.

Well you ought to at least think about it a bit, and the nice thing is that stuff can be changed, what this being Smalltalk.

And while I'm being all dictatorial, I really hate to see code like

  self foo bim baz wibble at: weeble state count + 1

ie chains of accessors that imply far too much knowledge of the type of what you get returned. Should be more like

  self wibbleStateAt: weeble nextState

with suitable delegations though whatever foo is, and its baz, and its wibble, and so on.

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Strange OpCodes: FA: Failsafe Armed




More information about the Squeak-dev mailing list