Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #14491
| From | Lew <noone@lewscanon.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Good Fowler article on ORM |
| Date | 2012-05-12 12:12 -0700 |
| Organization | albasani.net |
| Message-ID | <jomcmv$9l6$1@news.albasani.net> (permalink) |
| References | (2 earlier) <joihae$oiv$1@news.albasani.net> <jokg12$jce$1@dont-email.me> <jolcd0$3g7$1@news.albasani.net> <joldlk$gv7$1@dont-email.me> <jolgn9$chj$1@news.albasani.net> |
Jan Burse wrote: > Yes some JITs can do the required escape analysis to some > extent. But when talking about JITs there is always a weak > JIT and a strong JIT, since there are different providers on > the market. True statements. > For example I am developing the same code base for later > use in both Swing and Android. And the Dalvik JIT for > Android is lacking a little bit behind, you can even read > recommendations to not use setters/getters (sic!) if possible > in code written for Dalvik. "Setter" and "getter" are well-established informal terms with nothing shameful in their pedigree. One must be judicious in accepting such recommendations. I don't oppose direct use of attribute values /per se/, but I do warn against microoptimization early in the development cycle. Write the code that most clearly expresses the model and behaviors it implements. If you do use, say, 'public' variables in a class, strongly consider using read-only values to immutable instances. It is neither microoptimization nor premature to consider whether data will be primarily read or frequently written. A good domain model considers the flow and "shape" of information (size of data packets, frequency of transactions, proportion of duplicates, etc.) and its transformation, not just the static object model. Considerations of read-heaviness vs. write-happiness originate in the domain model and are appropriate topics for early analysis. (Aside: "write-happiness" was a typing accident that I shall let stand.) Whether an attribute comes as a variable reference or a method call is an implementation detail perhaps irrelevant to the domain model. An immutable final variable is not dangerous and can be justified without fear that it's premature. It directly expresses the intent, might (!) help on an Android and won't hurt elsewhere. OTOH I will continue to write my own Android code with getters and setters. > So I am helping the JIT and I am helping the application. And I'm sure the JIT is ever so grateful for your undoubtedly most useful assistance. You should back up such claims with hard evidence. Measurable, repeatable tests. I'm not saying you aren't helping, but "helping the optimizer" is so often such an utterly outrageous claim that it can never be accepted on the face. > The code fragment under discussion is heavily used internally > to the API, since the indexing is dynamic. It is still possible > for the dynamic multi-indexing API, the package which has 9 classes, > to provide a proper Iterator interface to the outside, and use > this by the application. > > But if you know that youre deployment range will be only > top-notch JITs you might go into the pain of adding additional > class to the package for the iterator implementations. This > would blow up the packgage to 11 classes, counting the > .class files. I don't think I get your last paragraph here. What pain? What additional classes? Why? Regardless, source-code structure should nearly always express algorithm, not platform. Deviations should stem from measured results. I'm willing to lay odds that for your use cases the difference made by accessors and mutators is not the low-hanging fruit. Harmless optimizations that also strengthen code structure are always acceptable, of course. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Good Fowler article on ORM Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-05-10 19:50 -0300
Re: Good Fowler article on ORM Roedy Green <see_website@mindprod.com.invalid> - 2012-05-10 16:52 -0700
Re: Good Fowler article on ORM Arne Vajhøj <arne@vajhoej.dk> - 2012-05-10 20:10 -0400
Re: Good Fowler article on ORM Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-05-11 01:56 -0500
Re: Good Fowler article on ORM Jan Burse <janburse@fastmail.fm> - 2012-05-11 10:06 +0200
Re: Good Fowler article on ORM Jan Burse <janburse@fastmail.fm> - 2012-05-11 10:09 +0200
Re: Good Fowler article on ORM David Lamb <dalamb@cs.queensu.ca> - 2012-05-11 21:56 -0400
Re: Good Fowler article on ORM Jan Burse <janburse@fastmail.fm> - 2012-05-12 12:01 +0200
Re: Good Fowler article on ORM David Lamb <dalamb@cs.queensu.ca> - 2012-05-12 06:22 -0400
Re: Good Fowler article on ORM Jan Burse <janburse@fastmail.fm> - 2012-05-12 13:14 +0200
Re: Good Fowler article on ORM Jan Burse <janburse@fastmail.fm> - 2012-05-12 13:27 +0200
Re: Good Fowler article on ORM markspace <-@.> - 2012-05-12 08:15 -0700
Re: Good Fowler article on ORM Jan Burse <janburse@fastmail.fm> - 2012-05-12 18:21 +0200
Re: Good Fowler article on ORM markspace <-@.> - 2012-05-12 10:37 -0700
Re: Good Fowler article on ORM Lew <noone@lewscanon.com> - 2012-05-12 12:27 -0700
Re: Dalvik running on the Android device emulator Fredrik Jonson <fredrik@jonson.org> - 2012-05-13 07:21 +0000
Re: Dalvik running on the Android device emulator David Lamb <dalamb@cs.queensu.ca> - 2012-05-13 08:18 -0400
Re: Good Fowler article on ORM Lew <noone@lewscanon.com> - 2012-05-12 12:12 -0700
Re: Good Fowler article on ORM Jan Burse <janburse@fastmail.fm> - 2012-05-12 21:53 +0200
Re: Good Fowler article on ORM Jan Burse <janburse@fastmail.fm> - 2012-05-12 21:59 +0200
Re: Good Fowler article on ORM Lew <noone@lewscanon.com> - 2012-05-12 13:55 -0700
Re: Good Fowler article on ORM Lew <noone@lewscanon.com> - 2012-05-12 13:59 -0700
Re: Good Fowler article on ORM Jan Burse <janburse@fastmail.fm> - 2012-05-12 23:49 +0200
Re: Good Fowler article on ORM Lew <noone@lewscanon.com> - 2012-05-12 17:14 -0700
Re: Good Fowler article on ORM jb <janburse@fastmail.fm> - 2012-05-13 02:11 -0700
Re: Good Fowler article on ORM Lew <noone@lewscanon.com> - 2012-05-14 22:25 -0700
Re: Good Fowler article on ORM Arne Vajhøj <arne@vajhoej.dk> - 2012-05-20 22:15 -0400
Re: Good Fowler article on ORM Arne Vajhøj <arne@vajhoej.dk> - 2012-05-10 20:03 -0400
Re: Good Fowler article on ORM Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-05-10 18:40 -0700
Re: Good Fowler article on ORM Arne Vajhøj <arne@vajhoej.dk> - 2012-05-10 21:42 -0400
Re: Good Fowler article on ORM Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-05-13 19:40 -0300
Re: Good Fowler article on ORM markspace <-@.> - 2012-05-10 19:17 -0700
Re: Good Fowler article on ORM Lew <lewbloch@gmail.com> - 2012-05-10 16:41 -0700
Re: Good Fowler article on ORM Robert Klemme <shortcutter@googlemail.com> - 2012-05-12 14:33 -0700
csiph-web