On Sun, Apr 24, 2011 at 11:17 AM, Alexandre Bergel <[email protected]> wrote: >>> - each public method belongs to a method category named public* >>> - each private method belongs to a method category named private* >> >> Others here may disagree -- and the dreary of legislating and >> enforcing conventions aside -- but I strive (usually with success) to >> move all privately-used methods to one or more delegates. One class's >> private method is just another's public??? > > A private method may have to access instances variables. Moving the method to > another class may be difficult sometimes.
All the more reason to move it! A private method accessing instance variables is just global-variable-oriented spaghetti programming disguised by a class. Such a method is just begging to be moved to a delegate and to accept the instance var values as arguments. >>> - other methods are considered as "package visible", meaning that they >>> belong to a category that does not begins with 'private' or 'public' >> >> Again, I sympathise with facing the visibility problem, but I don't >> trust that conventions will be upheld by either end, so I tire of >> following them. Replace Pharo/Squeak categories with Newspeak >> modules; replace Pharo/Squeak protocols with traits (stateless, >> please); I'll be the first in line. > > I do not think this should be enforced. It is easy to infer method visibility > with a set of well defined scenarios, for example the one that comes in unit > tests. You can't infer reliably from such shaky premises, whether they are manifest as conventions or unit tests. Cheers, Mike
