MassH wrote:
> Libraries and frameworks like JPA/Facelets/Spring/etc should use
> explicit getter/setter methods if they exist and otherwise fallback on
> raw exposed instance variables.
>   

As well as the other comments, one thing that API designers must be 
careful about is future proofing the API.  If you make something an 
instance variable, you can never add in logic to detect when the field 
changes.  If you have set/get functions you can change things later or 
add some extra code in without changing the API and breaking all the 
code using your library.

> BTW, JavaFX has a very elegant solution to the issue with binding.
>   

I believe binding is possible due to being able to sneak code in when 
you look like you are just setting an instance variable - that is, 
because there is set/get code under the covers.  That is, to get this 
benefit in Java it would require a language change.

To me, both of these are the potential benefits of getting properties 
into Java.  I can use direct fields, or introduce setter methods later 
without client source code needing to change (probably needs recompiling 
though).

Alan

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to