Oh yes, if your class is part of a public API, then you can't just switch between fields and getters/setters. You pick one approach and have to stick with that to preserve compatibility. For this case, proper language support would be beneficial.
However, the majority of code being written is part of a private application and not a public API. In that case, changing between fields and getters/setters is a trivial refactor in a private code base. Libraries such as JPA/Facelets/Spring are using runtime reflection so they should automatically adjust. On Jul 1, 8:16 pm, Alan Kent <[email protected]> wrote: > 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. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
