AnsweredAssumed Answered

for the love of extensibility

Question asked by rdanner on Oct 15, 2007
Guys….  what in the world is going on with all the private methods in the code base?!  I can't tell you how many times I've tried to extend this or that only to find some method is private or that the only access to a member field is through the variable itself and it's scoped private.

We need to be really careful when we are making private methods – I mean it's really got to be private stuff – something not worth/appropriate to extending, overriding, patching with a subclass etc.   

I know eclipse defaults methods to private … but PLEASE think hard before you leave a method private or packaged scope.   Not everyone has access to the base source tree to widen a scope when it becomes an issue. I don't really except the widen the scope when you need to theory anyway – we should be thinking about how the code is/will be/should be extended right from the get-go.

Making your methods protected and making sure that member fields have protected getters and setters goes a long way in making patch-able, extensible code. 

Obviously I am not here just to rant – I care deeply about the product and doing things the right way – I care about the community and it's ability to extend and patch the product – and I don't always have the context – so if I am off – fill me in!  What is the philosophy?

Outcomes