Some notes after looking at couple of patches recently. Probably interesting only to sipXconfig contributors.
Property accessors getThing(), setThing() (or isThingy(), setThingy() if property is boolean) are the necessary evil in Java (modern languages have the concept of the property as a part of the language - Java does not). Several technologies that we use require Java properties. There are subtle differences I'd like to point out below. - Hibernate entities (classes mapped to DB) require setters and getters. - Spring beans (classes instantiate by DOI container) require setters only. Use @Required annotation if the code expects the property to be set. - Tapestry manages properties for you so most of the accessors are abstract. Couple things to remember: - side effect (meaning anything in addition to setting or getting a property value) is a *hack* - adding accessors 'just in case it might be needed' is *bad*: in most cases you do not need getters for Spring properties - having accessors in the interface is *in most cases bad*: they are part of the implementation not part of the interface Eclipse is perfectly capable of generating accessors for you. Just type in 'set' (or 'get' or 'is') press <tab> and see what happens. The advantage - other than saving keystrokes (research shows we only have a limited number of keystrokes per lifetime) - is that Eclipse will generate them exactly the way we want them: No side effects and proper names. D. _______________________________________________ sipx-dev mailing list [email protected] List Archive: http://list.sipfoundry.org/archive/sipx-dev Unsubscribe: http://list.sipfoundry.org/mailman/listinfo/sipx-dev sipXecs IP PBX -- http://www.sipfoundry.org/
