On 21-Mar-08, at 12:09 PM, Mike Schrag wrote:

What would be compelling reasons in Java (within the context of WO dev) not to go with public declarations ? What do you advise when doing WO/WOnder development ?


My philosophy on this is that I don't mind ivars only for fields used ONLY by my component (like a repetition item ivar), because I can always wrap them at any time if I need to do anything more complicated. However, for bindings that I expose via a component api file, I make proper get/set methods so that I don't break users of my component if I need to do something more complicated later on inside the binding (in case people are constructing your component and calling the API -- this is usually only an issue for page-level components, though). Just my rule of thumb.

This is similar to my philosophy, I guess.

If:

- The ivars are only used by the component's bindings (ie WORepetition item bindings) - Are used by bindings and are set in only one action or method in the component
        - Are never exposed by the api

Then I usually feel ok accessing them directly.

If I need to expose the variable via the components API or I need to set the ivars value multiple places in the component then I will make the ivar private and wrap it with accessors.

;david

--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site:   http://codeferous.com
blog: http://davidleber.net
profile: http://www.linkedin.com/in/davidleber
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to