Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
than an attempt at solving problems that should be addressed by the platform itself (if at all!)
David Newton wrote:
I don't understand the objection made by Jelle
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
David Newton wrote:Sorry, but I believe getters and setters pretty much fall into the brain-numbingly trivial. Java chooses not to have real properties--why should I suffer from that choice?
Annotating a property with @Getter and @Setter is about as drop-dead simple as you can get, both source-wise, and implementation-wise.
And given the option between a bunch of annotations, and 10x+ as much code, I'll take annotations any day of the week.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
..is a traditional Japanese term for an activity that is wasteful and doesn't add value or is unproductive..
nimo frey wrote:By the way, other (dynamic) languages (Ruby or Scala) omit getter/setters completely. It is noise.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Jelle Klap wrote:What about documentation? The JavaDoc tool doesn't (ok - shouldn't) generate API documentation for private members, so the public accessors are the only suitable way of adding a meaningful description of what a ""property" represents in the domain, what its legal values are, deprecation information, an instance' serialized representation, locking information etc.
I think labelling accessors as purely noise is somewhat of generalization.
But getters/setters are the most "trivial" of the "noisy" methods that this framework can generate for you - what about hashCode() equals() and toString()?
David Newton wrote: ... not rocket surgery...
Steve
Well, to be fair, that's not entirely accurate: other languages support real properties, where explicit getters and setters are optional. When an accessor needs its own functionality, it can be provided.
nimo frey wrote:
Well, to be fair, that's not entirely accurate: other languages support real properties, where explicit getters and setters are optional. When an accessor needs its own functionality, it can be provided.
I do not understand this:
Why does ruby or scala developers prefer using field based access, if it is a bad programming style (encapsulation or the like) ?
Steve
they are more like providing a class with implicit get() and set() methods.
nimo frey wrote:I was wondering about ruby or scala code which makes extensive use of fields (for example, objects which has only fields).
will it allow me to search the usages (keeping the namespace intact)
It's probably best to call them "properties", since that's the canonical term.
they just provide *real* property support, unlike Java.
Test 094, IBM WID 6.0 cert
SCJP 1.2
SCBCD 1.3 Beta
SCWCD 1.4 Beta
SCMAD Beta
SCDJWS Beta
KS
David Newton wrote:You don't--how can you annotate a method that doesn't exist?
You *might* be able to do some byte-code manipulation, or figure out a way to make Hibernate apply its annotations to the methods after Lombok generates the accessors, but IMO the effort really wouldn't be worth it.
So you made a portal in time and started grabbing people. This tiny ad thinks that's rude:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|