Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #6950
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Getters and Setters |
| Date | 2011-08-09 21:50 -0700 |
| Organization | Canadian Mind Products |
| Message-ID | <5c3447t4cta8ee9n2dp931r57908a6ocl8@4ax.com> (permalink) |
| References | <79c811c0-8eec-4c87-8027-2bc971818278@l9g2000prd.googlegroups.com> |
On Tue, 9 Aug 2011 18:59:47 -0700 (PDT), Vikram <vpradhan33@gmail.com> wrote, quoted or indirectly quoted someone who said : >Why do we use getter and setters if we can do the same work by >declaring the public data members. it makes it possible to add code to the setter to for example validate the data. You can add debug code to a getter. In some languages, you can use the clean public variable syntax to access a getter or setter in an expression, so the distinction is blurred. I think Java missed the boat with its incredibly clumsy getter/setter syntax. It is almost like writing assembler. -- Roedy Green Canadian Mind Products http://mindprod.com Most of computer code is for telling the computer what do if some very particular thing goes wrong.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar
Getters and Setters Vikram <vpradhan33@gmail.com> - 2011-08-09 18:59 -0700
Re: Getters and Setters "John B. Matthews" <nospam@nospam.invalid> - 2011-08-09 22:11 -0400
Re: Getters and Setters Arne Vajhøj <arne@vajhoej.dk> - 2011-08-09 22:37 -0400
Re: Getters and Setters Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-09 23:30 -0400
Re: Getters and Setters Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-08-10 06:34 -0300
Re: Getters and Setters Roedy Green <see_website@mindprod.com.invalid> - 2011-08-09 21:50 -0700
csiph-web