"Also, while making this change it might be worth considering adding a prefix
to the variable names, 'field' is typical. So...
...
This has two advantages. Firstly, it avoids mistaken direct access to the
variable and secondly it makes the class JavaBean compatible..."


+1 for the first reason, but I think that it is JavaBean compatible even without the renaming.


+0. I've seen this.name = name cause problems, so whatever workaround makes the coder doing it happy. Dunno if it's worth refactoring existing stuff.


What kind of problems?


The refactoring tool I'm using (eclipse) can generate getters and setters, but it names them by adding a "get" and "set" prefix.

Generating Getter and Setter for

private String name;

produces the following:

        public String getName() {
                return name;
        }

        public void setName(String string) {
                name = string;
        }

So if you add "field" to these private variables, the automatic
getter and setter generation won't work.

So IMHO it's a bad idea.

Steen


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to