Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #38915
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Java variable access |
| Date | 2019-04-13 18:38 -0400 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <q8tod9$kb9$1@gioia.aioe.org> (permalink) |
| References | <109a7224-f392-46c3-bf56-7d8bf2bfb4bf@googlegroups.com> <13t97bxk9km7n$.ooqi8n8ocm7f$.dlg@40tude.net> <q8rfas$iti$1@gioia.aioe.org> <13ak6boysjgrh$.1h4x7tkjgs00q$.dlg@40tude.net> |
On 4/13/2019 3:59 PM, Joerg Meier wrote: > On Fri, 12 Apr 2019 21:51:28 -0400, Arne Vajhøj wrote: > >> On 4/12/2019 5:11 PM, Joerg Meier wrote: >>> On Fri, 12 Apr 2019 06:57:27 -0700 (PDT), Eric Douglas wrote: >>>> If one would need to get and set values of simple class variables, >>>> is it better to declare public variables or declare them private with >>>> getter/setter methods, or are there situations where you would do both? >>>> I have been declaring all variables private though sometimes creating >>>> the getter/setter methods just seems like unnecessary busy work if >>>> making them public would accomplish the same thing. >>> <https://projectlombok.org/features/GetterSetter> > >>> You are welcome. There is also @Data, which amongst a few other things adds >>> @Getter and @Setter to all your fields. >> But today wouldn't it be better to switch to Kotlin? > > From the TIOBE index, 2019: > > Rank Rank (2018) Language Rating > 1 1 Java 15.035% > [...] > 35 None Kotlin 0.337% > > So, no. Absolutely not. I am not sure that comparison is relevant. We are not discussing Java vs Kotlin. We are discussing Java/Lombok vs Kotlin. The Java way is to write the getters and setters. Arne
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Java variable access Eric Douglas <e.d.programmer@gmail.com> - 2019-04-12 06:57 -0700
Re: Java variable access Arne Vajhøj <arne@vajhoej.dk> - 2019-04-12 10:06 -0400
Re: Java variable access Eric Douglas <e.d.programmer@gmail.com> - 2019-04-12 07:23 -0700
Re: Java variable access Arne Vajhøj <arne@vajhoej.dk> - 2019-04-12 10:35 -0400
Re: Java variable access Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-04-12 10:58 -0400
Re: Java variable access Eric Douglas <e.d.programmer@gmail.com> - 2019-04-12 08:31 -0700
Re: Java variable access Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-04-12 14:40 -0400
Re: Java variable access Arne Vajhøj <arne@vajhoej.dk> - 2019-04-12 12:31 -0400
Re: Java variable access Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-04-12 10:56 -0400
Re: Java variable access Joerg Meier <joergmmeier@arcor.de> - 2019-04-12 23:11 +0200
Re: Java variable access Arne Vajhøj <arne@vajhoej.dk> - 2019-04-12 21:51 -0400
Re: Java variable access Joerg Meier <joergmmeier@arcor.de> - 2019-04-13 21:59 +0200
Re: Java variable access Arne Vajhøj <arne@vajhoej.dk> - 2019-04-13 18:38 -0400
Re: Java variable access Joerg Meier <joergmmeier@arcor.de> - 2019-04-16 22:08 +0200
Re: Java variable access Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-04-16 16:46 -0400
Re: Java variable access Joerg Meier <joergmmeier@arcor.de> - 2019-04-16 23:01 +0200
Re: Java variable access Eric Douglas <e.d.programmer@gmail.com> - 2019-04-17 06:42 -0700
Re: Java variable access Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2019-04-17 21:35 +0200
Re: Java variable access Eric Douglas <e.d.programmer@gmail.com> - 2019-04-17 14:05 -0700
Re: Java variable access Joerg Meier <joergmmeier@arcor.de> - 2019-04-19 10:40 +0200
Re: Java variable access Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-04-19 17:20 -0400
csiph-web